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