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