j@190
|
1 (cl:in-package #:amuse)
|
j@190
|
2
|
j@190
|
3 ;; top-level amuse object
|
j@190
|
4
|
j@190
|
5 (defclass amuse-object () ())
|
j@190
|
6
|
j@190
|
7 ;; types of information-specifiers
|
j@190
|
8
|
j@190
|
9 (defclass identifier (amuse-object) ()
|
j@190
|
10 (:documentation "DEPRECATED: Base class to allow specification of
|
j@217
|
11 composition to get. Must be subclassed.")) ; FIXME: Why deprecated?
|
j@190
|
12
|
j@190
|
13 (defclass constituent-identifier (identifier) ()
|
j@217
|
14 (:documentation "Base class to allow specification of
|
j@217
|
15 constituents"))
|
j@217
|
16
|
j@190
|
17 (defclass composition-identifier (constituent-identifier) ()
|
j@217
|
18 (:documentation "Base class to allow specification of
|
j@217
|
19 compositions constituents"))
|
j@217
|
20
|
j@217
|
21 (defclass event-identifier (identifier) ()
|
j@217
|
22 (:documentation "Base class to allow specification of events."))
|
j@190
|
23
|
j@190
|
24 (defclass moment (amuse-object) ()
|
j@190
|
25 (:documentation "Object indicating a point in time"))
|
j@190
|
26 (defclass period (amuse-object) ()
|
j@190
|
27 (:documentation "Object indicating a region of time"))
|
j@190
|
28 (defclass anchored-period (moment period) ()
|
j@190
|
29 (:documentation "Object indicating a region of time starting at
|
j@190
|
30 a specific point in time"))
|
j@190
|
31 (defclass pitch (amuse-object) ()
|
j@190
|
32 (:documentation "Object indicating some sort of pitch"))
|
j@190
|
33 (defclass pitch-interval (amuse-object) ()
|
j@190
|
34 (:documentation "Object indicating a distance in pitch space"))
|
j@190
|
35
|
j@190
|
36 ;; time-related classes
|
j@190
|
37
|
j@190
|
38 (defclass standard-moment (moment)
|
j@190
|
39 ((time :accessor %moment-time :initarg :time))
|
j@190
|
40 (:documentation "A moment that has time represented on a
|
j@190
|
41 continuous, progressive number line"))
|
j@190
|
42
|
j@190
|
43 (defclass standard-period (period)
|
j@190
|
44 ((interval :accessor %period-interval :initarg :interval))
|
j@190
|
45 (:documentation "A period that places time intervals
|
j@190
|
46 on a progressive number-line"))
|
j@190
|
47
|
j@190
|
48 (defclass standard-anchored-period (standard-period standard-moment anchored-period) ()
|
j@190
|
49 (:documentation "Number-line-based anchored period"))
|
j@190
|
50
|
j@190
|
51 ;; pitch-related classes
|
j@190
|
52
|
j@190
|
53 (defclass frequency-pitch (pitch) ())
|
j@190
|
54
|
j@190
|
55 (defclass chromatic-pitch (pitch)
|
j@222
|
56 ((number :accessor %chromatic-pitch-number
|
j@222
|
57 :reader chromatic-pitch-number :initarg :number))
|
j@222
|
58 (:documentation "A pitch represented as a number, with chromatic
|
j@222
|
59 pitches having distinct values. FIXME: We should not be using the cl
|
j@222
|
60 symbol NUMBER."))
|
j@222
|
61
|
j@190
|
62 (defclass diatonic-pitch (pitch)
|
j@190
|
63 ((cp :initarg :cp :accessor %p-pc :reader diatonic-pitch-cp)
|
j@190
|
64 (mp :initarg :mp :accessor %p-pm :reader diatonic-pitch-mp))
|
j@190
|
65 (:documentation "A diatonic pitch, represented using MIPS: cp is an
|
j@190
|
66 integer representing chromatic pitch (An0 = 0, middle C = 39); mp is
|
j@190
|
67 an integer representing the morphetic pitch (An0 = 0, middle C =
|
j@190
|
68 23)."))
|
j@190
|
69
|
j@190
|
70 (defclass chromatic-pitch-interval (pitch-interval)
|
j@190
|
71 ((span :accessor %chromatic-pitch-interval-span :initarg :span))
|
j@190
|
72 (:documentation "An interval represented as a number, recording
|
j@190
|
73 the number of ascending chromatic pitches between two pitches."))
|
j@190
|
74
|
j@190
|
75 (defclass diatonic-pitch-interval (pitch-interval)
|
j@190
|
76 ((span :accessor %diatonic-pitch-interval-span :initarg :span :reader span))
|
j@190
|
77 (:documentation "How is this inplemented?"))
|
j@190
|
78
|
j@190
|
79 ;; events
|
j@190
|
80
|
j@190
|
81 (defclass event (anchored-period) ()
|
j@190
|
82 (:documentation "Notelike object"))
|
j@237
|
83
|
j@223
|
84 (defclass linked-event (amuse-object)
|
j@223
|
85 ((composition :reader composition
|
j@223
|
86 :writer %set-composition
|
j@248
|
87 :initarg :composition
|
j@248
|
88 :initform nil))
|
j@232
|
89 (:documentation "This provides a composition slot for events. The
|
j@232
|
90 generic function initialize-instance can be specialized on an
|
j@232
|
91 implementation composition to assign the event slots when a
|
j@232
|
92 composition instance is created. Or the slot can be assigned within
|
j@232
|
93 the composition constructor function. FIXME: Not sure about this -
|
j@232
|
94 was there a good reason why events should not know the composition
|
j@232
|
95 they belong to? MTP-events have a slot for composition-id (an
|
j@232
|
96 integer number), but here the slot is intended to be assigned the
|
j@232
|
97 composition object itself. Doing this means that potentially some
|
j@232
|
98 generic functions could loose the extra composition parameter. I
|
j@232
|
99 made this change because of SIA projection related stuff, the only
|
j@232
|
100 function that relies on it in amuse is find-next-event. JF"))
|
j@232
|
101
|
j@190
|
102 (defclass pitched-event (event pitch) ()
|
j@190
|
103 (:documentation "Event with pitch information"))
|
j@237
|
104
|
j@190
|
105 (defclass standard-pitched-event (pitched-event
|
j@190
|
106 standard-anchored-period) ()
|
j@190
|
107 (:documentation "Event with pitch information"))
|
j@237
|
108
|
j@190
|
109 (defclass chromatic-pitched-event (pitched-event chromatic-pitch) ()
|
j@190
|
110 (:documentation "Event with chromatic pitch information"))
|
j@237
|
111
|
j@190
|
112 (defclass standard-chromatic-pitched-event (chromatic-pitched-event
|
j@190
|
113 standard-anchored-period) ()
|
j@190
|
114 (:documentation "Event with chromatic pitch information and
|
j@190
|
115 standard-period"))
|
j@237
|
116
|
j@213
|
117 (defclass diatonic-pitched-event (pitched-event diatonic-pitch) ()
|
j@213
|
118 (:documentation "Event with diatonic pitch information"))
|
j@237
|
119
|
j@213
|
120 (defclass standard-diatonic-pitched-event (diatonic-pitched-event
|
j@213
|
121 standard-anchored-period) ()
|
j@213
|
122 (:documentation "Event with diatonic pitch information and
|
j@213
|
123 standard-period"))
|
j@237
|
124
|
j@190
|
125 (defclass percussive-event (event) ()
|
j@190
|
126 (:documentation "Unpitched percussion Event. There's an issue
|
j@190
|
127 with this name - is there a reason why this is unpitched
|
j@190
|
128 necessarily, or why I'm not counting piano, etc in this? Perhaps
|
j@190
|
129 what I mean is that it should be renamed unpitched-event?
|
j@190
|
130 Actually, is this necessary? Isn't this just an event?"))
|
j@237
|
131
|
j@190
|
132 (defclass standard-percussive-event (event standard-anchored-period) ()
|
j@190
|
133 (:documentation "Unpitched percussion Event. There's an issue
|
j@190
|
134 with this name - is there a reason why this is unpitched
|
j@190
|
135 necessarily, or why I'm not counting piano, etc in this? Perhaps
|
j@190
|
136 what I mean is that it should be renamed unpitched-event?
|
j@190
|
137 Actually, is this necessary? Isn't this just an event?
|
j@190
|
138 Timbral/instrumental information will be generalised later but is
|
j@190
|
139 less agreed-on than pitch."))
|
j@190
|
140
|
j@190
|
141 ;;; Range-based `constituents'
|
j@190
|
142 ;; Whilst these are all constituents in the CHARM sense, their
|
j@190
|
143 ;; properties apply to a timed range rather than to a set of
|
j@190
|
144 ;; events. As such, they can be regarded as anchored-periods with
|
j@190
|
145 ;; properties.
|
j@190
|
146
|
j@190
|
147 (defclass time-signature (amuse-object) ()
|
j@190
|
148 (:documentation "Abstract class for time signature"))
|
j@190
|
149
|
j@190
|
150 (defclass time-signature-period (time-signature anchored-period) ()
|
j@190
|
151 (:documentation "Abstract class for time signatures in time"))
|
j@190
|
152
|
j@190
|
153 (defclass standard-time-signature (time-signature)
|
j@190
|
154 ((numerator :accessor %basic-time-signature-numerator
|
j@190
|
155 :initarg :numerator)
|
j@190
|
156 (denominator :accessor %basic-time-signature-denominator
|
j@190
|
157 :initarg :denominator))
|
j@190
|
158 (:documentation "Class with slots for numerator and
|
j@190
|
159 denominator. Can only deal with numeric signatures."))
|
j@190
|
160
|
j@190
|
161 (defclass standard-time-signature-period (standard-time-signature
|
j@190
|
162 time-signature-period
|
j@190
|
163 standard-anchored-period)
|
j@190
|
164 ()
|
j@190
|
165 (:documentation "STANDARD-TIME-SIGNATURE on a time number line"))
|
j@190
|
166
|
j@190
|
167 (defclass key-signature (amuse-object) ()
|
j@190
|
168 (:documentation "Base class for key signature"))
|
j@190
|
169
|
j@190
|
170 (defclass key-signature-period (key-signature anchored-period) ()
|
j@190
|
171 (:documentation "Abstract class for time signatures in time"))
|
j@190
|
172
|
j@190
|
173 (defclass standard-key-signature (key-signature)
|
j@190
|
174 ((sharp-count :accessor %basic-key-signature-sharp-count
|
j@190
|
175 :initarg :sharp-count))
|
j@190
|
176 (:documentation "Simple class - Only has line-of-fifths
|
j@190
|
177 distance from c, so custom signatures won't work"))
|
j@190
|
178
|
j@190
|
179 (defclass standard-key-signature-period (standard-key-signature
|
j@190
|
180 key-signature-period
|
j@190
|
181 standard-anchored-period)
|
j@190
|
182 ()
|
j@190
|
183 (:documentation "STANDARD-KEY-SIGNATURE on a time number line"))
|
j@190
|
184
|
j@190
|
185 (defclass midi-key-signature (standard-key-signature)
|
j@190
|
186 ((mode :accessor %midi-key-signature-mode
|
j@190
|
187 :initarg :mode))
|
j@190
|
188 (:documentation "MIDI-based flavour of basic key signature,
|
j@190
|
189 adding a slot for mode: 0 = major key; 1 = minor key"))
|
j@190
|
190
|
j@190
|
191 (defclass midi-key-signature-period (standard-key-signature-period
|
j@190
|
192 midi-key-signature)
|
j@190
|
193 ()
|
j@190
|
194 (:documentation "MIDI-KEY-SIGNATURE on a time number line"))
|
j@190
|
195
|
j@190
|
196 (defclass tempo (amuse-object) ()
|
j@190
|
197 (:documentation "Abstract class for tempo"))
|
j@190
|
198 (defclass tempo-period (tempo anchored-period) ()
|
j@190
|
199 (:documentation "Abstract class for tempo associated with a
|
j@190
|
200 time period"))
|
j@190
|
201 (defclass standard-tempo (tempo)
|
j@190
|
202 ((bpm :accessor %tempo-bpm
|
j@190
|
203 :initarg :bpm))
|
j@190
|
204 (:documentation "Rather literal reading of absolute tempo.
|
j@190
|
205 accel and rit in symbolic encoding will need other structures,
|
j@190
|
206 as will textual tempo markings."))
|
j@190
|
207 (defclass standard-tempo-period (standard-tempo
|
j@190
|
208 tempo-period
|
j@190
|
209 standard-anchored-period)
|
j@190
|
210 ()
|
j@190
|
211 (:documentation "Tempo associated with a standard-anchored-period"))
|
j@244
|
212
|
j@244
|
213
|
j@244
|
214 ;;;=====================================================================
|
j@244
|
215 ;;; Constituents: collections of more than one event
|
j@244
|
216 ;;;=====================================================================
|
j@190
|
217
|
j@246
|
218 (defclass constituent (period) ()
|
j@190
|
219 (:documentation "Base class for constituents"))
|
j@237
|
220
|
j@246
|
221 (defclass anchored-constituent (anchored-period) ()
|
j@246
|
222 (:documentation "Base class for anchored constituents"))
|
j@246
|
223
|
j@246
|
224 (defclass standard-constituent (constituent standard-period) ()
|
j@246
|
225 (:documentation "Base class for constituents using standard time
|
j@246
|
226 representation"))
|
j@246
|
227
|
j@246
|
228 (defclass standard-anchored-constituent (anchored-constituent
|
j@246
|
229 standard-anchored-period) ()
|
j@246
|
230 (:documentation "Base class for anchored-constituents using standard
|
j@190
|
231 time representation"))
|
j@190
|
232
|
j@190
|
233 (defclass time-ordered-constituent (constituent list-slot-sequence)
|
j@190
|
234 ;; this won't work if lisp implementation doesn't support extensible
|
j@190
|
235 ;; sequences.
|
j@190
|
236 ())
|
j@237
|
237
|
j@246
|
238 (defclass time-ordered-anchored-constituent (anchored-constituent
|
j@246
|
239 list-slot-sequence)
|
j@190
|
240 ;; this won't work if lisp implementation doesn't support extensible
|
j@190
|
241 ;; sequences.
|
j@190
|
242 ())
|
j@190
|
243
|
j@246
|
244 (defclass standard-time-ordered-constituent
|
j@246
|
245 (time-ordered-constituent standard-constituent)
|
j@246
|
246 ;; this won't work if lisp implementation doesn't support extensible
|
j@246
|
247 ;; sequences.
|
j@246
|
248 ())
|
j@190
|
249
|
j@246
|
250 (defclass standard-time-ordered-anchored-constituent
|
j@246
|
251 (time-ordered-anchored-constituent standard-anchored-constituent)
|
j@246
|
252 ;; this won't work if lisp implementation doesn't support extensible
|
j@246
|
253 ;; sequences.
|
j@246
|
254 ())
|
j@246
|
255
|
j@246
|
256 (defclass composition (time-ordered-anchored-constituent) ()
|
j@246
|
257 (:documentation "Base class for compositions. Compositions are
|
j@246
|
258 assumed to be anchord constituents."))
|
j@246
|
259
|
j@246
|
260 (defclass standard-composition
|
j@246
|
261 (composition standard-time-ordered-anchored-constituent) ()
|
j@246
|
262 (:documentation "Base class for compositions using standard time
|
j@246
|
263 representation. Standard compositions are assumed to be
|
j@246
|
264 anchored."))
|
j@237
|
265
|
j@190
|
266 (defclass monody (composition) ()
|
j@190
|
267 (:documentation "Class for indicating suitability for analysis
|
j@190
|
268 requiring a monody"))
|
j@237
|
269
|
j@190
|
270 (defclass standard-monody (monody standard-composition) ())
|
j@190
|
271
|
j@190
|
272 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
j@190
|
273 ;;
|
j@190
|
274 ;; Experimental:
|
j@190
|
275 ;;
|
j@190
|
276
|
j@190
|
277 (defclass clef (amuse-object) ()
|
j@190
|
278 (:documentation "Abstract class for clef implementations"))
|
j@190
|
279
|
j@190
|
280 (defclass clef-period (clef anchored-period) ()
|
j@190
|
281 (:documentation "Abstract class for clef implementations in time"))
|
j@190
|
282
|
j@190
|
283 (defclass standard-clef (clef)
|
j@190
|
284 ((type :accessor %standard-clef-type
|
j@190
|
285 :initarg :type)
|
j@190
|
286 (line :accessor %standard-clef-line
|
j@190
|
287 :initarg :line)
|
j@190
|
288 (octave-shift :accessor %standard-clef-octave-shift
|
j@190
|
289 :initarg :octave-shift
|
j@190
|
290 :initform nil))
|
j@190
|
291 (:documentation "Class of clef with slots for type (a keyword
|
j@190
|
292 from :F, :G and :C, probably), line (counting from the lowest line =
|
j@190
|
293 1) and octave shift (nil or a positive or negative integer
|
j@190
|
294 representing transposition up or down"))
|
j@190
|
295
|
j@190
|
296 (defclass standard-clef-period (standard-clef clef-period standard-anchored-period)
|
j@190
|
297 ()
|
j@190
|
298 (:documentation "Standard clef on a timeline"))
|