-
Notifications
You must be signed in to change notification settings - Fork 5
Transformations
Melody transformations alter the parsed melody. Transformations can be used with zplay or zloop.
Transformations can be executed with cycle specific options using using cycle or by using lambdas:
z1 "q 0 1 2 3", cycle: {mod: 2, harmonize: 3 }
z2 "q 3 2 1 0", release:->(i){i%3}, X: :bd_haus, H: :elec_cymbal
Transformations can also be stored to the next cycles of the loop using store: true:
z1 "q 0 1 e 2 3 4 5", store: true, swap:->(i){i}
There are three types of transformations: Order transformations, object transformations and loop transformations. Different types of transformations are run ordered separately.
Order tranformations are always run before object tranformations. These type of transformations alter the whole or part of the melody before any notes are played. There can be multiple order transformations which are run in order from left to right.
Inverses the melody while keeping the chords in place. Use retrograde: true to inverse the whole melody.
Partial melody retrograde: [2,4] where first value is the start index and last valie is the end index.
Splitted melody retrograde: 3 where value is the number of parts the melody is splitted before the reverse.
Reverses melody including the chords.
zplay "0 1 2 3", reverse: true
Rotate the melody
zplay "0 1 2 3 4", rotate: 1
zplay "0 1 2 3 4", rotate: -1
z1 "0 1 2 3 4", store: true, rotate: 1
Swap places of degrees (and notes) in a melody
zplay "0 1 2 3", swap: 1 # Creates 0 1 2 3
zplay "0 1 2 3", swap: [1,3] # Creates 0 1 2 3
z1 "0 1 2 3", store:true, swap: ->(i){i}
Groups the melody using mod
z1 "q 0 1 2 3 4 5 6", division: 2
Creates mirror from the melody
zplay "0 1 2 3", mirror: true
Creates reflection from the melody
zplay "0 1 2 3", reflect: true
Rotates the melody
zplay "0 1 2 3", rotate: 1
zplay "0 1 2 3", rotate: 2
zplay "0 1 2 3", rotate: -1
z1 "0 1 2 3 4", store: true, rotate: 1 # Stores the rotation for the next cycle
Creates subset from the melody
zplay "0 1 2 3 4 5", subset: 3
zplay "0 1 2 3 4 5", subset: 1..2
TBD! Not working.
Object transformations are always run after the order transformations. Ordering of the melody does not affect the result of object transformations (other that some notes might be missing after the order transformations). Object transformations are processed in order form left to right.
Intervallic augmentation will alter the melody by adding intervals to the degrees and parsing new note for that degree.
Example:
z1 "q .0 .0|q0 e1 q.2|2 e1 q2 e3|h.4|e7 7 7 4 4 4 2 2 2 0 0 0|q4 e3 q2 e1|h.0", augment: {
1=>"3",
2=>"#",
3=>->(){rrand_i 1,4},
4=>->(){rrand_i 1,2}
}
Note that augmenting is done by means of intervals, meaning 2=>1 will do nothing (1 = unison).
Harmonizes existing melody by creating chords from degrees using intervals, meaning 1=>1 will do nothing (1 = unison).
zplay "0 2 3 4", harmonize: 3
zplay "-3 -2 -1 0 1 2 3", harmonize: [3,5]
zplay "0 2 3 4", harmonize: [2,"#5","b4"]
zplay "0 2 3 4", harmonize: {1=>3,4=>5}
zplay "0 2 3 4", harmonize: {1=>[3,5],4=>[2,3,4]}
# Harmonize creates chords so you could also play arpeggios from that and invert those chords
zplay "G'e1 2 3' q 9 8 7 6 5 4 3 2 1 0", harmonize: [-3,-5], chord_invert: -2
Adds compound interval to the harmonization, added note is one octave up or down.
zplay "q 9 8 7 6 5 4 3 2 1 0", harmonize: 3, compound: 1
zplay "q 9 8 7 6 5 4 3 2 1 0", harmonize: -3, compound: 1
Flex will multiply or shorten the length of the melody
zplay "q 0 1 2 3"
zplay "q 0 1 2 3", flex: 1
zplay "q 0 1 2 3", flex: -0.5
Changes the note to rest from the given index (0-n)
zplay "q 0 1 2 3", silence: 2
z1 "q 0 1 2 3 4", silence: ->(i){i}
Loop transformations are type of transformations that are only done in loops. These type of transformations are done before order and object transformations.
Phase will force the loop to go out of sync causing the phasing effect when multiple loops are playing.
Example:
z1 "q 0 1 2 3"
z2 "q 0 1 2 3", sync: :z1, phase: 0.1 # Sleeps 0.1 before each cycle
------------------------------------ See more stuff from the menu --------------------------------------->