Mercurial > hg > amuse
view base/classes.lisp @ 88:8ea75cc8bc2c
Basic geerdes functionality moved to implementations/geerdes from separate package
darcs-hash:20070720161242-f76cc-fd256cbbb81d8c418a6c7c45844264184c5ed932.gz
author | David Lewis <d.lewis@gold.ac.uk> |
---|---|
date | Fri, 20 Jul 2007 17:12:42 +0100 |
parents | 4e1538df0d10 |
children | 0b4c624910f1 |
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 (time-ordered-constituent) ()) ;; types of information-specifiers (defclass identifier () ()) ;; for composition specification (defclass moment-designator () ()) (defclass period-designator () ()) (defclass anchored-period-designator (moment-designator period-designator) ()) (defclass pitch-designator () ()) (defclass pitch-interval-designator () ()) ;; time-related classes (defclass moment (moment-designator) ((time :accessor %moment-time :initarg :time))) (defclass period (period-designator) ((interval :accessor %period-interval :initarg :interval))) (defclass floating-period (period) ()) (defclass anchored-period (period moment anchored-period-designator) ()) ;; pitch-related classes (defclass frequency () ()) (defclass pitch (pitch-designator) ()) (defclass chromatic-pitch (pitch) ((number :accessor %chromatic-pitch-number :initarg :number))) (defclass diatonic-pitch (pitch) ((name :accessor %diatonic-pitch-name :initarg :name) (accidental :accessor %diatonic-pitch-accidental :initarg :accidental) (octave :accessor %diatonic-pitch-octave :initarg :octave)) (:documentation "NAME is an integer between 0-6, representing the note name A-G; ACCIDENTAL is an integer where negative values indicate numbers of flats, 0 indicates natural and positive values indicate numbers of sharps; and octave is an integer indicating the ASA octave number (the lowest full octave of the piano starting with C is octave 1, so the lowest note on the piano is A0; middle C is C4, and the note just below it is B3).")) (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)))