slippery chicken
specialised algorithmic composition software
linked-named-object/tempo [ Classes ]
[ Top ] [ linked-named-object ] [ Classes ]
NAME
tempo File: tempo.lsp Class Hierarchy: named-object -> linked-named-object -> tempo Version: 1.1.0 Project: slippery chicken (algorithmic composition) Purpose: Implementation of the tempo class which holds very simple tempo information, simply the type of beat and the number of beats per minute etc. Author: Michael Edwards: m@michael-edwards.org Creation date: March 11th 2001 $$ Last modified: 11:32:35 Sat Aug 24 2024 CEST SVN ID: $Id$
tempo/make-tempo [ Functions ]
[ Top ] [ tempo ] [ Functions ]
DESCRIPTION
Make a tempo object.
ARGUMENTS
- A number indicating beats per minute. If this is >= 10000 we'll treat the argument as a usecs slot (number of microseconds quarter note) and calcuate the BPM from that. That gives us a maximum BPM of 5999 before we start thinking these are usecs (should be fine).
OPTIONAL ARGUMENTS
keyword arguments: - :beat. Sets the "beat" value of the beats per minute; i.e., 'q (or 4) for "quarter = xx bpm" etc. Default = 4. - :id. Sets the ID of the tempo object. - :description. A text description (string) of the tempo, such as "Allegro con brio" etc.
RETURN VALUE
A tempo object.
EXAMPLE
;; Default beat is a quarter, thus the following makes a tempo object of ;; quarter=60. (make-tempo 60) => TEMPO: bpm: 60, beat: 4, beat-value: 4.0, qtr-dur: 1.0 qtr-bpm: 60.0, usecs: 1000000, description: NIL LINKED-NAMED-OBJECT: previous: NIL, this: NIL, next: NIL NAMED-OBJECT: id: NIL, tag: NIL, data: 60 ;; Set the beat using the :beat keyword argument. Thus, the following makes a ;; tempo object of dotted-quarter = 96. (make-tempo 96 :beat 'q.) ;; Add a text description, which is stored in the tempo object's DESCRIPTION ;; slot. (let ((tt (make-tempo 76 :beat 2 :description "Allegretto"))) (description tt)) => "Allegretto"
SYNOPSIS
(defun make-tempo (bpm &key (beat 4) id description)
tempo/tempo-equal [ Methods ]
DESCRIPTION
Test to determine whether the values of two tempo objects are equal.
ARGUMENTS
- A first tempo object. - A second tempo object.
RETURN VALUE
Returns T if the values of the two tempo objects are equal, otherwise NIL.
EXAMPLE
;; Equal (let ((tt1 (make-tempo 60)) (tt2 (make-tempo 60))) (tempo-equal tt1 tt2)) => T ;; Not equal (let ((tt1 (make-tempo 60)) (tt2 (make-tempo 96))) (tempo-equal tt1 tt2)) => NIL
SYNOPSIS
(defmethod tempo-equal ((t1 tempo) (t2 tempo))