annotate base/generics.lisp @ 260:f5836b2bf334

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