annotate base/generics.lisp @ 253:b5ffec94ae6d

some very sketchy Charm constituent code
author Jamie Forth <j.forth@gold.ac.uk>
date Thu, 24 Feb 2011 11:23:18 +0000
parents 6a3adca16910
children aac79c0ac1b9
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
m@24 192 (defgeneric microseconds-per-crotchet (tempo)
m@24 193 ;; As used (when rounded) in MIDI
d@123 194 (:method (tp) (/ 60000000 (bpm tp)))
d@123 195 (:documentation "Basic tempo query for MIDI. N.B. This will be
d@123 196 a fraction and must be rounded before being used for output."))
m@24 197
m@24 198 ;;; Coerce-type accessors
m@24 199
m@24 200 ;; Should I be including these default methods? Should the accessors
m@24 201 ;; be direct slot accessors or the generics I'm using? Should we
m@24 202 ;; return the object itself if it already is in the target class?
m@24 203
d@136 204 (defgeneric anchored-period (anchored-period)
d@123 205 (:method (apd) (make-anchored-period (onset apd) (duration apd)))
d@123 206 (:documentation "Coerce any anchored period to a plain anchored
d@123 207 period"))
m@24 208
d@136 209 (defgeneric period (period)
d@136 210 (:method (pd) (make-period (duration pd)))
d@123 211 (:documentation "Coerce any period to a floating period"))
m@24 212
d@136 213 (defgeneric moment (moment)
d@123 214 (:method (md) (make-moment (timepoint md)))
d@136 215 (:documentation "Coerce any moment, including an
d@123 216 anchored-period to a moment"))
m@24 217
d@136 218 (defgeneric onset (anchored-period)
d@139 219 (:method (ap) (moment ap))
d@123 220 (:documentation "Return a moment for the start of an anchored period"))
d@136 221 (defgeneric (setf onset) (value anchored-period))
m@24 222
m@24 223 ;;; Time Protocol (or moments?)
m@24 224
m@24 225 ;; negative times/durations -> ERROR?
m@24 226
m@24 227 ;; time+: <time> <duration> -> <time>
m@24 228 ;; <duration> <time> -> <time> (same as previous?)
m@24 229 ;; <duration> <duration> -> <duration> (or a distinct duration+?)
m@24 230 ;; <time> <time> -> ERROR?
m@24 231 ;;
m@24 232 ;; time-: <time> <time> -> <duration>
m@24 233 ;; <time> <duration> -> <time>
m@24 234 ;; <duration> <duration> -> <duration> (or a distinct duration-?)
m@24 235 ;; <duration> <time> -> ERROR?
m@24 236 ;; <anchored> <anchored> -> (time- (moment o1) (moment o2)) ? or error?
m@24 237
d@102 238 (defgeneric time+ (object1 object2)
d@136 239 (:documentation "Addition for time objects"))
d@102 240 (defgeneric time- (object1 object2)
d@136 241 (:documentation "Subtraction for time objects"))
m@24 242
d@102 243 (defgeneric time> (object1 object2)
d@136 244 (:documentation "> operator for moments"))
m@24 245 (defgeneric time< (object1 object2)
d@136 246 (:documentation "< operator for moments")
m@24 247 (:method (o1 o2) (time> o2 o1)))
d@102 248 (defgeneric time= (object1 object2)
d@136 249 (:documentation "= operator for moments"))
m@24 250 (defgeneric time>= (object1 object2)
d@136 251 (:documentation ">= operator for moments")
m@24 252 (:method (o1 o2) (or (time> o1 o2) (time= o1 o2))))
m@24 253 (defgeneric time<= (object1 object2)
d@136 254 (:documentation "<= operator for moments")
m@24 255 (:method (o1 o2) (or (time< o1 o2) (time= o1 o2))))
m@24 256 (defgeneric time/= (object1 object2)
d@136 257 (:documentation "not = operator for moments")
m@24 258 (:method (o1 o2) (not (time= o1 o2))))
m@24 259
m@24 260 ;;; Duration protocol
m@24 261
d@118 262 (defgeneric duration> (object1 object2)
d@136 263 (:documentation "> operator for periods"))
m@24 264 (defgeneric duration< (object1 object2)
d@136 265 (:documentation "< operator for periods")
m@24 266 (:method (o1 o2) (duration> o2 o1)))
d@118 267 (defgeneric duration= (object1 object2)
d@136 268 (:documentation "= operator for periods"))
m@24 269 (defgeneric duration>= (object1 object2)
d@136 270 (:documentation ">= operator for periods")
m@24 271 (:method (o1 o2) (or (duration> o1 o2) (duration= o1 o2))))
m@24 272 (defgeneric duration<= (object1 object2)
d@136 273 (:documentation "<= operator for periods")
m@24 274 (:method (o1 o2) (or (duration< o1 o2) (duration= o1 o2))))
m@24 275 (defgeneric duration/= (object1 object2)
d@136 276 (:documentation "not = operator for periods")
m@24 277 (:method (o1 o2) (not (duration= o1 o2))))
m@24 278
m@24 279 ;; for linear scaling:
d@118 280 (defgeneric duration* (object1 object2)
d@136 281 (:documentation "Multiplication operator for
d@136 282 periods. Intuitively, this makes sense, but it may cause us
d@118 283 trouble with some implementations in the future."))
d@118 284 (defgeneric duration/ (object1 number)
d@136 285 (:documentation "Division operator for periods. This may turn
d@136 286 out not to mean much. Division is probably useful, but we may
d@136 287 need to define what we mean with care."))
m@24 288
m@24 289 ;;; Pitch protocol
m@24 290
m@24 291 ;; pitch+: <pitch> <pitch> -> ERROR
m@24 292 ;; <pitch> <interval> -> <pitch>
m@24 293 ;; <interval> <pitch> -> <pitch> (same as previous?)
m@24 294 ;; <interval> <interval> -> <interval> (or a distinct interval+?)
m@24 295 ;;
m@24 296 ;; pitch-: <pitch> <pitch> -> <interval>
m@24 297 ;; <pitch> <interval> -> <pitch>
m@24 298 ;; <interval> <interval> -> <interval>
m@24 299 ;; <interval> <pitch> -> ERROR
m@24 300
m@24 301 (defgeneric pitch+ (object1 object2))
m@24 302 (defgeneric pitch- (object1 object2))
m@24 303
m@24 304 (defgeneric pitch> (object1 object2))
m@24 305 (defgeneric pitch< (object1 object2)
m@24 306 (:method (o1 o2) (pitch> o2 o1)))
m@24 307 (defgeneric pitch= (object1 object2))
m@24 308 (defgeneric pitch>= (object1 object2)
m@24 309 (:method (o1 o2) (or (pitch> o1 o2) (pitch= o1 o2))))
m@24 310 (defgeneric pitch<= (object1 object2)
m@24 311 (:method (o1 o2) (or (pitch< o1 o2) (pitch= o1 o2))))
m@24 312 (defgeneric pitch/= (object1 object2)
m@24 313 (:method (o1 o2) (not (pitch= o1 o2))))
m@24 314
m@24 315 ;;; Interval protocol (emphasise _pitch_ not _time_ interval?)
m@24 316
m@24 317 (defgeneric interval> (object1 object2))
m@24 318 (defgeneric interval< (object1 object2)
m@24 319 (:method (o1 o2) (interval> o2 o1)))
m@24 320 (defgeneric interval= (object1 object2))
m@24 321 (defgeneric interval>= (object1 object2)
m@24 322 (:method (o1 o2) (or (interval> o1 o2) (interval= o1 o2))))
m@24 323 (defgeneric interval<= (object1 object2)
m@24 324 (:method (o1 o2) (or (interval< o1 o2) (interval= o1 o2))))
m@24 325 (defgeneric interval/= (object1 object2)
m@24 326 (:method (o1 o2) (not (interval= o1 o2))))
m@24 327
m@24 328 ;;; Allen's (1984) interval relations
m@24 329 ;;; . equals already defined as INTERVAL= above
m@24 330 ;;; . inverses ommitted for now (just use CL:NOT)
m@24 331 ;;; . can all be defined in terms of MEETS (apparently)
m@24 332
m@24 333 (defgeneric meets (object1 object2))
m@24 334 (defgeneric before (object1 object2))
m@24 335 (defgeneric overlaps (object1 object2))
m@24 336 (defgeneric during (object1 object2))
m@24 337 (defgeneric starts (object1 object2))
m@24 338 (defgeneric ends (object1 object2))
m@24 339
m@24 340 ;;; and extensions thereof ...
m@24 341
m@24 342 (defgeneric subinterval (object1 object2)
m@24 343 (:method (o1 o2) (or (starts o1 o2) (during o1 o2) (ends o1 o2))))
m@24 344
m@24 345 (defgeneric disjoint (object1 object2)
m@24 346 (:method (o1 o2)
m@24 347 (or (before o1 o2) (meets o1 o2) (meets o2 o1) (before o2 o1))))
m@24 348
m@24 349 ;;; More time-based functions
d@33 350
d@33 351 (defgeneric period= (object1 object2)
d@33 352 (:method (x y) nil))
d@33 353
d@33 354 (defgeneric find-overlapping (anchored-period sequence)
d@33 355 ;; Returns all members of a sequence of period signifiers that overlap
d@33 356 ;; with the supplied period
d@33 357 (:method (ap s) (remove-if #'(lambda (x) (amuse:disjoint ap x)) s)))
d@33 358
m@24 359 ;; Return the anchored-period representing the intersection of two
d@136 360 ;; anchored-period.
d@136 361 (defgeneric period-intersection (anchored-period1
d@136 362 anchored-period2))
m@24 363
d@136 364 (defgeneric inter-onset-interval (moment1 moment2)
d@136 365 (:method (moment1 moment2) (time- (moment moment2) (moment moment1))))
m@24 366
m@24 367
m@24 368 ;;; Time Signature
m@24 369
d@33 370 (defgeneric get-applicable-time-signatures (anchored-period composition)
d@123 371 (:method (ap c) (find-overlapping ap (time-signatures c)))
d@136 372 (:documentation "Return a list of TIME-SIGNATURE-PERIODs that are
d@123 373 relevant to <anchored-period>. The period may contain
d@123 374 information such as staff position and voicing, and the method
d@123 375 may use this to filter its response"))
m@24 376
d@123 377 (defgeneric time-signature-equal (ts1 ts2)
d@123 378 (:documentation "Comparison operator. The definition of
d@123 379 equality is left open for implementers"))
m@67 380
m@24 381 ;;; Tempo
m@24 382
d@33 383 (defgeneric get-applicable-tempi (anchored-period composition)
d@123 384 (:method (ap c) (find-overlapping ap (tempi c)))
d@136 385 (:documentation "Return a list of TEMPO-PERIODs that are
d@136 386 relevant to <anchored-period>. The period may contain
d@136 387 information such as staff position and voicing, and the method
d@136 388 may use this to filter its response"))
m@24 389
d@123 390 (defgeneric tempo-equal (t1 t2)
d@123 391 (:documentation "Comparison operator. The definition of
d@123 392 equality is left open for implementers"))
m@67 393
m@24 394 ;;; Tonality (Key Signature / Mode)
m@24 395
d@123 396 (defgeneric get-applicable-key-signatures (object1 object2)
d@136 397 (:documentation "Return a list of KEY-SIGNATURE-PERIODs that are
d@123 398 relevant to <anchored-period>. The period may contain
d@123 399 information such as staff position and voicing, and the method
d@123 400 may use this to filter its response"))
m@24 401
d@123 402 (defgeneric key-signature-equal (ks1 ks2)
d@123 403 (:documentation "Comparison operator. The definition of
d@123 404 equality is left open to implementers"))
m@67 405
d@136 406 ;;; Some generic constructors - are these useful? (DL 31/8/07)
d@136 407 (defgeneric make-moment (value)
d@136 408 (:documentation "Returns MOMENT of subclass appropriate to the
d@136 409 class of value. Probably guessed."))
d@136 410 (defgeneric make-period (value)
d@136 411 (:documentation "Returns PERIOD of subclass appropriate to the
d@136 412 class of value. Probably guessed."))
d@136 413 (defgeneric make-anchored-period (start-value duration-value)
d@136 414 (:documentation "Returns ANCHORED-PERIOD of subclass
d@136 415 appropriate to the class of value. Probably guessed."))
d@136 416
d@160 417 (defgeneric trim-enclosing-silence (composition)
d@156 418 (:documentation "Returns a composition of the same type as
d@156 419 composition provided, with leading and following silences/rests
d@156 420 removed, but preserving all relevant information. Where
d@156 421 relevant, any silence in a bar containing musical material may
d@160 422 be preserved."))
d@136 423
m@24 424 ;;; Dynamics
m@24 425 ;;; Voice
m@81 426 ;;; Boundary Strength (phrasing)
d@175 427
d@175 428 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
d@175 429 ;;
d@175 430 ;; Experimental:
d@175 431 ;;
d@175 432
d@175 433 ;;; Proposed new metre functions
d@175 434 ;; These should provide sufficient functionality that the users need
d@175 435 ;; not refer to get-applicable-time-signatures unless they really mean
d@175 436 ;; it. In turn, this means that barline based representations have a
d@175 437 ;; better chance at guessing.
d@175 438
d@175 439 ;; Notes:
d@175 440 ;; * iteration is possible with
d@175 441 ;; (do ((beat (current-beat (make-moment 0) composition))
d@175 442 ;; (current-beat (cut-off beat) composition))) ...
d@175 443 ;; [That's probably not very efficient. there must be better ways]
d@175 444 ;; * gsharp and tabcode can answer bar questions, but not beat
d@175 445 ;; questions. Appropriate conditions and restarts will be needed.
d@175 446 ;; * a good test of this functionality will prob be amuse-harmony.
d@175 447
d@175 448 (defgeneric bar-period (time-signature implementation-object)
d@175 449 (:documentation "Returns a <period> with a duration equal to the
d@175 450 duration of a bar in the given time signature for the given
d@175 451 implementation. FIXME: this isn't guaranteed to be
d@175 452 meaningful (double time signatures break this"))
d@175 453 (defgeneric current-bar (moment composition)
d@175 454 (:documentation "Returns an <anchored-period> representing the
d@175 455 bar which contains moment"))
d@175 456
d@175 457 (defgeneric beat-period (moment time-signature implementation-object)
j@233 458 (:documentation "Takes a moment, time signature object and crotchet
j@233 459 and returns an <anchored-period> for the containing beat containing
j@233 460 moment. This is more useful when there's a complex time
j@233 461 signature (not currently possible) in which tactus is different in
j@233 462 different parts of the bar (e.g. 3+3+2/8)"))
d@175 463 (defgeneric current-beat (moment composition)
d@175 464 (:documentation "Returns an <anchored-period> representing the
d@175 465 tactus unit which contains moment"))
d@175 466
j@233 467 (defgeneric ioi-from-bar (moment)
j@233 468 (:documentation "Returns the IOI of moment (i.e. an event) from the
j@233 469 bar line."))
j@233 470
j@233 471 (defgeneric onset-in-bar (moment)
j@250 472 (:documentation "The position of moment in the bar, measured in the
j@250 473 timebase of the composition (e.g. crochets regardless of the
j@250 474 prevailing time-signature."))
j@250 475
j@250 476 (defgeneric onset-in-bar-relative-to-tactus (moment)
j@250 477 (:documentation "The position of moment in the bar, measure in
j@250 478 tactus beats."))
d@175 479
d@175 480 ;;;;;;;;;;;;;;
d@175 481 ;;
d@175 482 ;;
d@175 483
d@175 484 (defgeneric get-applicable-clefs (anchored-period constituent))
j@208 485
j@245 486 ;;;=====================================================================
j@230 487 ;;; Copying events in time
j@245 488 ;;;=====================================================================
j@208 489
j@230 490 (defgeneric move-to-first-bar (composition))
j@208 491
j@210 492 (defgeneric copy-event (event))
j@210 493
j@210 494 (defgeneric voice (event))
j@230 495
j@230 496
j@245 497 ;;;=====================================================================
j@230 498 ;;; Searching for events
j@245 499 ;;;=====================================================================
j@230 500
j@230 501 (defgeneric find-next-event (source-event &key predicate test
j@230 502 break-test search-list))
j@230 503
j@245 504 ;;;=====================================================================
j@230 505 ;;; Sorting Compositions
j@245 506 ;;;=====================================================================
j@230 507
j@230 508 (defgeneric event< (event1 event2 attribute-list))
j@230 509
j@230 510 (defgeneric sort-composition (composition attribute-list))