A


Intro       Symbols A B C D E F G H I J K L M N O P Q R S T U V W X Y Z       Index  
accumulation [Pattern]

Enumerates items together with the set of items that have been enumerated so far. The process starts over when all the items have been collected.

Example:

? (setf x (notes c4 d e f g in accumulation))
#<ACCUMULATING-NOTE-STREAM 131656351>

? (read-items x)
(C4 C4 D4 C4 D4 E4 C4 D4 E4 F4 C4 D4 E4 F4 G4)

See Also:

Item Streams

 


algorithm [Class]

An object that computes musical events. Algorithms are created using the algorithm macro.

Slots declared by algorithm:

length {integer}
Sets the number of muscial events the algorithm should compute.
count {integer}
The current event number. Count is "read only" and ranges from 0 to 1-length.
end{number}
Sets the last begin time (in seconds) for musical events.
Additional slots are inherited from container.

See Also:

algorithm [Macro], generator, heap, merge, thread

 


algorithm name type ({slot value}*) {form}* [Macro]

Creates an algorithm object. An algorithm generates musical events of a specified type. name is the name of the algorithm. type is the class of event that the algorithm computes. Following type comes an initialization list containing zero or more slot value pairs. For each pair, slot is the name of a slot in either the algorithm or the musical event, and value is its evaluated initial value. The initialization list is processed once, each time the algorithm is scheduled to begin creating musical events so it is useful for specifying initial states and values that remain constant for all the events generated.

Following the initialization list comes zero or more forms. These forms define the program the algorithm uses to create musical events. Three extensions to standard Common Lisp syntax are supported in program statements:

  1. Slots in the algorithm or musical event may be treated as lexical variables within the scope of the macro:

    (algorithm foo midi-note (length 12 amplitude .1)
      (setf note (item (notes c4 d e f g)))  ; set note slot
      (setf rhythm (between .1 .4))          ; set rhythm slot
      (setf duration rhythm))                ; set duration slot
    
  2. item supports the additional keyword arguments :kill, :chord and :rest. See the entry on item in algorithms.
  3. Item stream forms such as (notes a4 b c) appearing within the scope of a call to item, as in (item (notes a4 b c) :kill t) are replaced at macro expansion time with the item streams they create.

Example:

;;; This algorithm reads 8 periods of an 8 note item stream
;;; to generate 64 midi-notes. each midi-note has a rhythm
;;; and duration of .1 seconds.  Notes are randomly selected
;;; from 1 octave of the C minor scale.  A crescendo is
;;; calculated every 8 events using the algorithm's count
;;; value (how many events have been generated so far) as a
;;; MOD 8 index interpolating between .25 and .75.

(algorithm pulse midi-note (rhythm .1 duration .1)
  (setf note (item (notes c4 d ef f g af bf c5 in random)
                   :kill 8))   ; stops after 8 periods.
  (setf amplitude (interpl (mod count 8) 0 .25 7 .75)))

See Also:

generator, heap, merge, mute, thread, Describing Music Algorithmically, Working with Algorithms in Real-Time

 


amplitude [Item Type]

A logical amplitude value. A logical amplitude is a floating point number 0 <= number <= 1, or a symbol from the set: niente pppp ppp pp p mp mf f ff fff ffff.

See Also:

amplitude [Function], amplitudes

 


amplitude amp &key :loudest :softest :power [Function]

Returns a numeric value for the amplitude amp. :softest is the value to return when the logical amplitude is 0.0, and defaults to *amplitude-minimum*. :loudestis the value to return when the logical amplitude is 1.0, and defaults to *amplitude-maximum*. If the loudest and softest values are both integer then amplitude returns an integer value. :power is the power curve between the softest and loudest value, and defaults to *amplitude-power*. amplitude returns the value:

softest + (loudest - softest) * amp^power.

Example:

? (loop for a to 1 by .25 collect (amplitude a))
(0.0 0.25 0.5 0.75 1.0)

? (loop for a to 1 by .25 collect (amplitude a :power 2))
(0.0 0.0625 0.25 0.5625 1.0)

? (loop for a in '(p mp f ff)
        collect (amplitude a :softest 0 :loudest 127))
(42 56 84 98)

See Also:

amplitude [Item Type], amplitudes, *amplitude-minimum*, *amplitude-maximum*, *amplitude-power*,

 


*amplitude-maximum* [Variable]

The default true maximum amplitude when the logical amplitude is 1.0. If the true maximum and minumum are both integers then amplitude returns integer values. The default maximum is 1.0.

See Also:

amplitude, amplitudes, *amplitude-minimum*, *amplitude-power*

 


*amplitude-minimum* [Variable]

The default true minimum amplitude when the logical amplitude is 0.0. If the true maximum and minumum are both integers then amplitude returns integer values. The default minimum is 0.0.

See Also:

amplitude, amplitudes, *amplitude-maximum*, *amplitude-power*

 


*amplitude-power* [Variable]

The default power curve between logical amplitudes 0.0 and 1.0. The default power is 1.0, which causes a linear rise over the range of amplitudes.

See Also:

amplitude, amplitudes, *amplitude-minimum*, *amplitude-maximum*

 


amplitudes {amp}+ {option value}* [Macro]

Creates an item stream of amplitude values. Each amp may be an amplitude or an item stream.

amplitudes implements the following options:

softest {float | integer}
Sets the minimum return value of the stream when the logical amplitude is 0.0. Defaults to the value of *amplitude-minimum*.
loudest {float | integer}
Sets the maximum return value of the stream when the logical amplitude is 1.0. Defaults to the value of *amplitude-maximum*.
power {float}
Sets the power curve of the stream. Defaults to the value of *amplitude-power*.
An additional set of basic option valuepairs are available in all item stream macros. Others may be available based on the pattern type specified to the macro.

Example:

? (setf x (amplitudes p mf mp fff in random for 8))
#<RANDOM-ITEM-STREAM 136712611>

? (read-items x)
(0.4 0.6 0.9 0.5 0.6 0.6 0.5 0.5)

See Also:

amplitude [Item Type], Item Streams