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.0.0-beta1

 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: 15:51:44 Thu May 17 2012 BST

 SVN ID: $Id: tempo.lsp 1767 2012-05-17 14:52:54Z medward2 $

tempo/make-tempo [ Functions ]

[ Top ] [ tempo ] [ Functions ]

FUNCTION

 Make a tempo object.

ARGUMENTS

 - A number indicating beats per minute.

OPTIONAL ARGUMENTS

 - keyword argument :beat. Sets the "beat" value of the beats per minute;
   i.e., 'q (or 4) for "quarter = xx bpm" etc. Default = 4. 
 - keyword argument :id. Sets the ID of the tempo object.
 - keyword argument :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 ]

[ Top ] [ tempo ] [ Methods ]

FUNCTION

 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))