Mercurial > hg > amuse
view base/classes.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 | ad9cca28fecf |
children | b445959f4cc1 |
line wrap: on
line source
(cl:in-package #:amuse) ;; collections of more than one event (defclass constituent (anchored-period) ()) (defclass time-ordered-constituent (constituent list-slot-sequence) ;; this won't work if lisp implementation doesn't support extensible ;; sequences. ()) (defclass composition (time-ordered-constituent) ()) (defclass monody (composition) ()) ;; types of information-specifiers (defclass identifier () ()) ;; for composition specification (defclass moment-designator () () (:documentation "Object indicating a point in time")) (defclass period-designator () () (:documentation "Object indicating a region of time")) (defclass anchored-period-designator (moment-designator period-designator) () (:documentation "Object indicating a region of time starting at a specific point in time")) (defclass pitch-designator () () (:documentation "Object indicating some sort of pitch")) (defclass pitch-interval-designator () () (:documentation "Object indicating a distance in pitch space")) ;; time-related classes (defclass moment (moment-designator) ((time :accessor %moment-time :initarg :time)) (:documentation "A moment represented on a number line")) (defclass period (period-designator) ((interval :accessor %period-interval :initarg :interval)) (:documentation "A number-line-based period")) (defclass floating-period (period) () (:documentation "A simple numeric period")) (defclass anchored-period (period moment anchored-period-designator) () (:documentation "Number-line-based anchored period")) ;; pitch-related classes (defclass frequency () ()) (defclass pitch (pitch-designator) ()) (defclass chromatic-pitch (pitch) ((number :accessor %chromatic-pitch-number :initarg :number)) (:documentation "A pitch represented as a number, with higher values representing high pitches.")) (defclass mips-pitch (pitch) ((cp :initarg :cp :accessor %p-pc) (mp :initarg :mp :accessor %p-pm)) (:documentation "A MIPS pitch: cp is an integer representing chromatic pitch (An0 = 0, middle C = 39); mp is an integer representing the morphetic pitch (An0 = 0, middle c = 23).")) (defclass pitch-interval (pitch-interval-designator) ((span :accessor %pitch-interval-span :initarg :span))) ;; events (defclass event (anchored-period) ()) (defclass pitched-event (event pitch-designator) ()) (defclass chromatic-pitched-event (pitched-event chromatic-pitch) ()) (defclass percussive-event (event) ()) ;;; Range-based `constituents' ;; Whilst these are all constituents in the CHARM sense, their ;; properties apply to a timed range rather than to a set of ;; events. As such, they can be regarded as anchored-periods with ;; properties. (defclass time-signature (anchored-period) ()) (defclass basic-time-signature (time-signature) ;; N.B. Can only deal with numeric signatures ((numerator :accessor %basic-time-signature-numerator :initarg :numerator) (denominator :accessor %basic-time-signature-denominator :initarg :denominator))) (defclass key-signature (anchored-period) ()) (defclass basic-key-signature (key-signature) ;; Only has line-of-fifths distance from c, so custom signatures ;; won't work ((sharp-count :accessor %basic-key-signature-sharp-count :initarg :sharp-count))) (defclass midi-key-signature (basic-key-signature) ;; mode: 0 = major key; 1 = minor key ((mode :accessor %midi-key-signature-mode :initarg :mode))) (defmethod print-object ((mks midi-key-signature) stream) (format stream "#<~A ~A ~A>" (symbol-name (class-name (class-of mks))) (%basic-key-signature-sharp-count mks) (%midi-key-signature-mode mks))) (defclass tempo (anchored-period) ;; accel and rit in symbolic encoding will need other structures, as ;; will textual tempo markings. ((bpm :accessor %tempo-bpm :initarg :bpm)))