m@24
|
1 (cl:in-package #:amuse)
|
m@24
|
2
|
m@24
|
3 ;;; Pulling compositions from the database
|
m@24
|
4
|
d@123
|
5 (defgeneric get-composition (identifier)
|
d@123
|
6 (:documentation "Returns a composition of type dependant on
|
d@123
|
7 identifier"))
|
m@24
|
8
|
d@169
|
9 (defgeneric get-constituents (constituent-identifier)
|
d@169
|
10 (:method ((id composition-identifier)) (list (get-composition id)))
|
d@169
|
11 (:documentation "Returns a list of constituents matching the
|
d@169
|
12 criteria in identifier"))
|
d@169
|
13
|
m@89
|
14 (defgeneric monody (object)
|
m@89
|
15 (:documentation "Returns a monody."))
|
m@89
|
16 (defgeneric ensure-monody (object)
|
m@89
|
17 (:documentation "Returns a generalised boolean."))
|
m@89
|
18
|
d@33
|
19 ;;; Getting constituents from compositions
|
d@33
|
20 ;; IS this the mechanism we want to use
|
d@72
|
21 (defgeneric time-signatures (composition)
|
d@72
|
22 (:documentation "Returns all time-signatures in a composition
|
d@72
|
23 Probably shouldn't be exported - can be replaced
|
d@72
|
24 by (get-applicable-time-signature commposition composition)"))
|
d@72
|
25 (defgeneric (setf time-signatures) (sequence composition)
|
d@72
|
26 (:documentation "Sets all time-signatures in a composition.
|
d@72
|
27 Is this wanted here?"))
|
d@72
|
28 (defgeneric tempi (composition)
|
d@72
|
29 (:documentation "Returns all tempi in a composition Probably
|
d@72
|
30 shouldn't be exported - can be replaced
|
d@72
|
31 by (get-applicable-tempi commposition composition)"))
|
d@72
|
32 (defgeneric (setf tempi) (sequence composition)
|
d@72
|
33 (:documentation "Sets all tempi in a composition.
|
d@72
|
34 Is this wanted here?"))
|
d@72
|
35 (defgeneric key-signatures (composition)
|
d@72
|
36 (:documentation "Returns all key-signatures in a composition
|
d@72
|
37 Probably shouldn't be exported - can be replaced
|
d@72
|
38 by (get-applicable-key-signature commposition composition)"))
|
d@72
|
39 (defgeneric (setf key-signatures) (sequence composition)
|
d@72
|
40 (:documentation "Sets all key sigs in a composition.
|
d@72
|
41 Is this wanted here?"))
|
d@33
|
42
|
m@24
|
43 ;;; Simple Accessors
|
m@24
|
44
|
m@24
|
45 ;; pitch-based
|
m@24
|
46
|
m@24
|
47 (defgeneric pitch (object &key kind)) ; ? Maybe this returns the pitch
|
m@24
|
48 ; in its ur form?
|
d@136
|
49 (defgeneric chromatic-pitch (pitch))
|
d@136
|
50 (defgeneric diatonic-pitch (pitch))
|
m@24
|
51 (defgeneric frequency (object)) ;?
|
m@81
|
52
|
d@136
|
53 (defgeneric octave (pitch)
|
m@86
|
54 (:documentation "Return an integer representing the octave of
|
d@136
|
55 pitch where middle c is defined to be the lowest pitch in
|
m@86
|
56 octave 4."))
|
m@86
|
57
|
d@136
|
58 (defgeneric diatonic-pitch-octave (pitch)
|
c@106
|
59 (:documentation "Return an integer representing the diatonic octave
|
d@136
|
60 of pitch."))
|
c@106
|
61
|
d@136
|
62 (defgeneric diatonic-pitch-accidental (pitch)
|
m@86
|
63 (:documentation "Return an integer representing the inflection of a
|
m@86
|
64 diatonic pitch where where negative values indicate numbers of flats,
|
m@86
|
65 0 indicates natural and positive values indicate numbers of sharps."))
|
m@86
|
66
|
d@136
|
67 (defgeneric diatonic-pitch-mp (pitch)
|
c@108
|
68 (:documentation "Return an integer representing the morphetic pitch
|
c@108
|
69 \(in MIPS terms) of a diatonic pitch."))
|
d@136
|
70 (defgeneric diatonic-pitch-cp (pitch)
|
c@108
|
71 (:documentation "Return an integer representing the chromatic pitch
|
c@108
|
72 \(in MIPS terms) of a diatonic pitch."))
|
c@108
|
73
|
d@136
|
74 (defgeneric middle-c (pitch)
|
m@81
|
75 (:documentation "Returns the value of middle C in the particular
|
d@136
|
76 representation of pitch used by PITCH."))
|
d@136
|
77 (defgeneric midi-pitch-number (pitch)
|
d@136
|
78 (:documentation "Takes a pitch (usually a pitched event) and
|
d@136
|
79 returns an integer between 0 and 127 representing the chromatic
|
d@136
|
80 pitch represented (60=middle C, 48 the C below that, etc.)"))
|
d@136
|
81 (defgeneric asa-pitch-string (pitch)
|
m@81
|
82 (:documentation "Returns a string representing the designated ASA
|
m@81
|
83 pitch name which has three parts: a letter name in the set
|
m@81
|
84 {A,B,C,D,E,F,G}, an inflection in the set {n,f,s,ff,ss,fff,sss,...}
|
m@81
|
85 and an octave number. E.g., Cn4 = Middle C."))
|
d@136
|
86 (defgeneric asa-interval-string (pitch)
|
c@112
|
87 (:documentation "Returns a string representing the designated ASA
|
c@112
|
88 interval name which has two or three parts: a direction in the set
|
c@112
|
89 {r,f} (absent for unisons/primes), a type in the set
|
c@112
|
90 {p,ma,mi,a,d,aa,dd,aaa,ddd,...}, and a size number. E.g. rma2 =
|
c@112
|
91 rising major second."))
|
d@136
|
92 (defgeneric diatonic-pitch-name (pitch)
|
m@81
|
93 (:documentation "Returns a char in the set
|
m@81
|
94 {#\A,#\B,#\C,#\D,#\E,#\F,#\G}, representing the pitch name of
|
d@136
|
95 PITCH."))
|
d@136
|
96 (defgeneric pitch-class (pitch)
|
d@136
|
97 (:documentation "Takes a pitch (usually a pitched event) and
|
d@136
|
98 returns an integer between 0 and 12 representing the
|
d@136
|
99 octave-independant pitch, with c=0, c#=1, etc.")
|
m@24
|
100 (:method (p) (mod (midi-pitch-number p) 12)))
|
d@136
|
101 (defgeneric span (pitch-interval))
|
m@24
|
102
|
m@24
|
103 ;; time
|
m@24
|
104
|
d@136
|
105 (defgeneric duration (period)
|
d@136
|
106 (:documentation "Returns a real. Probably should only apply do
|
d@136
|
107 standard-periods (rather than periods? or should it return
|
d@136
|
108 something other than a value in other cases)"))
|
d@136
|
109 (defgeneric (setf duration) (value period)
|
d@136
|
110 (:documentation "As with duration, perhaps this should work only
|
d@136
|
111 with standard-periods"))
|
d@136
|
112 (defgeneric timepoint (moment)
|
d@136
|
113 (:documentation "Returns a number for a moment. Does this make
|
d@136
|
114 any sense on an abstrace class? Should it just apply to
|
d@136
|
115 standard-moment?"))
|
d@136
|
116 (defgeneric (setf timepoint) (value moment)
|
d@136
|
117 (:documentation "Sets timepoint. What does this mean for an
|
d@136
|
118 abstract class? Should it just apply to standard-moment"))
|
d@136
|
119 (defgeneric cut-off (anchored-period) ; name?
|
d@72
|
120 (:documentation "Returns a <moment> representing the point at
|
d@121
|
121 which the anchored period has ended. By default, is calculated
|
d@121
|
122 as the result of running time+ on the onset and period of the
|
d@121
|
123 object.")
|
d@136
|
124 (:method (apd) (time+ (moment apd) (period apd))))
|
d@136
|
125 (defgeneric crotchet (object)
|
m@95
|
126 (:documentation "Returns a period, the duration of which represents
|
m@95
|
127 a crotchet in the time representation used by object."))
|
m@24
|
128
|
m@24
|
129 ;; others
|
m@24
|
130
|
m@24
|
131 ;; I've given the time-sig accessors general names because it allows
|
m@24
|
132 ;; for symbols in time-signatures as well as numbers - numerator is an
|
m@24
|
133 ;; odd accessor if the time sig is C (even in common practice) but
|
d@100
|
134 ;; its meaning is clear. beat-units-per-bar is clearer, though, I
|
m@24
|
135 ;; think.
|
m@24
|
136
|
d@123
|
137 (defgeneric beat-units-per-bar (time-signature)
|
d@123
|
138 (:documentation "In a standard, fraction-like time-signature or
|
d@123
|
139 a symbolic equivalent, this is the numerator."))
|
m@24
|
140 (defgeneric time-signature-numerator (time-signature)
|
d@123
|
141 (:method (ts) (beat-units-per-bar ts))
|
d@123
|
142 (:documentation "Not obviously meaningful for non fraction-like
|
d@123
|
143 time signatures"))
|
d@123
|
144 (defgeneric beat-units (time-signature)
|
d@123
|
145 (:documentation "In a standard, fraction-like time-signature or
|
d@134
|
146 a symbolic equivalent, this is the denominator (n.b. the
|
d@134
|
147 difference between this and @code{tactus-duration} is only
|
d@134
|
148 visible for compound time, where this returns the lower portion
|
d@134
|
149 of the time signature, but @code{tactus-duration} returns the
|
d@134
|
150 higher-level unit)."))
|
m@24
|
151 (defgeneric time-signature-denominator (time-signature)
|
d@123
|
152 (:method (ts) (beat-units ts))
|
d@123
|
153 (:documentation "Not obviously meaningful for non fraction-like
|
d@123
|
154 time signatures"))
|
d@33
|
155 (defgeneric tactus-duration (time-signature)
|
d@33
|
156 ;; basic, but should do?
|
d@33
|
157 (:method (ts)
|
d@33
|
158 (cond
|
d@33
|
159 ((and (not (= (beat-units-per-bar ts) 3))
|
d@33
|
160 (= (rem (beat-units-per-bar ts) 3) 0))
|
d@33
|
161 ;; compound time
|
d@33
|
162 (* (/ 4 (beat-units ts))
|
d@33
|
163 3))
|
d@123
|
164 (t (/ 4 (beat-units ts)))))
|
d@123
|
165 (:documentation "Returns a number of crotchets to represent the
|
d@123
|
166 tactus, based on some idea of time signature patterns. Should,
|
d@123
|
167 in future, return a duration rather than a number."))
|
m@24
|
168
|
d@123
|
169 (defgeneric key-signature-sharps (key-signature)
|
d@123
|
170 (:documentation "Simple query for normal key-signatures."))
|
d@123
|
171 (defgeneric key-signature-mode (ks)
|
d@123
|
172 (:documentation "Query that only makes sense for midi-like key
|
d@123
|
173 signatures"))
|
m@24
|
174
|
d@123
|
175 (defgeneric bpm (tempo)
|
d@123
|
176 (:documentation "Basic tempo query")) ;; in bpm
|
m@24
|
177 (defgeneric microseconds-per-crotchet (tempo)
|
m@24
|
178 ;; As used (when rounded) in MIDI
|
d@123
|
179 (:method (tp) (/ 60000000 (bpm tp)))
|
d@123
|
180 (:documentation "Basic tempo query for MIDI. N.B. This will be
|
d@123
|
181 a fraction and must be rounded before being used for output."))
|
m@24
|
182
|
m@24
|
183 ;;; Coerce-type accessors
|
m@24
|
184
|
m@24
|
185 ;; Should I be including these default methods? Should the accessors
|
m@24
|
186 ;; be direct slot accessors or the generics I'm using? Should we
|
m@24
|
187 ;; return the object itself if it already is in the target class?
|
m@24
|
188
|
d@136
|
189 (defgeneric anchored-period (anchored-period)
|
d@123
|
190 (:method (apd) (make-anchored-period (onset apd) (duration apd)))
|
d@123
|
191 (:documentation "Coerce any anchored period to a plain anchored
|
d@123
|
192 period"))
|
m@24
|
193
|
d@136
|
194 (defgeneric period (period)
|
d@136
|
195 (:method (pd) (make-period (duration pd)))
|
d@123
|
196 (:documentation "Coerce any period to a floating period"))
|
m@24
|
197
|
d@136
|
198 (defgeneric moment (moment)
|
d@123
|
199 (:method (md) (make-moment (timepoint md)))
|
d@136
|
200 (:documentation "Coerce any moment, including an
|
d@123
|
201 anchored-period to a moment"))
|
m@24
|
202
|
d@136
|
203 (defgeneric onset (anchored-period)
|
d@139
|
204 (:method (ap) (moment ap))
|
d@123
|
205 (:documentation "Return a moment for the start of an anchored period"))
|
d@136
|
206 (defgeneric (setf onset) (value anchored-period))
|
m@24
|
207
|
m@24
|
208 ;;; Time Protocol (or moments?)
|
m@24
|
209
|
m@24
|
210 ;; negative times/durations -> ERROR?
|
m@24
|
211
|
m@24
|
212 ;; time+: <time> <duration> -> <time>
|
m@24
|
213 ;; <duration> <time> -> <time> (same as previous?)
|
m@24
|
214 ;; <duration> <duration> -> <duration> (or a distinct duration+?)
|
m@24
|
215 ;; <time> <time> -> ERROR?
|
m@24
|
216 ;;
|
m@24
|
217 ;; time-: <time> <time> -> <duration>
|
m@24
|
218 ;; <time> <duration> -> <time>
|
m@24
|
219 ;; <duration> <duration> -> <duration> (or a distinct duration-?)
|
m@24
|
220 ;; <duration> <time> -> ERROR?
|
m@24
|
221 ;; <anchored> <anchored> -> (time- (moment o1) (moment o2)) ? or error?
|
m@24
|
222
|
d@102
|
223 (defgeneric time+ (object1 object2)
|
d@136
|
224 (:documentation "Addition for time objects"))
|
d@102
|
225 (defgeneric time- (object1 object2)
|
d@136
|
226 (:documentation "Subtraction for time objects"))
|
m@24
|
227
|
d@102
|
228 (defgeneric time> (object1 object2)
|
d@136
|
229 (:documentation "> operator for moments"))
|
m@24
|
230 (defgeneric time< (object1 object2)
|
d@136
|
231 (:documentation "< operator for moments")
|
m@24
|
232 (:method (o1 o2) (time> o2 o1)))
|
d@102
|
233 (defgeneric time= (object1 object2)
|
d@136
|
234 (:documentation "= operator for moments"))
|
m@24
|
235 (defgeneric time>= (object1 object2)
|
d@136
|
236 (:documentation ">= operator for moments")
|
m@24
|
237 (:method (o1 o2) (or (time> o1 o2) (time= o1 o2))))
|
m@24
|
238 (defgeneric time<= (object1 object2)
|
d@136
|
239 (:documentation "<= operator for moments")
|
m@24
|
240 (:method (o1 o2) (or (time< o1 o2) (time= o1 o2))))
|
m@24
|
241 (defgeneric time/= (object1 object2)
|
d@136
|
242 (:documentation "not = operator for moments")
|
m@24
|
243 (:method (o1 o2) (not (time= o1 o2))))
|
m@24
|
244
|
m@24
|
245 ;;; Duration protocol
|
m@24
|
246
|
d@118
|
247 (defgeneric duration> (object1 object2)
|
d@136
|
248 (:documentation "> operator for periods"))
|
m@24
|
249 (defgeneric duration< (object1 object2)
|
d@136
|
250 (:documentation "< operator for periods")
|
m@24
|
251 (:method (o1 o2) (duration> o2 o1)))
|
d@118
|
252 (defgeneric duration= (object1 object2)
|
d@136
|
253 (:documentation "= operator for periods"))
|
m@24
|
254 (defgeneric duration>= (object1 object2)
|
d@136
|
255 (:documentation ">= operator for periods")
|
m@24
|
256 (:method (o1 o2) (or (duration> o1 o2) (duration= o1 o2))))
|
m@24
|
257 (defgeneric duration<= (object1 object2)
|
d@136
|
258 (:documentation "<= operator for periods")
|
m@24
|
259 (:method (o1 o2) (or (duration< o1 o2) (duration= o1 o2))))
|
m@24
|
260 (defgeneric duration/= (object1 object2)
|
d@136
|
261 (:documentation "not = operator for periods")
|
m@24
|
262 (:method (o1 o2) (not (duration= o1 o2))))
|
m@24
|
263
|
m@24
|
264 ;; for linear scaling:
|
d@118
|
265 (defgeneric duration* (object1 object2)
|
d@136
|
266 (:documentation "Multiplication operator for
|
d@136
|
267 periods. Intuitively, this makes sense, but it may cause us
|
d@118
|
268 trouble with some implementations in the future."))
|
d@118
|
269 (defgeneric duration/ (object1 number)
|
d@136
|
270 (:documentation "Division operator for periods. This may turn
|
d@136
|
271 out not to mean much. Division is probably useful, but we may
|
d@136
|
272 need to define what we mean with care."))
|
m@24
|
273
|
m@24
|
274 ;;; Pitch protocol
|
m@24
|
275
|
m@24
|
276 ;; pitch+: <pitch> <pitch> -> ERROR
|
m@24
|
277 ;; <pitch> <interval> -> <pitch>
|
m@24
|
278 ;; <interval> <pitch> -> <pitch> (same as previous?)
|
m@24
|
279 ;; <interval> <interval> -> <interval> (or a distinct interval+?)
|
m@24
|
280 ;;
|
m@24
|
281 ;; pitch-: <pitch> <pitch> -> <interval>
|
m@24
|
282 ;; <pitch> <interval> -> <pitch>
|
m@24
|
283 ;; <interval> <interval> -> <interval>
|
m@24
|
284 ;; <interval> <pitch> -> ERROR
|
m@24
|
285
|
m@24
|
286 (defgeneric pitch+ (object1 object2))
|
m@24
|
287 (defgeneric pitch- (object1 object2))
|
m@24
|
288
|
m@24
|
289 (defgeneric pitch> (object1 object2))
|
m@24
|
290 (defgeneric pitch< (object1 object2)
|
m@24
|
291 (:method (o1 o2) (pitch> o2 o1)))
|
m@24
|
292 (defgeneric pitch= (object1 object2))
|
m@24
|
293 (defgeneric pitch>= (object1 object2)
|
m@24
|
294 (:method (o1 o2) (or (pitch> o1 o2) (pitch= o1 o2))))
|
m@24
|
295 (defgeneric pitch<= (object1 object2)
|
m@24
|
296 (:method (o1 o2) (or (pitch< o1 o2) (pitch= o1 o2))))
|
m@24
|
297 (defgeneric pitch/= (object1 object2)
|
m@24
|
298 (:method (o1 o2) (not (pitch= o1 o2))))
|
m@24
|
299
|
m@24
|
300 ;;; Interval protocol (emphasise _pitch_ not _time_ interval?)
|
m@24
|
301
|
m@24
|
302 (defgeneric interval> (object1 object2))
|
m@24
|
303 (defgeneric interval< (object1 object2)
|
m@24
|
304 (:method (o1 o2) (interval> o2 o1)))
|
m@24
|
305 (defgeneric interval= (object1 object2))
|
m@24
|
306 (defgeneric interval>= (object1 object2)
|
m@24
|
307 (:method (o1 o2) (or (interval> o1 o2) (interval= o1 o2))))
|
m@24
|
308 (defgeneric interval<= (object1 object2)
|
m@24
|
309 (:method (o1 o2) (or (interval< o1 o2) (interval= o1 o2))))
|
m@24
|
310 (defgeneric interval/= (object1 object2)
|
m@24
|
311 (:method (o1 o2) (not (interval= o1 o2))))
|
m@24
|
312
|
m@24
|
313 ;;; Allen's (1984) interval relations
|
m@24
|
314 ;;; . equals already defined as INTERVAL= above
|
m@24
|
315 ;;; . inverses ommitted for now (just use CL:NOT)
|
m@24
|
316 ;;; . can all be defined in terms of MEETS (apparently)
|
m@24
|
317
|
m@24
|
318 (defgeneric meets (object1 object2))
|
m@24
|
319 (defgeneric before (object1 object2))
|
m@24
|
320 (defgeneric overlaps (object1 object2))
|
m@24
|
321 (defgeneric during (object1 object2))
|
m@24
|
322 (defgeneric starts (object1 object2))
|
m@24
|
323 (defgeneric ends (object1 object2))
|
m@24
|
324
|
m@24
|
325 ;;; and extensions thereof ...
|
m@24
|
326
|
m@24
|
327 (defgeneric subinterval (object1 object2)
|
m@24
|
328 (:method (o1 o2) (or (starts o1 o2) (during o1 o2) (ends o1 o2))))
|
m@24
|
329
|
m@24
|
330 (defgeneric disjoint (object1 object2)
|
m@24
|
331 (:method (o1 o2)
|
m@24
|
332 (or (before o1 o2) (meets o1 o2) (meets o2 o1) (before o2 o1))))
|
m@24
|
333
|
m@24
|
334 ;;; More time-based functions
|
d@33
|
335
|
d@33
|
336 (defgeneric period= (object1 object2)
|
d@33
|
337 (:method (x y) nil))
|
d@33
|
338
|
d@33
|
339 (defgeneric find-overlapping (anchored-period sequence)
|
d@33
|
340 ;; Returns all members of a sequence of period signifiers that overlap
|
d@33
|
341 ;; with the supplied period
|
d@33
|
342 (:method (ap s) (remove-if #'(lambda (x) (amuse:disjoint ap x)) s)))
|
d@33
|
343
|
m@24
|
344 ;; Return the anchored-period representing the intersection of two
|
d@136
|
345 ;; anchored-period.
|
d@136
|
346 (defgeneric period-intersection (anchored-period1
|
d@136
|
347 anchored-period2))
|
m@24
|
348
|
d@136
|
349 (defgeneric inter-onset-interval (moment1 moment2)
|
d@136
|
350 (:method (moment1 moment2) (time- (moment moment2) (moment moment1))))
|
m@24
|
351
|
m@24
|
352
|
m@24
|
353 ;;; Time Signature
|
m@24
|
354
|
d@33
|
355 (defgeneric get-applicable-time-signatures (anchored-period composition)
|
d@123
|
356 (:method (ap c) (find-overlapping ap (time-signatures c)))
|
d@136
|
357 (:documentation "Return a list of TIME-SIGNATURE-PERIODs that are
|
d@123
|
358 relevant to <anchored-period>. The period may contain
|
d@123
|
359 information such as staff position and voicing, and the method
|
d@123
|
360 may use this to filter its response"))
|
m@24
|
361
|
d@123
|
362 (defgeneric time-signature-equal (ts1 ts2)
|
d@123
|
363 (:documentation "Comparison operator. The definition of
|
d@123
|
364 equality is left open for implementers"))
|
m@67
|
365
|
m@24
|
366 ;;; Tempo
|
m@24
|
367
|
d@33
|
368 (defgeneric get-applicable-tempi (anchored-period composition)
|
d@123
|
369 (:method (ap c) (find-overlapping ap (tempi c)))
|
d@136
|
370 (:documentation "Return a list of TEMPO-PERIODs that are
|
d@136
|
371 relevant to <anchored-period>. The period may contain
|
d@136
|
372 information such as staff position and voicing, and the method
|
d@136
|
373 may use this to filter its response"))
|
m@24
|
374
|
d@123
|
375 (defgeneric tempo-equal (t1 t2)
|
d@123
|
376 (:documentation "Comparison operator. The definition of
|
d@123
|
377 equality is left open for implementers"))
|
m@67
|
378
|
m@24
|
379 ;;; Tonality (Key Signature / Mode)
|
m@24
|
380
|
d@123
|
381 (defgeneric get-applicable-key-signatures (object1 object2)
|
d@136
|
382 (:documentation "Return a list of KEY-SIGNATURE-PERIODs that are
|
d@123
|
383 relevant to <anchored-period>. The period may contain
|
d@123
|
384 information such as staff position and voicing, and the method
|
d@123
|
385 may use this to filter its response"))
|
m@24
|
386
|
d@123
|
387 (defgeneric key-signature-equal (ks1 ks2)
|
d@123
|
388 (:documentation "Comparison operator. The definition of
|
d@123
|
389 equality is left open to implementers"))
|
m@67
|
390
|
d@136
|
391 ;;; Some generic constructors - are these useful? (DL 31/8/07)
|
d@136
|
392 (defgeneric make-moment (value)
|
d@136
|
393 (:documentation "Returns MOMENT of subclass appropriate to the
|
d@136
|
394 class of value. Probably guessed."))
|
d@136
|
395 (defgeneric make-period (value)
|
d@136
|
396 (:documentation "Returns PERIOD of subclass appropriate to the
|
d@136
|
397 class of value. Probably guessed."))
|
d@136
|
398 (defgeneric make-anchored-period (start-value duration-value)
|
d@136
|
399 (:documentation "Returns ANCHORED-PERIOD of subclass
|
d@136
|
400 appropriate to the class of value. Probably guessed."))
|
d@136
|
401
|
d@160
|
402 (defgeneric trim-enclosing-silence (composition)
|
d@156
|
403 (:documentation "Returns a composition of the same type as
|
d@156
|
404 composition provided, with leading and following silences/rests
|
d@156
|
405 removed, but preserving all relevant information. Where
|
d@156
|
406 relevant, any silence in a bar containing musical material may
|
d@160
|
407 be preserved."))
|
d@136
|
408
|
m@24
|
409 ;;; Dynamics
|
m@24
|
410 ;;; Voice
|
m@81
|
411 ;;; Boundary Strength (phrasing)
|
d@175
|
412
|
d@175
|
413 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
d@175
|
414 ;;
|
d@175
|
415 ;; Experimental:
|
d@175
|
416 ;;
|
d@175
|
417
|
d@175
|
418 ;;; Proposed new metre functions
|
d@175
|
419 ;; These should provide sufficient functionality that the users need
|
d@175
|
420 ;; not refer to get-applicable-time-signatures unless they really mean
|
d@175
|
421 ;; it. In turn, this means that barline based representations have a
|
d@175
|
422 ;; better chance at guessing.
|
d@175
|
423
|
d@175
|
424 ;; Notes:
|
d@175
|
425 ;; * iteration is possible with
|
d@175
|
426 ;; (do ((beat (current-beat (make-moment 0) composition))
|
d@175
|
427 ;; (current-beat (cut-off beat) composition))) ...
|
d@175
|
428 ;; [That's probably not very efficient. there must be better ways]
|
d@175
|
429 ;; * gsharp and tabcode can answer bar questions, but not beat
|
d@175
|
430 ;; questions. Appropriate conditions and restarts will be needed.
|
d@175
|
431 ;; * a good test of this functionality will prob be amuse-harmony.
|
d@175
|
432
|
d@175
|
433 (defgeneric bar-period (time-signature implementation-object)
|
d@175
|
434 (:documentation "Returns a <period> with a duration equal to the
|
d@175
|
435 duration of a bar in the given time signature for the given
|
d@175
|
436 implementation. FIXME: this isn't guaranteed to be
|
d@175
|
437 meaningful (double time signatures break this"))
|
d@175
|
438 (defgeneric current-bar (moment composition)
|
d@175
|
439 (:documentation "Returns an <anchored-period> representing the
|
d@175
|
440 bar which contains moment"))
|
d@175
|
441
|
d@175
|
442 (defgeneric beat-period (moment time-signature implementation-object)
|
d@175
|
443 (:documentation "Takes a moment, time signature object and crotchet and returns
|
d@175
|
444 an <anchored-period> for the containing beat containing moment. This
|
d@175
|
445 is more useful when there's a complex time signature (not currently
|
d@175
|
446 possible) in which tactus is different in different parts of the
|
d@175
|
447 bar (e.g. 3+3+2/8)"))
|
d@175
|
448 (defgeneric current-beat (moment composition)
|
d@175
|
449 (:documentation "Returns an <anchored-period> representing the
|
d@175
|
450 tactus unit which contains moment"))
|
d@175
|
451
|
d@175
|
452
|
d@175
|
453 ;;;;;;;;;;;;;;
|
d@175
|
454 ;;
|
d@175
|
455 ;;
|
d@175
|
456
|
d@175
|
457 (defgeneric get-applicable-clefs (anchored-period constituent))
|