leipzig.melody

accelerando

(accelerando from to by)
Linearly interpolated change between from and to.
e.g. (->> notes (tempo (accelerando 0 4 3/2))))

after

(after wait notes)
Delay notes by wait.
e.g. (->> melody (after 3))

all

(all k v notes)
Sets a constant value for each note of a melody.
e.g. (->> notes (all :part :drum))

bpm

(bpm beats)
Returns a function that translates a beat number into seconds.
e.g. ((bpm 90) 5)

but

(but start end variation notes)
Replaces part of a melody with another.
e.g. (->> notes (but 2 4 variation))

duration

(duration notes)
Returns the total duration of notes.
e.g. (->> melody duration)

having

(having k values notes)
Zips an arbitrary quality onto a melody.
e.g. (->> (rhythm [1 1/2]) (having :drum [:kick :snare]))

is

Synonym for constantly.
e.g. (->> notes (wherever (comp not :part), :part (is :bass)))

mapthen

(mapthen f & melodies)

phrase

(phrase durations pitches velocities)(phrase durations pitches)
Translates a sequence of durations and pitches into a melody.
nil pitches signify rests, vectors represent clusters, and maps
represent chords. Vector durations represent repeated notes.
e.g. (phrase [1/2 1/2 3/2 3/2] [0 1 nil 4])
(phrase [1 1 2] [4 3 [0 2]])
(phrase [1 [1 2]] [4 3])
(phrase (repeat 4) (map #(-> triad (root %))) [0 3 4 3])

rhythm

(rhythm durations)
Translates a sequence of durations into a rhythm.
e.g. (rhythm [1 1 2])

tempo

(tempo timing notes)
Transform both :time and :duration according to timing.
e.g. (->> notes (tempo (bpm 120)))

then

(then later earlier)
Sequences later after earlier.
e.g. (->> call (then response))

times

(times n notes)
Repeats notes n times.
e.g. (->> bassline (times 4))

Utterable

protocol

members

utter

(utter thing time pitch duration)

where

(where k f notes)
Applies f to the k key of each note in notes, ignoring missing keys.
e.g. (->> notes (where :time (bpm 90)))

wherever

(wherever applies? k f notes)
Applies f to the k key of each note wherever condition? returns true.
e.g. (->> notes (wherever (comp not :part), :part (is :piano))

with

(with [a & other-as :as as] [b & other-bs :as bs])(with as bs & others)
Blends melodies.
e.g. (->> melody (with bass drums))