comparison base/generics.lisp @ 106:8528c316fbcc

delete diatonic-pitch (as was) Delete the diatonic-pitch class, in preparation for MIPS pitch being our single representation. Add a DIATONIC-PITCH-OCTAVE generic, and make OCTAVE return the octave based on a MIDI-PITCH-NUMBER (and make sure that it returns an integer, too). darcs-hash:20070726121235-dc3a5-4cbd1058145163eecbfc84384234904e2353fead.gz
author c.rhodes <c.rhodes@gold.ac.uk>
date Thu, 26 Jul 2007 13:12:35 +0100
parents 59e69a32b8d9
children b445959f4cc1
comparison
equal deleted inserted replaced
105:7f139c81752e 106:8528c316fbcc
37 37
38 ;; pitch-based 38 ;; pitch-based
39 39
40 (defgeneric pitch (object &key kind)) ; ? Maybe this returns the pitch 40 (defgeneric pitch (object &key kind)) ; ? Maybe this returns the pitch
41 ; in its ur form? 41 ; in its ur form?
42 (defgeneric chromatic-pitch (pitch-designator)) ; How simple are these 42 (defgeneric chromatic-pitch (pitch-designator))
43 (defgeneric diatonic-pitch (pitch-designator)) ; if has to be computed? 43 (defgeneric diatonic-pitch (pitch-designator))
44 (defgeneric mips-pitch (pitch-designator))
45 (defgeneric frequency (object)) ;? 44 (defgeneric frequency (object)) ;?
46 45
47 (defgeneric octave (pitch-designator) 46 (defgeneric octave (pitch-designator)
48 (:documentation "Return an integer representing the octave of 47 (:documentation "Return an integer representing the octave of
49 pitch-designator where middle c is defined to be the lowest pitch in 48 pitch-designator where middle c is defined to be the lowest pitch in
50 octave 4.")) 49 octave 4."))
50
51 (defgeneric diatonic-pitch-octave (pitch-designator)
52 (:documentation "Return an integer representing the diatonic octave
53 of PITCH-DESIGNATOR."))
51 54
52 (defgeneric diatonic-pitch-accidental (pitch-designator) 55 (defgeneric diatonic-pitch-accidental (pitch-designator)
53 (:documentation "Return an integer representing the inflection of a 56 (:documentation "Return an integer representing the inflection of a
54 diatonic pitch where where negative values indicate numbers of flats, 57 diatonic pitch where where negative values indicate numbers of flats,
55 0 indicates natural and positive values indicate numbers of sharps.")) 58 0 indicates natural and positive values indicate numbers of sharps."))
60 (defgeneric midi-pitch-number (pitch-designator) 63 (defgeneric midi-pitch-number (pitch-designator)
61 (:documentation "Takes a pitch-designator (usually a pitched 64 (:documentation "Takes a pitch-designator (usually a pitched
62 event) and returns an integer between 0 and 127 representing 65 event) and returns an integer between 0 and 127 representing
63 the chromatic pitch designated (60=middle C, 48 the C below 66 the chromatic pitch designated (60=middle C, 48 the C below
64 that, etc.)")) 67 that, etc.)"))
65 (defgeneric meredith-chromatic-pitch-number (pitch-designator)
66 (:documentation "Takes a pitch-designator (usually a pitched
67 event) and returns an integer representing the chromatic pitch
68 designated (39=middle C, 27 the C below that, etc.)")
69 ;; David Meredith's PhD and ps13 code. FIXME: What is the legal
70 ;; range of this?
71 (:method (p) (- (midi-pitch-number p) 21)))
72 (defgeneric meredith-morphetic-pitch-number (pitch-designator)
73 (:documentation "Returns an integer representing the morphetic pitch
74 (7 per octave, An0 = 0, An1 = 7, middle c = 23) designated."))
75 (defgeneric asa-pitch-string (pitch-designator) 68 (defgeneric asa-pitch-string (pitch-designator)
76 (:documentation "Returns a string representing the designated ASA 69 (:documentation "Returns a string representing the designated ASA
77 pitch name which has three parts: a letter name in the set 70 pitch name which has three parts: a letter name in the set
78 {A,B,C,D,E,F,G}, an inflection in the set {n,f,s,ff,ss,fff,sss,...} 71 {A,B,C,D,E,F,G}, an inflection in the set {n,f,s,ff,ss,fff,sss,...}
79 and an octave number. E.g., Cn4 = Middle C.")) 72 and an octave number. E.g., Cn4 = Middle C."))