Mercurial > hg > amuse
changeset 136:fd85f52d9f9d
Class revolution
* PITCH-DESIGNATOR -> PITCH (PITCH removed)
* MOMENT-DESIGNATOR -> MOMENT , MOMENT -> STANDARD-MOMENT
* PERIOD-DESIGNATOR -> PERIOD , PERIOD -> STANDARD-PERIOD
* ANCHORED-PERIOD-DESIGNATOR -> ANCHORED-PERIOD , ANCHORED-PERIOD -> STANDARD-ANCHORED-PERIOD
* FLOATING-PERIOD removed
* TIME-SIGNATURE-DESIGNATOR -> TIME-SIGNATURE & TIME-SIGNATURE-PERIOD
* TIME-SIGNATURE -> STANDARD-TIME-SIGNATURE & STANDARD-TIME-SIGNATURE-PERIOD
* KEY-SIGNATURE-DESIGNATOR -> KEY-SIGNATURE (& ...-PERIOD)
* KEY-SIGNATURE -> STANDARD-KEY-SIGNATURE (& ...-PERIOD)
* TEMPO now abstract (& TEMPO-PERIOD)
* STANDARD-TEMPO AND STANDARD-TEMPO-PERIOD
* COMPOSITION, CONSTITUENT & TIME-ORDERED-CONSTITUENT all have STANDARD- forms
make-x methods and specialisers changes appropriately
darcs-hash:20070831142943-f76cc-7be0d08963de06d87b36e4922076287d565c7ee2.gz
author | David Lewis <d.lewis@gold.ac.uk> |
---|---|
date | Fri, 31 Aug 2007 15:29:43 +0100 |
parents | 188fe5ea837f |
children | ee9dd7148eab |
files | amuse-midi.asd base/classes.lisp base/constructors.lisp base/generics.lisp base/methods.lisp base/package.lisp implementations/geerdes/constructors.lisp implementations/geerdes/methods.lisp implementations/gsharp/classes.lisp implementations/midi/classes.lisp implementations/midi/midifile-import.lisp implementations/mtp/classes.lisp implementations/mtp/methods.lisp implementations/tabcode/classes.lisp tools/midi-output.lisp tools/segmentation/methods.lisp tools/segmentation/simple-example.lisp utils/utils.lisp |
diffstat | 18 files changed, 398 insertions(+), 282 deletions(-) [+] |
line wrap: on
line diff
--- a/amuse-midi.asd Tue Aug 28 11:17:27 2007 +0100 +++ b/amuse-midi.asd Fri Aug 31 15:29:43 2007 +0100 @@ -2,14 +2,13 @@ :name "amuse-midi" :description "" :depends-on ("amuse" "midi") - :serial t :components ((:module implementations :components ((:module midi :components ((:file "package") - (:file "classes") + (:file "classes" :depends-on ("package")) (:file "constructors" :depends-on ("package" "classes")) (:file "midifile-import" :depends-on ("package" "classes")) (:file "methods" :depends-on ("package" "classes"))))))))
--- a/base/classes.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/base/classes.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -7,40 +7,37 @@ ;; types of information-specifiers (defclass identifier (amuse-object) ()) ;; for composition specification -(defclass moment-designator (amuse-object) () +(defclass moment (amuse-object) () (:documentation "Object indicating a point in time")) -(defclass period-designator (amuse-object) () +(defclass period (amuse-object) () (:documentation "Object indicating a region of time")) -(defclass anchored-period-designator (moment-designator period-designator) () +(defclass anchored-period (moment period) () (:documentation "Object indicating a region of time starting at a specific point in time")) -(defclass pitch-designator (amuse-object) () +(defclass pitch (amuse-object) () (:documentation "Object indicating some sort of pitch")) -(defclass pitch-interval-designator (amuse-object) () +(defclass pitch-interval (amuse-object) () (:documentation "Object indicating a distance in pitch space")) ;; time-related classes -(defclass moment (moment-designator) +(defclass standard-moment (moment) ((time :accessor %moment-time :initarg :time)) - (:documentation "A moment-designator that has moments in time - represented on a number line")) + (:documentation "A moment that has time represented on a + continuous, progressive number line")) -(defclass period (period-designator) +(defclass standard-period (period) ((interval :accessor %period-interval :initarg :interval)) - (:documentation "A period-designator that places time intervals - on a number-line")) + (:documentation "A period that places time intervals + on a progressive number-line")) -(defclass floating-period (period) () - (:documentation "A simple numeric period")) -(defclass anchored-period (period moment anchored-period-designator) () +(defclass standard-anchored-period (standard-period standard-moment anchored-period) () (:documentation "Number-line-based anchored period")) ;; pitch-related classes -(defclass frequency () ()) +(defclass frequency-pitch (pitch) ()) -(defclass pitch (pitch-designator) ()) (defclass chromatic-pitch (pitch) ((number :accessor %chromatic-pitch-number :initarg :number)) (:documentation "A pitch represented as a number, with @@ -53,25 +50,39 @@ an integer representing the morphetic pitch (An0 = 0, middle C = 23).")) -(defclass chromatic-pitch-interval (pitch-interval-designator) +(defclass chromatic-pitch-interval (pitch-interval) ((span :accessor %chromatic-pitch-interval-span :initarg :span))) -(defclass diatonic-pitch-interval (pitch-interval-designator) +(defclass diatonic-pitch-interval (pitch-interval) ((span :accessor %diatonic-pitch-interval-span :initarg :span :reader span))) ;; events (defclass event (anchored-period) () (:documentation "Notelike object")) -(defclass pitched-event (event pitch-designator) () +(defclass pitched-event (event pitch) () + (:documentation "Event with pitch information")) +(defclass standard-pitched-event (pitched-event + standard-anchored-period) () (:documentation "Event with pitch information")) (defclass chromatic-pitched-event (pitched-event chromatic-pitch) () (:documentation "Event with chromatic pitch information")) +(defclass standard-chromatic-pitched-event (chromatic-pitched-event + standard-anchored-period) () + (:documentation "Event with chromatic pitch information and + standard-period")) (defclass percussive-event (event) () (:documentation "Unpitched percussion Event. There's an issue with this name - is there a reason why this is unpitched necessarily, or why I'm not counting piano, etc in this? Perhaps -what I mean is that it should be renamed unpitched-event?")) +what I mean is that it should be renamed unpitched-event? +Actually, is this necessary? Isn't this just an event?")) +(defclass standard-percussive-event (event standard-anchored-period) () + (:documentation "Unpitched percussion Event. There's an issue +with this name - is there a reason why this is unpitched +necessarily, or why I'm not counting piano, etc in this? Perhaps +what I mean is that it should be renamed unpitched-event? +Actually, is this necessary? Isn't this just an event?")) ;;; Range-based `constituents' ;; Whilst these are all constituents in the CHARM sense, their @@ -79,10 +90,13 @@ ;; events. As such, they can be regarded as anchored-periods with ;; properties. -(defclass time-signature (anchored-period) () - (:documentation "Base class for time signature")) +(defclass time-signature (amuse-object) () + (:documentation "Abstract class for time signature")) -(defclass basic-time-signature (time-signature) +(defclass time-signature-period (time-signature anchored-period) () + (:documentation "Abstract class for time signatures in time")) + +(defclass standard-time-signature (time-signature) ((numerator :accessor %basic-time-signature-numerator :initarg :numerator) (denominator :accessor %basic-time-signature-denominator @@ -90,35 +104,74 @@ (:documentation "Class with slots for numerator and denominator. Can only deal with numeric signatures.")) -(defclass key-signature (anchored-period) () +(defclass standard-time-signature-period (standard-time-signature + time-signature-period + standard-anchored-period) + () + (:documentation "STANDARD-TIME-SIGNATURE on a time number line")) + +(defclass key-signature (amuse-object) () (:documentation "Base class for key signature")) -(defclass basic-key-signature (key-signature) +(defclass key-signature-period (key-signature anchored-period) () + (:documentation "Abstract class for time signatures in time")) + +(defclass standard-key-signature (key-signature) ((sharp-count :accessor %basic-key-signature-sharp-count :initarg :sharp-count)) (:documentation "Simple class - Only has line-of-fifths distance from c, so custom signatures won't work")) -(defclass midi-key-signature (basic-key-signature) +(defclass standard-key-signature-period (standard-key-signature + key-signature-period + standard-anchored-period) + () + (:documentation "STANDARD-KEY-SIGNATURE on a time number line")) + +(defclass midi-key-signature (standard-key-signature) ((mode :accessor %midi-key-signature-mode :initarg :mode)) (:documentation "MIDI-based flavour of basic key signature, adding a slot for mode: 0 = major key; 1 = minor key")) -(defclass tempo (anchored-period) +(defclass midi-key-signature-period (standard-key-signature-period + midi-key-signature) + () + (:documentation "MIDI-KEY-SIGNATURE on a time number line")) + +(defclass tempo (amuse-object) () + (:documentation "Abstract class for tempo")) +(defclass tempo-period (tempo anchored-period) () + (:documentation "Abstract class for tempo associated with a + time period")) +(defclass standard-tempo (tempo) ((bpm :accessor %tempo-bpm :initarg :bpm)) (:documentation "Rather literal reading of absolute tempo. accel and rit in symbolic encoding will need other structures, as will textual tempo markings.")) +(defclass standard-tempo-period (standard-tempo + tempo-period + standard-anchored-period) + () + (:documentation "Tempo associated with a standard-anchored-period")) ;; collections of more than one event (defclass constituent (anchored-period) ()) +(defclass standard-constituent (constituent standard-anchored-period) ()) (defclass time-ordered-constituent (constituent list-slot-sequence) ;; this won't work if lisp implementation doesn't support extensible ;; sequences. ()) +(defclass standard-time-ordered-constituent (time-ordered-constituent + standard-constituent + list-slot-sequence) + ;; this won't work if lisp implementation doesn't support extensible + ;; sequences. + ()) (defclass composition (time-ordered-constituent) ()) +(defclass standard-composition (composition + standard-time-ordered-constituent) ()) (defclass monody (composition) ())
--- a/base/constructors.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/base/constructors.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -2,25 +2,25 @@ ;; Time classes -(defun make-moment (time) - "Returns a new moment, taking a number as input for the time -point." +(defun make-standard-moment (time) + "Returns a new standard-moment, taking a number as input for +the time point." (make-instance 'moment :time time)) ;; N.B. period should never be constructed directly - it's either ;; floating or anchored or some other subclass. -(defun make-floating-period (interval) - "Returns a new floating-period, taking a number for the +(defun make-standard-period (interval) + "Returns a new (floating) period, taking a number for the duration." - (make-instance 'floating-period :interval interval)) + (make-instance 'standard-period :interval interval)) ;; Should this take a moment and/or a period too? -(defun make-anchored-period (onset interval) +(defun make-standard-anchored-period (onset interval) "Returns a new floating-period, taking numbers for onset and duration." - (make-instance 'anchored-period + (make-instance 'standard-anchored-period :time onset :interval interval)) @@ -66,28 +66,48 @@ :time onset :interval duration)) -(defun make-basic-time-signature (numerator denominator onset duration) - (make-instance 'basic-time-signature +(defun make-standard-time-signature (numerator denominator) + (make-instance 'standard-time-signature + :numerator numerator + :denominator denominator)) + +(defun make-standard-time-signature-period (numerator denominator onset duration) + (make-instance 'standard-time-signature-period :numerator numerator :denominator denominator :time onset :interval duration)) -(defun make-basic-key-signature (sharp-count onset duration) - (make-instance 'basic-key-signature +(defun make-standard-key-signature (sharp-count) + (make-instance 'standard-key-signature + :sharp-count sharp-count)) + +(defun make-standard-key-signature-period (sharp-count onset duration) + (make-instance 'standard-key-signature-period :sharp-count sharp-count :time onset :interval duration)) -(defun make-midi-key-signature (sharp-count mode onset duration) +(defun make-midi-key-signature (sharp-count mode) (make-instance 'midi-key-signature :sharp-count sharp-count + :mode mode)) + +(defun make-midi-key-signature-period (sharp-count mode onset duration) + (make-instance 'midi-key-signature-period + :sharp-count sharp-count :mode mode :time onset :interval duration)) -(defun make-tempo (bpm onset duration) - (make-instance 'tempo +(defun make-standard-tempo (bpm) + (make-instance 'standard-tempo :bpm bpm :time onset :interval duration)) + +(defun make-standard-tempo-period (bpm onset duration) + (make-instance 'standard-tempo-period + :bpm bpm + :time onset + :interval duration))
--- a/base/generics.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/base/generics.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -41,82 +41,83 @@ (defgeneric pitch (object &key kind)) ; ? Maybe this returns the pitch ; in its ur form? -(defgeneric chromatic-pitch (pitch-designator)) -(defgeneric diatonic-pitch (pitch-designator)) +(defgeneric chromatic-pitch (pitch)) +(defgeneric diatonic-pitch (pitch)) (defgeneric frequency (object)) ;? -(defgeneric octave (pitch-designator) +(defgeneric octave (pitch) (:documentation "Return an integer representing the octave of -pitch-designator where middle c is defined to be the lowest pitch in +pitch where middle c is defined to be the lowest pitch in octave 4.")) -(defgeneric diatonic-pitch-octave (pitch-designator) +(defgeneric diatonic-pitch-octave (pitch) (:documentation "Return an integer representing the diatonic octave -of PITCH-DESIGNATOR.")) +of pitch.")) -(defgeneric diatonic-pitch-accidental (pitch-designator) +(defgeneric diatonic-pitch-accidental (pitch) (:documentation "Return an integer representing the inflection of a diatonic pitch where where negative values indicate numbers of flats, 0 indicates natural and positive values indicate numbers of sharps.")) -(defgeneric diatonic-pitch-mp (pitch-designator) +(defgeneric diatonic-pitch-mp (pitch) (:documentation "Return an integer representing the morphetic pitch \(in MIPS terms) of a diatonic pitch.")) -(defgeneric diatonic-pitch-cp (pitch-designator) +(defgeneric diatonic-pitch-cp (pitch) (:documentation "Return an integer representing the chromatic pitch \(in MIPS terms) of a diatonic pitch.")) -(defgeneric middle-c (pitch-designator) +(defgeneric middle-c (pitch) (:documentation "Returns the value of middle C in the particular -representation of pitch used by PITCH-DESIGNATOR.")) -(defgeneric midi-pitch-number (pitch-designator) - (:documentation "Takes a pitch-designator (usually a pitched - event) and returns an integer between 0 and 127 representing - the chromatic pitch designated (60=middle C, 48 the C below - that, etc.)")) -(defgeneric asa-pitch-string (pitch-designator) +representation of pitch used by PITCH.")) +(defgeneric midi-pitch-number (pitch) + (:documentation "Takes a pitch (usually a pitched event) and + returns an integer between 0 and 127 representing the chromatic + pitch represented (60=middle C, 48 the C below that, etc.)")) +(defgeneric asa-pitch-string (pitch) (:documentation "Returns a string representing the designated ASA pitch name which has three parts: a letter name in the set {A,B,C,D,E,F,G}, an inflection in the set {n,f,s,ff,ss,fff,sss,...} and an octave number. E.g., Cn4 = Middle C.")) -(defgeneric asa-interval-string (pitch-designator) +(defgeneric asa-interval-string (pitch) (:documentation "Returns a string representing the designated ASA interval name which has two or three parts: a direction in the set {r,f} (absent for unisons/primes), a type in the set {p,ma,mi,a,d,aa,dd,aaa,ddd,...}, and a size number. E.g. rma2 = rising major second.")) -(defgeneric diatonic-pitch-name (pitch-designator) +(defgeneric diatonic-pitch-name (pitch) (:documentation "Returns a char in the set {#\A,#\B,#\C,#\D,#\E,#\F,#\G}, representing the pitch name of -PITCH-DESIGNATOR.")) -(defgeneric pitch-class (pitch-designator) - (:documentation "Takes a pitch-designator (usually a pitched - event) and returns an integer between 0 and 12 representing - the octave-independant pitch, with c=0, c#=1, etc.") +PITCH.")) +(defgeneric pitch-class (pitch) + (:documentation "Takes a pitch (usually a pitched event) and + returns an integer between 0 and 12 representing the + octave-independant pitch, with c=0, c#=1, etc.") (:method (p) (mod (midi-pitch-number p) 12))) -(defgeneric span (pitch-interval-designator)) +(defgeneric span (pitch-interval)) ;; time -(defgeneric duration (period-designator) - (:documentation "Returns a value. Probably should only apply do - periods (rather than designators?)")) -(defgeneric (setf duration) (value period-designator) - (:documentation "As with duration, should probably work only - with periods")) -(defgeneric timepoint (moment-designator) - (:documentation "Returns a value for a moment. Does this make - any sense on a designator?")) -(defgeneric (setf timepoint) (value moment-designator) - (:documentation "Sets timepoint. What does this mean for a - designator?")) -(defgeneric cut-off (anchored-period-designator) ; name? +(defgeneric duration (period) + (:documentation "Returns a real. Probably should only apply do + standard-periods (rather than periods? or should it return + something other than a value in other cases)")) +(defgeneric (setf duration) (value period) + (:documentation "As with duration, perhaps this should work only + with standard-periods")) +(defgeneric timepoint (moment) + (:documentation "Returns a number for a moment. Does this make + any sense on an abstrace class? Should it just apply to + standard-moment?")) +(defgeneric (setf timepoint) (value moment) + (:documentation "Sets timepoint. What does this mean for an + abstract class? Should it just apply to standard-moment")) +(defgeneric cut-off (anchored-period) ; name? (:documentation "Returns a <moment> representing the point at which the anchored period has ended. By default, is calculated as the result of running time+ on the onset and period of the object.") - (:method (apd) (time+ (moment apd) (floating-period apd)))) -(defgeneric crotchet (object) + (:method (apd) (time+ (moment apd) (period apd)))) +(defgeneric crotchet (object) (:documentation "Returns a period, the duration of which represents a crotchet in the time representation used by object.")) @@ -180,24 +181,24 @@ ;; be direct slot accessors or the generics I'm using? Should we ;; return the object itself if it already is in the target class? -(defgeneric anchored-period (anchored-period-designator) +(defgeneric anchored-period (anchored-period) (:method (apd) (make-anchored-period (onset apd) (duration apd))) (:documentation "Coerce any anchored period to a plain anchored period")) -(defgeneric floating-period (period-designator) - (:method (pd) (make-floating-period (duration pd))) +(defgeneric period (period) + (:method (pd) (make-period (duration pd))) (:documentation "Coerce any period to a floating period")) -(defgeneric moment (moment-designator) +(defgeneric moment (moment) (:method (md) (make-moment (timepoint md))) - (:documentation "Coerce any moment(-designator?), including an + (:documentation "Coerce any moment, including an anchored-period to a moment")) -(defgeneric onset (anchored-period-designator) +(defgeneric onset (anchored-period) (:method (apd) (moment apd)) (:documentation "Return a moment for the start of an anchored period")) -(defgeneric (setf onset) (value anchored-period-designator)) +(defgeneric (setf onset) (value anchored-period)) ;;; Time Protocol (or moments?) @@ -215,55 +216,55 @@ ;; <anchored> <anchored> -> (time- (moment o1) (moment o2)) ? or error? (defgeneric time+ (object1 object2) - (:documentation "Addition for time designators")) + (:documentation "Addition for time objects")) (defgeneric time- (object1 object2) - (:documentation "Subtraction for time designators")) + (:documentation "Subtraction for time objects")) (defgeneric time> (object1 object2) - (:documentation "> operator for moment designators")) + (:documentation "> operator for moments")) (defgeneric time< (object1 object2) - (:documentation "< operator for moment designators") + (:documentation "< operator for moments") (:method (o1 o2) (time> o2 o1))) (defgeneric time= (object1 object2) - (:documentation "= operator for moment designators")) + (:documentation "= operator for moments")) (defgeneric time>= (object1 object2) - (:documentation ">= operator for moment designators") + (:documentation ">= operator for moments") (:method (o1 o2) (or (time> o1 o2) (time= o1 o2)))) (defgeneric time<= (object1 object2) - (:documentation "<= operator for moment designators") + (:documentation "<= operator for moments") (:method (o1 o2) (or (time< o1 o2) (time= o1 o2)))) (defgeneric time/= (object1 object2) - (:documentation "not = operator for moment designators") + (:documentation "not = operator for moments") (:method (o1 o2) (not (time= o1 o2)))) ;;; Duration protocol (defgeneric duration> (object1 object2) - (:documentation "> operator for period designators")) + (:documentation "> operator for periods")) (defgeneric duration< (object1 object2) - (:documentation "< operator for period designators") + (:documentation "< operator for periods") (:method (o1 o2) (duration> o2 o1))) (defgeneric duration= (object1 object2) - (:documentation "= operator for period designators")) + (:documentation "= operator for periods")) (defgeneric duration>= (object1 object2) - (:documentation ">= operator for period designators") + (:documentation ">= operator for periods") (:method (o1 o2) (or (duration> o1 o2) (duration= o1 o2)))) (defgeneric duration<= (object1 object2) - (:documentation "<= operator for period designators") + (:documentation "<= operator for periods") (:method (o1 o2) (or (duration< o1 o2) (duration= o1 o2)))) (defgeneric duration/= (object1 object2) - (:documentation "not = operator for period designators") + (:documentation "not = operator for periods") (:method (o1 o2) (not (duration= o1 o2)))) ;; for linear scaling: (defgeneric duration* (object1 object2) - (:documentation "Multiplication operator for period - designators. Intuitively, this makes sense, but it may cause us + (:documentation "Multiplication operator for + periods. Intuitively, this makes sense, but it may cause us trouble with some implementations in the future.")) (defgeneric duration/ (object1 number) - (:documentation "Division operator for period designators. This - may turn out not to mean much. Division is probably useful, but - we may need to define what we mean with care.")) + (:documentation "Division operator for periods. This may turn + out not to mean much. Division is probably useful, but we may + need to define what we mean with care.")) ;;; Pitch protocol @@ -336,19 +337,19 @@ (:method (ap s) (remove-if #'(lambda (x) (amuse:disjoint ap x)) s))) ;; Return the anchored-period representing the intersection of two -;; anchored-period-specifiers. -(defgeneric period-intersection (anchored-period-specifier1 - anchored-period-specifier2)) +;; anchored-period. +(defgeneric period-intersection (anchored-period1 + anchored-period2)) -(defgeneric inter-onset-interval (moment-designator1 moment-designator2) - (:method (md1 md2) (time- (moment md2) (moment md1)))) +(defgeneric inter-onset-interval (moment1 moment2) + (:method (moment1 moment2) (time- (moment moment2) (moment moment1)))) ;;; Time Signature (defgeneric get-applicable-time-signatures (anchored-period composition) (:method (ap c) (find-overlapping ap (time-signatures c))) - (:documentation "Return a list of time-signatures that are + (:documentation "Return a list of TIME-SIGNATURE-PERIODs that are relevant to <anchored-period>. The period may contain information such as staff position and voicing, and the method may use this to filter its response")) @@ -361,10 +362,10 @@ (defgeneric get-applicable-tempi (anchored-period composition) (:method (ap c) (find-overlapping ap (tempi c))) - (:documentation "Return a list of tempi that are relevant to - <anchored-period>. The period may contain information such as - staff position and voicing, and the method may use this to - filter its response")) + (:documentation "Return a list of TEMPO-PERIODs that are + relevant to <anchored-period>. The period may contain + information such as staff position and voicing, and the method + may use this to filter its response")) (defgeneric tempo-equal (t1 t2) (:documentation "Comparison operator. The definition of @@ -373,7 +374,7 @@ ;;; Tonality (Key Signature / Mode) (defgeneric get-applicable-key-signatures (object1 object2) - (:documentation "Return a list of key-signatures that are + (:documentation "Return a list of KEY-SIGNATURE-PERIODs that are relevant to <anchored-period>. The period may contain information such as staff position and voicing, and the method may use this to filter its response")) @@ -382,6 +383,18 @@ (:documentation "Comparison operator. The definition of equality is left open to implementers")) +;;; Some generic constructors - are these useful? (DL 31/8/07) +(defgeneric make-moment (value) + (:documentation "Returns MOMENT of subclass appropriate to the + class of value. Probably guessed.")) +(defgeneric make-period (value) + (:documentation "Returns PERIOD of subclass appropriate to the + class of value. Probably guessed.")) +(defgeneric make-anchored-period (start-value duration-value) + (:documentation "Returns ANCHORED-PERIOD of subclass + appropriate to the class of value. Probably guessed.")) + + ;;; Dynamics ;;; Voice ;;; Boundary Strength (phrasing)
--- a/base/methods.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/base/methods.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -66,14 +66,14 @@ (defmethod middle-c ((cp chromatic-pitch)) (make-chromatic-pitch 60)) -(defmethod chromatic-pitch ((pitch-designator chromatic-pitch)) - pitch-designator) +(defmethod chromatic-pitch ((pitch chromatic-pitch)) + pitch) -(defmethod midi-pitch-number ((pitch-designator chromatic-pitch)) - (%chromatic-pitch-number pitch-designator)) +(defmethod midi-pitch-number ((pitch chromatic-pitch)) + (%chromatic-pitch-number pitch)) -(defmethod midi-pitch-number ((pitch-designator pitch)) - (%chromatic-pitch-number (chromatic-pitch pitch-designator))) +(defmethod midi-pitch-number ((pitch pitch)) + (%chromatic-pitch-number (chromatic-pitch pitch))) (defmethod print-object ((o chromatic-pitch) stream) (print-unreadable-object (o stream :type t) @@ -84,46 +84,46 @@ (write (span o) :stream stream))) -(defmethod span ((pitch-interval-designator chromatic-pitch-interval)) - (%chromatic-pitch-interval-span pitch-interval-designator)) +(defmethod span ((pitch-interval chromatic-pitch-interval)) + (%chromatic-pitch-interval-span pitch-interval)) -(defmethod duration ((period-designator period)) - (%period-interval period-designator)) +(defmethod duration ((period standard-period)) + (%period-interval period)) -(defmethod (setf duration) ((value real) (period-designator period)) - (setf (%period-interval period-designator) value)) +(defmethod (setf duration) ((value real) (period standard-period)) + (setf (%period-interval period) value)) -(defmethod timepoint ((moment-designator moment)) - (%moment-time moment-designator)) +(defmethod timepoint ((moment standard-moment)) + (%moment-time moment)) -(defmethod (setf timepoint) ((value real) (moment-designator moment)) - (setf (%moment-time moment-designator) value)) +(defmethod (setf timepoint) ((value real) (moment standard-moment)) + (setf (%moment-time moment) value)) -(defmethod cut-off ((anchored-period-designator anchored-period)) - (make-instance 'moment - :time (+ (%moment-time anchored-period-designator) - (%period-interval anchored-period-designator)))) +(defmethod cut-off ((anchored-period standard-anchored-period)) + (make-instance 'standard-moment + :time (+ (%moment-time anchored-period) + (%period-interval anchored-period)))) -(defmethod print-object ((o moment) stream) +(defmethod print-object ((o standard-moment) stream) (print-unreadable-object (o stream :type t) (write (timepoint o) :stream stream))) -(defmethod print-object ((o period) stream) +(defmethod print-object ((o standard-period) stream) (print-unreadable-object (o stream :type t) (write (duration o) :stream stream))) -(defmethod print-object ((o anchored-period) stream) +(defmethod print-object ((o standard-anchored-period) stream) (print-unreadable-object (o stream :type t) (format stream "~A ~A" (timepoint o) (duration o)))) -(defmethod beat-units-per-bar ((time-signature basic-time-signature)) +(defmethod beat-units-per-bar ((time-signature standard-time-signature)) (%basic-time-signature-numerator time-signature)) -(defmethod beat-units ((time-signature basic-time-signature)) +(defmethod beat-units ((time-signature standard-time-signature)) (%basic-time-signature-denominator time-signature)) -(defmethod time-signature-equal ((ts1 basic-time-signature) - (ts2 basic-time-signature)) +(defmethod time-signature-equal ((ts1 standard-time-signature) + (ts2 standard-time-signature)) (let ((n1 (time-signature-numerator ts1)) (n2 (time-signature-numerator ts2)) (d1 (time-signature-denominator ts1)) @@ -131,11 +131,11 @@ (and n1 n2 (= n1 n2) d1 d2 (= d1 d2)))) -(defmethod print-object ((bts basic-time-signature) stream) - (print-unreadable-object (bts stream :type t) - (format stream "~A/~A" (beat-units-per-bar bts) (beat-units bts)))) +(defmethod print-object ((sts standard-time-signature) stream) + (print-unreadable-object (sts stream :type t) + (format stream "~A/~A" (beat-units-per-bar sts) (beat-units sts)))) -(defmethod key-signature-sharps ((key-signature basic-key-signature)) +(defmethod key-signature-sharps ((key-signature standard-key-signature)) (%basic-key-signature-sharp-count key-signature)) (defmethod key-signature-mode ((ks midi-key-signature)) @@ -147,8 +147,8 @@ (%basic-key-signature-sharp-count mks) (%midi-key-signature-mode mks)))) -(defmethod key-signature-equal ((ks1 basic-key-signature) - (ks2 basic-key-signature)) +(defmethod key-signature-equal ((ks1 standard-key-signature) + (ks2 standard-key-signature)) (let ((s1 (key-signature-sharps ks1)) (s2 (key-signature-sharps ks2))) (and s1 s2 (= s1 s2)))) @@ -162,10 +162,10 @@ (and s1 s2 (= s1 s2) m1 m2 (= m1 m2)))) -(defmethod bpm ((tempo tempo)) +(defmethod bpm ((tempo standard-tempo)) (%tempo-bpm tempo)) -(defmethod print-object ((tempo tempo) stream) +(defmethod print-object ((tempo standard-tempo) stream) (print-unreadable-object (tempo stream :type t) (write (bpm tempo) :stream stream))) @@ -175,50 +175,53 @@ ;; Time protocol -(defmethod time+ ((object1 moment) (object2 period)) - "Returns a <moment>. Implemented as a straightforward +(defmethod time+ ((moment standard-moment) (period standard-period)) + "Returns a <standard-moment>. Implemented as a straightforward summation." - (make-moment (+ (timepoint object1) (duration object2)))) + (make-standard-moment (+ (timepoint moment) (duration period)))) -(defmethod time+ ((object1 period) (object2 moment)) ;? - "Returns a <moment>. Implemented as a straightforward summation -and defined by default as (time+ <moment> <period>)." - (time+ object2 object1)) +(defmethod time+ ((period standard-period) (moment standard-moment)) ;? + "Returns a <standard-moment>. Implemented as a straightforward +summation and defined by default as (time+ <moment> <period>)." + (time+ standard-moment period)) -(defmethod time+ ((object1 period) (object2 period)) - "Returns a <period>. Implemented as a straightforward +(defmethod time+ ((period1 standard-period) + (period2 standard-period)) + "Returns a <standard-period>. Implemented as a straightforward summation." - (make-floating-period (+ (duration object1) - (duration object2)))) + (make-standard-period (+ (duration period1) + (duration period2)))) -(defmethod time+ ((object1 moment) (object2 moment)) +(defmethod time+ ((moment1 moment) (moment2 moment)) "Returns <condition:undefined-action>. The question makes no sense." - (error 'undefined-action :operation 'time+ :datatype (list (class-of object1) (class-of object2)))) + (error 'undefined-action :operation 'time+ + :datatype (list (class-of object1) (class-of object2)))) -(defmethod time- ((object1 moment) (object2 moment)) - "Returns <anchored-period> with an onset at object2 and - extending to object1" - (make-anchored-period (timepoint object2) - (- (timepoint object1) - (timepoint object2)))) +(defmethod time- ((moment1 standard-moment) (moment2 standard-moment)) + "Returns <standard-anchored-period> with an onset at moment2 and + extending to moment1" + (make-standard-anchored-period (timepoint moment2) + (- (timepoint moment1) + (timepoint moment2)))) -(defmethod time- ((object1 moment) (object2 period)) - "Simple subtraction - Returns a <moment>" - (make-moment (- (timepoint object1) (duration object2)))) +(defmethod time- ((moment standard-moment) (period standard-period)) + "Returns <standard-moment>. Simple subtraction." + (make-standard-moment (- (timepoint moment) + (duration period)))) -(defmethod time- ((object1 period) (object2 moment)) ;? +(defmethod time- ((period period) (moment moment)) ;? "Returns <condition:undefined-action>. The question makes no sense" (error 'undefined-action :operation 'time- :datatype (list (class-of object1) (class-of object2)))) -(defmethod time- ((object1 period) (object2 period)) - "Returns <floating-period> spanning the difference of the +(defmethod time- ((period1 standard-period) (period2 standard-period)) + "Returns <standard-period> spanning the difference of the periods" - (make-floating-period (- (duration object2) - (duration object1)))) + (make-standard-period (- (duration period2) + (duration period1)))) ;; these ones are less certain. I've just put them in, but think I ;; should remove them and force the user to specify what they mean @@ -243,20 +246,20 @@ (defmethod time= ((object1 moment) (object2 moment)) (= (timepoint object1) (timepoint object2))) -(defmethod duration> ((object1 period) (object2 period)) - (> (duration object1) (duration object2))) +(defmethod duration> ((period1 standard-period) (period2 standard-period)) + (> (duration period1) (duration period2))) -(defmethod duration= ((object1 period) (object2 period)) - (= (duration object1) (duration object2))) +(defmethod duration= ((period1 standard-period) (period2 standard-period)) + (= (duration period1) (duration period2))) -(defmethod duration* ((object1 period) (object2 number)) - (make-floating-period (* (duration object1) object2))) +(defmethod duration* ((period1 standard-period) (object2 number)) + (make-floating-period (* (duration period1) object2))) -(defmethod duration* ((object1 number) (object2 period)) - (duration* object2 object1)) +(defmethod duration* ((object1 number) (period standard-period)) + (duration* period object1)) -(defmethod duration/ ((object1 period) (object2 number)) - (make-floating-period (/ (duration object1) object2))) +(defmethod duration/ ((period standard-period) (object2 number)) + (make-floating-period (/ (duration period) object2))) ;;;; Pitch protocol @@ -266,19 +269,19 @@ `(defmethod ,name ((object1 ,class1) (object2 ,class2)) (error 'undefined-action :operation ',name :datatype (list (class-of object1) (class-of object2)))))) - (def pitch+ pitch-designator pitch-designator) - (def pitch- pitch-interval-designator pitch-designator)) + (def pitch+ pitch pitch) + (def pitch- pitch-interval pitch)) (macrolet ((def (name class1 class2) `(defmethod ,name ((object1 ,class1) (object2 ,class2)) (error 'insufficient-information :operation ',name :datatype (list (class-of object1) (class-of object2)))))) - (def pitch+ pitch-designator pitch-interval-designator) - (def pitch+ pitch-interval-designator pitch-designator) - (def pitch+ pitch-interval-designator pitch-interval-designator) - (def pitch- pitch-designator pitch-designator) - (def pitch- pitch-designator pitch-interval-designator) - (def pitch- pitch-interval-designator pitch-interval-designator)) + (def pitch+ pitch pitch-interval) + (def pitch+ pitch-interval pitch) + (def pitch+ pitch-interval pitch-interval) + (def pitch- pitch pitch) + (def pitch- pitch pitch-interval) + (def pitch- pitch-interval pitch-interval)) ;;; chromatic pitch intervals @@ -421,12 +424,12 @@ (object2 anchored-period)) (and (time= object1 object2) (duration= object1 object2))) -(defmethod period= ((object1 floating-period) - (object2 floating-period)) +(defmethod period= ((object1 period) + (object2 period)) (duration= object1 object2)) -(defmethod period-intersection ((object1 anchored-period) - (object2 anchored-period)) +(defmethod period-intersection ((object1 standard-anchored-period) + (object2 standard-anchored-period)) (cond ((disjoint object1 object2) ;; if they don't overlap, return nil, not a negative-valued @@ -441,4 +444,13 @@ start)))) (make-anchored-period (timepoint start) duration))))) - +;; Time constructors +(defmethod make-moment ((time-value real)) + "Returns STANDARD-MOMENT given a real" + (make-standard-moment time-value)) +(defmethod make-period ((duration-value real)) + "Returns STANDARD-PERIOD given a real" + (make-standard-period duration-value)) +(defmethod make-anchored-period ((onset-value real) (duration-value real)) + "Returns STANDARD-ANCHORED-PERIOD given a real" + (make-standard-anchored-period onset-value duration-value)) \ No newline at end of file
--- a/base/package.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/base/package.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -3,32 +3,43 @@ (:export #:amuse-object #:constituent #:composition + #:standard-constituent + #:standard-composition #:monody #:identifier - #:moment-designator - #:period-designator - #:anchored-period-designator - #:pitch-designator - #:pitch-interval-designator #:moment #:period - #:floating-period #:anchored-period - #:frequency #:pitch + #:pitch-interval + #:standard-moment + #:standard-period + #:standard-anchored-period + #:frequency-pitch #:chromatic-pitch #:diatonic-pitch #:chromatic-pitch-interval #:diatonic-pitch-interval #:pitched-event + #:standard-pitched-event #:chromatic-pitched-event + #:standard-chromatic-pitched-event #:percussive-event + #:standard-percussive-event #:time-signature - #:basic-time-signature + #:time-signature-perid + #:standard-time-signature + #:standard-time-signature-period #:key-signature - #:basic-key-signature + #:key-signature-period + #:standard-key-signature + #:standard-key-signature-period #:midi-key-signature + #:midi-key-signature-period #:tempo + #:tempo-period + #:standard-tempo + #:standard-tempo-period #:get-composition #:time-signatures #:tempi @@ -49,7 +60,7 @@ #:bpm #:microseconds-per-crotchet #:anchored-period - #:floating-period + #:period #:moment #:onset #:time+ @@ -98,16 +109,23 @@ #:get-applicable-tempi #:get-applicable-key-signatures #:make-moment - #:make-floating-period + #:make-period #:make-anchored-period + #:make-standard-moment + #:make-standard-period + #:make-standard-anchored-period #:make-chromatic-pitch #:make-diatonic-pitch #:make-chromatic-pitch-interval #:make-chromatic-pitched-event - #:make-basic-time-signature - #:make-basic-key-signature + #:make-standard-time-signature + #:make-standard-time-signature-period + #:make-standard-key-signature + #:make-basic-key-signature-period #:make-midi-key-signature - #:make-tempo + #:make-midi-key-signature-period + #:make-standard-tempo + #:make-standard-tempo-period #:time-signature-equal #:key-signature-equal #:tempo-equal
--- a/implementations/geerdes/constructors.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/implementations/geerdes/constructors.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -7,22 +7,22 @@ (timebase (%midi-timebase composition))) (dolist (row (%midi-events composition)) (let* ((note (if (pitched-row-p row) - (make-geerdes-pitched-event (%fast-pitch row) - (%fast-velocity row) - (%fast-patch row) - (%fast-channel row) - (%fast-track row) - (%fast-onset row timebase) - (%fast-duration row timebase) - (%fast-id row)) - (make-geerdes-percussive-event (%fast-pitch row) - (%fast-velocity row) - (%fast-patch row) - (%fast-channel row) - (%fast-track row) - (%fast-onset row timebase) - (%fast-duration row timebase) - (%fast-id row))))) + (make-geerdes-pitched-event (%fast-pitch row) + (%fast-velocity row) + (%fast-patch row) + (%fast-channel row) + (%fast-track row) + (%fast-onset row timebase) + (%fast-duration row timebase) + (%fast-id row)) + (make-geerdes-percussive-event (%fast-pitch row) + (%fast-velocity row) + (%fast-patch row) + (%fast-channel row) + (%fast-track row) + (%fast-onset row timebase) + (%fast-duration row timebase) + (%fast-id row))))) (when (%fast-monodyp row) (let ((monody-note (copy-event note))) (setf (duration monody-note) (%fast-monody-duration row timebase)) @@ -54,14 +54,14 @@ (dolist (row (%midi-constituents composition)) (cond ((%fast-tempo row) - (push (make-tempo + (push (make-standard-tempo-period (microsecond-per-crotchet-to-bpm (%fast-tempo row)) (%fast-onset row timebase) (%fast-duration row timebase)) tempi)) ((%fast-numerator row) - (push (make-basic-time-signature + (push (make-standard-time-signature-period (%fast-numerator row) (%fast-denominator row) (%fast-onset row timebase)
--- a/implementations/geerdes/methods.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/implementations/geerdes/methods.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -150,11 +150,14 @@ (defmethod crotchet ((object geerdes-object)) (make-instance 'floating-period :interval 1)) -(defmethod get-applicable-time-signatures ((anchored-period anchored-period) (composition midi-composition)) +(defmethod get-applicable-time-signatures ((anchored-period anchored-period) + (composition midi-composition)) (%find-overlapping anchored-period (time-signatures composition))) -(defmethod get-applicable-tempi ((anchored-period anchored-period) (composition midi-composition)) +(defmethod get-applicable-tempi ((anchored-period anchored-period) + (composition midi-composition)) (%find-overlapping anchored-period (tempi composition))) -(defmethod get-applicable-key-signatures ((anchored-period anchored-period) (composition midi-composition)) +(defmethod get-applicable-key-signatures ((anchored-period anchored-period) + (composition midi-composition)) (%find-overlapping anchored-period (key-signatures composition))) (defparameter *stuff* nil)
--- a/implementations/gsharp/classes.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/implementations/gsharp/classes.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -1,9 +1,9 @@ (cl:in-package "AMUSE-GSHARP") -(defclass gsharp-composition (amuse:composition) +(defclass gsharp-composition (amuse:standard-composition) ((buffer :initarg :buffer :reader buffer) (tempi :initarg :tempi :reader tempi))) -(defclass gsharp-pitched-event (chromatic-pitched-event) +(defclass gsharp-pitched-event (standard-chromatic-pitched-event) ((note :initarg :note :reader note) (slice-index :initarg :slice-index)))
--- a/implementations/midi/classes.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/implementations/midi/classes.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -1,9 +1,9 @@ (cl:in-package #:amuse-midi) -(defclass midi-object (amuse:amuse-object) () +(defclass midi-object (amuse-object) () (:documentation "MIDI base class")) -(defclass midi-composition (amuse:composition midi-object) +(defclass midi-composition (standard-composition midi-object) ((time-signatures :initarg :time-signatures :initform 'nil :accessor %midi-time-signatures) @@ -24,14 +24,14 @@ ((channel :accessor %midi-message-channel :initarg :channel) (track :accessor %midi-message-track :initarg :track))) -(defclass midi-pitched-event (chromatic-pitched-event midi-message) +(defclass midi-pitched-event (standard-chromatic-pitched-event midi-message) ((velocity :initarg :velocity :accessor %midi-pitched-event-velocity) (patch :initarg :patch :accessor %midi-pitched-event-patch)) (:documentation "Adds MIDI information to chromatic-pitched-event")) -(defclass midi-percussive-event (percussive-event midi-message) +(defclass midi-percussive-event (standard-percussive-event midi-message) ((velocity :initarg :velocity :accessor %midi-percussive-event-velocity) (patch :initarg :patch
--- a/implementations/midi/midifile-import.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/implementations/midi/midifile-import.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -77,7 +77,7 @@ (- (/ (midi:message-time event) division) (timepoint (car time-sigs))))) - (push (make-instance 'basic-time-signature + (push (make-instance 'standard-time-signature-period :time (/ (midi:message-time event) division) :numerator (midi:message-numerator event) @@ -91,7 +91,7 @@ (- (/ (midi:message-time event) division) (timepoint (car time-sigs))))) - (push (make-instance 'midi-key-signature + (push (make-instance 'midi-key-signature-period :time (/ (midi:message-time event) division) :sharp-count (midi:message-sf event) @@ -103,7 +103,7 @@ (- (/ (midi:message-time event) division) (timepoint (car tempi))))) - (push (make-instance 'tempo + (push (make-instance 'standard-tempo-period :time (/ (midi:message-time event) division) :bpm (microsecond-per-crotchet-to-bpm (midi:message-tempo event))) @@ -124,11 +124,8 @@ :interval (/ last-time division) :time-signatures (if time-sigs (sort time-sigs #'time<) - (list (make-instance 'basic-time-signature - :time 0 - :interval (/ last-time division) - :numerator 4 - :denominator 4))) + (list (make-standard-time-signature-period + 4 4 0 (/ last-time division)))) :tempi (sort tempi #'time<) :key-signatures (sort key-sigs #'time<)))) (sequence:adjust-sequence composition
--- a/implementations/mtp/classes.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/implementations/mtp/classes.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -32,7 +32,7 @@ (timebase :initarg :timebase :accessor dataset-timebase) (midc :initarg :midc :accessor dataset-midc))) -(defclass mtp-composition (amuse:composition mtp-music-object) +(defclass mtp-composition (amuse:standard-composition mtp-music-object) ((dataset-id :initarg :dataset-id :accessor dataset-id) (composition-id :initarg :composition-id :accessor composition-id) (description :initarg :description :accessor description))) @@ -40,7 +40,7 @@ (defclass mtp-monody (amuse:monody mtp-composition) ()) -(defclass mtp-event (amuse:pitched-event mtp-music-object) +(defclass mtp-event (amuse:standard-pitched-event mtp-music-object) ((dataset-id :initarg :dataset-id :accessor dataset-id) (composition-id :initarg :composition-id :accessor composition-id) (event-id :initarg :event-id :accessor event-id)
--- a/implementations/mtp/methods.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/implementations/mtp/methods.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -125,7 +125,7 @@ ;;; Constituents from compositions: time-signatures (defmethod crotchet ((dataset mtp-dataset)) - (amuse:make-floating-period + (amuse:make-standard-period (/ (dataset-timebase dataset) 4))) #.(clsql:locally-enable-sql-reader-syntax) @@ -136,7 +136,7 @@ (dataset-id composition)] :flatp t :field-names nil)))) - (amuse:make-floating-period (/ timebase 4)))) + (amuse:make-standard-period (/ timebase 4)))) (defmethod crotchet ((event mtp-event)) (let ((timebase (car (clsql:select [timebase] :from [mtp-dataset] @@ -144,7 +144,7 @@ (dataset-id event)] :flatp t :field-names nil)))) - (amuse:make-floating-period (/ timebase 4)))) + (amuse:make-standard-period (/ timebase 4)))) #.(clsql:restore-sql-reader-syntax-state) (defmethod get-applicable-time-signatures ((e mtp-event) c) @@ -153,10 +153,10 @@ (barlength (%mtp-barlength e)) (timebase (* 4 (duration (crotchet e))))) (list - (amuse:make-basic-time-signature pulses - (/ timebase (/ barlength pulses)) - (timepoint e) - (duration e))))) + (amuse:make-standard-time-signature-period pulses + (/ timebase (/ barlength pulses)) + (timepoint e) + (duration e))))) (defmethod time-signatures ((c mtp-composition)) (let ((results nil) @@ -187,9 +187,9 @@ (let* ((sharps (%mtp-keysig e)) (mode (%mtp-mode e)) (midi-mode (and mode (if (= mode 0) 0 1)))) - (list (amuse:make-midi-key-signature sharps midi-mode - (timepoint e) - (duration e))))) + (list (amuse:make-midi-key-signature-period sharps midi-mode + (timepoint e) + (duration e))))) (defmethod key-signatures ((c mtp-composition)) (let ((results nil) @@ -217,9 +217,9 @@ (defmethod get-applicable-tempi ((e mtp-event) c) (declare (ignore c)) - (list (amuse:make-tempo (%mtp-tempo e) - (timepoint e) - (duration e)))) + (list (amuse:make-standard-tempo-period (%mtp-tempo e) + (timepoint e) + (duration e)))) (defmethod tempi ((c mtp-composition)) (let ((results nil)
--- a/implementations/tabcode/classes.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/implementations/tabcode/classes.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -1,9 +1,9 @@ (cl:in-package #:amuse-tabcode) -(defclass tabcode-composition (amuse:composition) +(defclass tabcode-composition (amuse:standard-composition) ()) -(defclass tabcode-pitched-event (chromatic-pitched-event) +(defclass tabcode-pitched-event (standard-chromatic-pitched-event) ((course :initarg :course :reader course) (fret :initarg :fret :reader fret) (word :initarg :word :reader word)))
--- a/tools/midi-output.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/tools/midi-output.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -129,7 +129,7 @@ (defgeneric event-messages (event) (:method (e) (declare (ignore e)) nil)) -(defmethod event-messages ((event pitched-event)) +(defmethod event-messages ((event standard-chromatic-pitched-event)) (list (make-instance 'midi:note-on-message :status (+ (get-channel-for-midi event) 144) :key (midi-pitch-number event) @@ -141,7 +141,7 @@ :velocity (get-velocity-for-midi event) :time (timepoint (cut-off event))))) -(defmethod event-messages ((event percussive-event)) +(defmethod event-messages ((event standard-percussive-event)) (list (make-instance 'midi:note-on-message :status 153 :key (get-pitch-for-midi event)
--- a/tools/segmentation/methods.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/tools/segmentation/methods.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -1,10 +1,10 @@ (in-package "AMUSE-SEGMENTATION") -(defmethod boundary-time (segmenter (object anchored-period-designator)) +(defmethod boundary-time (segmenter (object anchored-period)) (if (segments-beforep segmenter) (onset object) (cut-off object))) -(defmethod boundary-time (segmenter (object moment-designator)) +(defmethod boundary-time (segmenter (object moment)) object) ;;;;;;;;;;;;;;;;;;;;;;;
--- a/tools/segmentation/simple-example.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/tools/segmentation/simple-example.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -14,7 +14,7 @@ (defclass simple-segmenter (after-segmenter) ()) -(defmethod boundary-strength ((segmenter simple-segmenter) (event moment-designator) (composition composition)) +(defmethod boundary-strength ((segmenter simple-segmenter) (event moment) (composition composition)) (declare (ignore segmenter)) (multiple-value-bind (i-o-i mode i-o-i-rt) (inter-onset-intervals-for-simple-segmenter-with-cache composition)
--- a/utils/utils.lisp Tue Aug 28 11:17:27 2007 +0100 +++ b/utils/utils.lisp Fri Aug 31 15:29:43 2007 +0100 @@ -17,13 +17,13 @@ time-signature. It should be borne in mind that this needn't be an integer - a time signature of 3/8, for example, should yield an answer of 3/2")) -(defmethod crotchets-in-a-bar ((time-signature basic-time-signature)) +(defmethod crotchets-in-a-bar ((time-signature standard-time-signature)) (let ((num (time-signature-numerator time-signature)) (den (time-signature-denominator time-signature))) (* num (/ 4 den)))) (defgeneric beats-to-seconds (object1 object2)) -(defmethod beats-to-seconds ((object1 anchored-period) +(defmethod beats-to-seconds ((object1 standard-anchored-period) (object2 constituent)) (let ((tempi (or (get-applicable-tempi object1 object2) (signal 'undefined-action @@ -33,12 +33,13 @@ (dolist (tempo tempi (/ s 1000000)) (incf s (if (disjoint tempo object1) 0 - (* (duration (period-intersection tempo object1)) + (* (/ (duration (period-intersection tempo object1)) + (duration (crotchet constituent))) (amuse:microseconds-per-crotchet tempo))))))) -(defmethod beats-to-seconds ((object1 moment) +(defmethod beats-to-seconds ((object1 standard-moment) (object2 constituent)) (beats-to-seconds (time- (onset object1) - (make-moment 0)) + (make-standard-moment 0)) object2)) ;; Not as simple as it seems - have to take into account numbering