#i[p[d]]({item}+ {option value}*) | [Read Macro] |
Provides a short hand for item stream definition. Pattern and stream types are specified using two optional characters p and d. P determines the pattern of the stream. If p is omitted, then it defaults to a cyclic item stream. If p is supplied, then d determines the type of the stream. If d is not supplied the stream type defaults to items.
P D c cycle n notes r random r rhythms h heap p pitchs g graph d degrees s sequence i intervals a accumulation s steps p palindrome a amplitudes f function f pathnames o rotation w rewrite
Example:
? #i(a b c) #<CYCLIC-ITEM-STREAM 131425111> ? #ir(a b c) #<RANDOM-ITEM-STREAM 131426721> ? #ihn(a3 b c for 10) #<HEAP-NOTE-STREAM 131460011> ? #irr(q (w weight .2) e for 10) #<RANDOM-RHYTHM-STREAM 131440761>
See Also:
Item Streamsidsel {{id | (id+)} stream}+ | [Macro] |
Creates an id selection table for implementing higher order Markov processes using the graph pattern. In higher order Markov, the probability of the next choice is based on the current node and zero or more previous choices, represented as zero or more previous node ids. The transition table is specified as a sequence of id stream pairs. id can be a single identifier or a list of previous identifiers. Stream is the probability item stream to use if that id matches the actual previous ids that were chosen. For example, the declaration of a node for some item B in a 2nd order Markov graph might look like:
(B to (idsel a (items a b c in random) b (items (a weight 4) b in random)> c a)))which corresponds to the transition table:
Previous A B C Current B B B Next A .333 .80 1.0 B .333 .20 0.0 C .333 .00 0.0idsel uses pattern matching to find previous ids in the selection table. Previous ids are matched with each candidate id entry in the table according two rules: (1) matching occurs for the length of id, which may be less than the previous number of choices. If every candidate id matches its corresponding id in the previous choices, then that probability stream is selected. This allows multiple entries in a table to be collapsed to a single selection. (2) A * at any position in id matches the corresponding previous choice, no matter what it was. For example, the following two selection tables are equivalent:
(idsel a (items a b c d in random) b (items (a weight 4) c d in random) c (items a b c d in random) d (items a b c d in random)) (idsel b (items (a weight 4) c d in random) * (items a b c d in random))
Example:
;; this second order markov graph generates random ;; rhythms that maintain a quarter note pulse (tobias kunze) (rhythms (h to (items e e. q q. q.. h in random)) (q.. to s) (q. to (items e s in random)) (q to (items e e. q q. q.. h in random)) (e. to s) (e to (idsel e (items s e e. q q. q.. h in random) * e)) (s to (idsel e s q. s q e. h e. * (items e e. q q. q.. h in random))) in graph for 20 previous (q)))
See Also:
graph, markov.cmin-scale name | [Function] |
Sets the musical scale named name as the default scale for resolving scale references in.
See Also:
defscale, *standard-scale*in-syntax name | [Function] |
Sets the current score syntax to the syntax named name. An in-syntax statment can be placed at the beginning of a .cm archive file to establish the proper syntax when the file is loaded or evaluated.
Example:
? (in-syntax :midi) #<Syntax: MIDI>
in-tempo tempo &optional beat | [Function] |
Sets the default global tempo to the metronome value tempo. beat is a logical rhythmic value defining the pulse and defaults to q, or quarter note.
Example:
? (in-tempo 120 'q.) 180.0
See Also:
clock-mode, rhythms, tempo, *standard-tempo*interp x env &key :scale :offset :return-type | [Function] |
Returns the interpolated y value of x in env with optional :scale and :offset values applied: f(x)*scale+offset. The type of the value returned normally depends on the type of the arguments specified to the function. Use :return-type to force the return value to be a specific type, either float, integer or ratio. float may also be specified as a list (float digits) in which case the floating point return value will be rounded to digitnumber of places.
Example:
? (interp 50 '(0 0 100 1) :scale 2 :offset 3) 4.0
See Also:
interpl, interpolation, lookupinterpl x &rest coords | [Function] |
Returns the interpolated y value of x in coords. Coords is a sequence of x y coordinates.
Example:
? (interpl 75 0 0 50 .5 100 0) .25
See Also:
interp, lookupinterpolation &rest coords | [Macro] |
Creates an interpolation envelope out of coords, a sequence of x y coordinate pairs.
Example:
? (setf x (interpolation 0 0 50 .5 100 0)) (0 0 50 0.5 100 0) (interp 75 x) 0.25
See Also:
interp, interpl, lookupintervals {interval}+ {option value}* | [Macro] |
Creates an item stream of intervals, or relative scale positions. Each interval may be an integer or an item stream. The stream may be coerced to return absolute note, degree or pitch references.
intervals implements the following {option value} pairs:
Example:
? (setf x (intervals 1 2 3 in random from 'c4 returning note)) #<RANDOM-INTERVAL-STREAM 136751211> ? (read-items x 8) (CS4 D4 DS4 D4 DS4 D4 DS4 D4) ? (setf x (notes (notes c3 c4 for 1 named 'foo)> (intervals 1 2 linked-to #@foo))) #<CYCLIC-NOTE-STREAM 137175041> ? (read-items x) (C3 CS3 D3) ? (read-items x) (C4 CS4 D4)
See Also:
Item Streamsinvert reference note &optional scale | [Function] |
Inverts reference around note in scale. Reference may be a note, pitch, degree or list of the same. If reference is a list and note is nil, then the list of refernences is inverted such that it occupies the same range as the original. Scale defaults to *standard-scale*.
Example:
(invert 'ef4 'c4) A3
See Also:
degree, note, pitch, transposeitem stream | [Function] |
item stream &key :kill :chord :rest | [Function] |
Returns two values, the next item from the item stream stream and the state of the stream after the item was read. As with all multiple values in Lisp, this second value may be ignored.
Within an algorithm macro, item supports the additional keyword arguments :kill, :chord and :rest which have the following meaning:
Example:
? (setf x (items foo bar)) #<CYCLIC-ITEM-STREAM 133134441> ? (item x) FOO NIL ? (item x) BAR :END-OF-PERIOD
See Also:
doitems, Item Streams, read-itemsItem Streams | |
Item Streams are objects that organize typed data into patterns.
Each type of data has its own macro for creating the appropriate class of item stream:
Each item stream macro can implement any of the following pattern types:
Once an item stream has been created, successive items can be read from the stream using one of the accessing functions:
A number of macros use item streams to implement specific facilities:
See Also:
Introduction to Item Streams, items.cmitems {item}+ {option value}* | [Macro] |
Creates an item stream of untyped data. Each item may be a Lisp object or an item stream.
items implements the following option value pairs. These pairs are available in all item stream macros:
Example:
? (setf x (items 1 two 3 four in heap)) #<HEAP-ITEM-STREAM 133137601> ? (read-items x) (3 FOUR 1 TWO)
See Also:
Item Streams