Skip to content
Miika Alonen edited this page Dec 15, 2022 · 32 revisions

zparse

Parses melody to hash array. Preparsing the melody using zparse is useful if you want to do transformations or play the parsed notes inside live_loop.

use_synth :piano

a = zparse "q 0 2 1 4"

b = a.inverse

c = a.retrograde

d = a.inverse.retrograde

e = a.transpose -3

zplay (a*2+b*2+c*2+d*2+b+e)*2

zplay

Plays ziffers syntax that is by default represented as pitch class integers 0-9.

zplay works with strings, integers and arrays, for example:

zplay 1 # Plays in :c :major
zplay [1,2,3], key: "f", duration: 0.25
zplay "w1 h2 q3"
zplay [[1,1],[2,0.5],[3,0.25]] # Is same as w1 h2 q3
zplay rrand_i(1000, 100000000000000), duration: 0.25 # Integer is parsed as a melody by default
zplay rrand_i(1000, 100000000000000), parse_chord: true # Use parse_chord to parse integer as chord

It can also play samples, use samples as synths and send MIDI out messages. Run examples in buffer to see various ways to use zplay.

Change synths

Change synths using synth parameter or use_synth before the zplay method.

use_synth :blade
zplay "q 0 1 2 3"
zplay "q 0 1 2 3", synth: :chipbass

Envelopes and other synth options

Envelopes for built in synths works just like in Sonic Pi. For most of the synths there are some predefined ADSR values and usually release defaults to 1.0.

Changing envelopes in Ziffers:

zplay "h 0 1 2 3", synth: :blade, attack: 0.25, decay: 0.125, sustain: 0.5, release: 0.125
zplay "h 0 1 2 3", synth: :blade, adsr: [0.25,0.125,0.5,0.125] # Shorthand to do the same thing

Sometimes it might be useful to have ADSR envelope that is relative to the note length. Set relative_adsr to true in that case.

Ziffers.set_default_opts({relative_adsr: true})
zplay "h 0 1 2 3", synth: :blade, release: 1.0

You can also change any other synth parameters in the same way. For all synth options see help in Sonic Pi:

zplay "h 0 1 2 3", synth: :fm
zplay "h 0 1 2 3", synth: :fm, divisor: 100
z1 "h 0 1 2 3", synth: :fm, divisor: tweak(:quint,50,100,10).mirror # Change divisor over time

For tweak and use of other effects see Effects page.

zloop

zloop is just a shorthand for live_loop and can be played with the same parameters. By default ziffers syntax is parsed everytime the loop starts from the beginning. The randomization can be controlled using seed parameter to define the spesific seed for the loop. There are also 20 prefedined loops z0 - z20 which can be used as a shorthand for zloop (Because you always need shorthands for shorthands):

# Play same melody over and over again:
m1 = zparse "q (1..7)~"
z1 m1

# Randomize melody every time loop ends
z2 "q (1..7)~", transpose: -4

To repeat the same melody you can also use parse: true, which will parse the given melody beforehand. Melodies can also be generated using lambdas. Test following examples one by one:

z1 "(1,8)" # Plays random pitches between 1-8
z2 "(1,8)", parse: true # Plays random pitch randomized from between 1-8
z3 rrand_i(1000, 100000000000000), duration: 0.25 # Plays random melody generated from the integer
z4 ->(){rrand_i(1000, 100000000000000)}, duration: 0.25 # Plays random melodies in a loop generated for each run

Other than being short and cool, zloop and z0-20 also work with transformations and rules making it possible to change the melody on the fly.

Example loops:

zloop :bass, "[r D r [D D]]", D: :bass_woodsy_c
zloop :beat, "[B H [B B] H]", B: :drum_bass_soft, H: :drum_cymbal_closed, sync: :bass

is equivalent to:

live_loop :beat do
  zplay "[r D r [D D]]", D: :bass_woodsy_c
end

live_loop :beat, sync: :beat do
  zplay "[B H [B B] H]", B: :drum_bass_soft, H: :drum_cymbal_closed
end

Creating randomizing loop with seed:

zloop :rnd, "q [1324,2435,4657] e (1..8)~", seed: 1, parse_chords: false

Loops can be stopped by commenting out the content like:

zloop :foo, "//4 3 2 1"

Alternatively loop can be stopped using stop:

z1 "q 4 3 2 1", stop: true # Stops the loop
z2 "q 4 3 2 1", stop: 3 # Plays 3 times then stops the loop

It is also possible to use predefined mapping with use parameter and predefined loops z0-z20.

Example

s = { B: :bd_fat, H: :drum_cymbal_closed, C: :bass_voxy_hit_c } # Predefined sample mappings

zloop :beat, "q B H [B B] H", use: s # Named loop

z1 "q B H [B B] H", use: s # Predefined loop :z1

z2 "[r [C C] r [C C] ]", use: s # Predefined loop :z2


Sync, cue and wait

Ziffers loops can be controlled using cue, sync and wait. Loops can be synced manually or automatically.

Automatic sync:

z0 "w 0" # All loops sync to z0 automatically
z1 "q 1 2 3 4"
z2 "q 3 r 5 r", transpose: -7, synth: :fm, sync: :z1

Manual sync:

z1 "q 1 2 3 4"
z2 "q 3 r 5 r", transpose: -7, synth: :fm, sync: :z1
z3 "| h [BH r H] [H r BH] | [BS H S] [HB r [H H]] |", B: :drum_bass_hard, H: :drum_cymbal_closed, S: :drum_snare_soft, sync: :z1

Cues can be assingned with characters assignation in the middle of the melody. This way other loops may wait for the cues and only play partial melody and wait for the next cue:

z1 "q 1 3 2 4 C 4 3 2 1 4 3 2 1", C: {cue: :foo}
z2 "q 6 6 6 6", wait: :foo

Cues and wait can also be used to create perpentual canons for example the classic canonized version of Frere Jacques could be implemented as follows:

fr = zparse "[:q 0 1 2 0:] A [:q 2 3 h4:] B [: [:e 4 5 4 3 q 2 0:] [:q 0 _4 h0:] :] C", synth: :piano, A: {cue: :canon2}, B: {cue: :canon3}, C: {cue: :canon4}

z1 fr
z2 fr, wait: :canon2
z3 fr, wait: :canon3
z4 fr, wait: :canon4

MIDI out for virtual or external synths and keyboards

Use port / p and channel / c parameters to play external keyboards or virtual synths. Send chord notes to different channels using chord_channel.

zplay "(123..456)~", scale: :hex_sus, port: "loopmidi", channel: 3
z1 "0 1 2", port: "loopmidi", channel: [0,1] # Send each cycle to different channels
z1 "0 1 2", port: "loopmidi", channel: [0,1].ring # Send each pitch to different channels
z1 "026 3", port: "loopmidi", chord_channel: [1,2,3] # Send chord notes to different channels

Default port and some shorthands (c=channel, p=port) can also be used:

port "loopmidi" # Define default port
channel: 1

z1 "3 4 2" # Use default port and channel
z2 "4 6 8", c: 2, p: "usb_midi" # Override default port and channel

Velocity can be controlled using vel with values 0-127 or vel_f between 0.0-1.0.

Values can be modulated for each loop (with arrays) or for each value (using rings), for example:

z1 "1 3 2", vel: [20,40,90]
z2 "3 2 4", vel_f: [0.1,0.4,1.0].ring
z3 "q 1 3 2 4", c: 2, vel: (range 20,120, step:30)
z4"q (1..7)?3+(0 1)", c: 2, vel_f: tweak(:quint,1.0,0.1,15).ring.mirror

MIDI CC messages

To parse and send CC messages in separate threads use parse_cc method:

z1 "30 60 50", parse_cc: 28, port: "loopmidi", channel: 1 # Sends 30 60 50 as MIDI CC messages

CC messages can be sent at the same time with the notes using cc and value or mapping:

z2 "0 1 2 3 4", port: "usb_midi_2", channel: 3, cc: 28, value: 30 # Send CC 28,30 just before midi is sent
z2 "0 1 2 3 4", port: "usb_midi_2", channel: 3, cc: 28, mapping: {0=>20} # Send CC 28,20 when pc 0 is sent as midi

Automate CC messages

Midi CC messages can be automated using learn. Just turn some knobs on your synth, check out log for right port and channel, write ports and channel to the automate command and wiggle those knobs.

Automate records CC messages and sends those back automatically:

learn knob: "cutoff", port_in: "2-_virus_ti_synth_5", port_out: "2-_virus_ti_synth_6", channel: 6, length: 5, stop: false

Multi channel mode

Multi channel mode is a fast way of controlling drum synths. Using multi parameter pitch classes are interpreted as midi channels.

Basic usage:

z1 "q 1 [2 3]", multi: true # Notes default to 60

Array mapping for notes:

z1 "q 1 [2 3]", multi: [60,70] # Notes map to array index

Hash mapping for notes:

z1 "q 1 [2 3]", multi: {1=>60,2=>70} # Notes hash mapping

Lambdas can also be used to calculate the note on the fly:

z1 "q 4 [2 3]", multi: {4=>->(){rrand_i 60,70},2=>70}

Drum pattern mapping

Drum patterns can also be sent to external synths using MIDI mapping for control characters:

z1 "q (X)<4,7>(H)", port: "usb_midi_2", use: {:X=>{note: 60, channel: 1 }, :H=>{note: 62, channel: 2 }} # Send midi notes to different channels

z2 "h r H q X X h H", port: "usb_midi_2", cc: 26, use: {:X=>{value: 120, note: 60, channel: 3 }, :H=>{cc: 27, value: ->(){rrand_i 50, 90}, note: 62, channel: 1 }} # Send midi notes and CC messages to different channels

Pitch mappings

Midi notes can be mapped to pitches in some drum or modular synthetizers, for example Korg volca drum:

z2 "(1..6)~", port: "usb_midi_2", channel: 3, cc: 28, mapping: :volca_korg # Map midi notes to korg volca pitch

New mappings can be tested as array. Each value in array representes hz value and index represents CC value. Theres should be 255 values in the array ... or 127 if that CC supports only values up to 127.

z3 "0 1 2 3 4", port: "usb_midi_2", channel: 3, midi_to_cc: 28, mapping: [20.4,50.4,30.1,50.4,100.3] # ... and so on.

Consider committing new mappings to the github for ease of use.

Parse and play as midi notes

Plays midi notes using space separated midi notation:

zplay "[: q 53 53 53 57 h 60 q 53 53 <(h 55 q 60 60 h 57 q 53 53) (q 55 55 57 55 w 53)> :]", midi: true, synth: :piano

Parse degrees from note names

You can also use note names to parse melody to ziffers. In order to use note names you have to use decimal notation or list notation to define note durations.

Use zplay with note names by defining the parsekey. These two play exactly same melody:

zplay "[: 0.25 c d e c:][: 0.25 e f 0.5 g:] [: [:0.125 g a g f 0.25 e c:] [: 0.25 c _g 0.5 c:] :]", parsekey: :c, key: :e
zplay "[: [c d e c] :] [: [[e f] g] :] [: [: [[g a][g f] e c] :][: [[c _g] c] :] :]", parsekey: :c, key: :g
zplay "bb b #b", parsekey: :c, key: :c # Sharps and flats: bb b #b => b6 6 #6

Calling methods

Methods can be called with zplay using :method_name syntax. Methods calls are timed just as any other sample or play events.

Example:

define :foo do
  sample :perc_impact1
end

define :bar do |*p|
  sample :drum_cymbal_closed, amp: p[0]
end

zplay "[: q 0 :foo :bar(2) :3] 7"

Comments

Textual notes can be included using <! ... > syntax.

Example:

zplay "| 2 3 |q <! This is a comment > # 2 | e 4 2 |" # Comment can include notation or text
zplay "|q 2 3 <! | q 1 2 > |  e 4 2 |" # Skips commented measure

Hash notation for options

Ziffers melody options can also be changed using hash notation {key: val}. Ziffers notation is parsed to array of hashes containing the parsed pitch classes and resolved notes.

Hash notation is applied to all pitches that comes after the hash. Alternatively given options can also be applied to list of notes using list notation {key: val}(1..3)

Examples:

parsed = zparse "1"
print parsed # Parsed and resolved melody

parsed = zparse "{duration: 0.25} 1"
print parsed # Parsed melody with changed note duration

parsed = zparse "{amp:2.5} {amp:3.0}(1 2) 3" # List notation applies to only those values in the list
print parsed.vals(:amp)

a = zparse "h q(1 2) 3" # Works also with note durations
print parsed.durations

Multistaff syntax: ziff & ziffers

ziff method is the ultimate playground for fooling around with multiple simultanious melodies. ziffers method does the same and also loops the content indefinitely.

/ symbol denotes a parameter sequence which is parsed to a Hash object which is then passed to a thread populated from the given row. Parameters can include any ziffers parameter including samples, transformations, rhythm, rules etc. etc.

Examples (Christmas edition):

# Plays the rows as separate tracks
ziff "
/ synth: :pretty_bell
[:q 2 2 2 4 q. 4 e 3 h 2 q 2 1 2 4 q. 2 e 1 h 0 :] [: 4 e 5 4 3 2 h 3 e 4 3 2 1 h 2 e 3 2 1 0 q. 1 e _ 4 h 4 q ^ 0 1 2 3 h 2 1 :]
[: q 0 0 _ 6 6 ^ 1 _ 6 h ^ 0 q 0 _ 6 ^ 0 0 0 _ 6 h ^ 0 :] [: q 0 e 2 1 h 0 q 0 e 1 0 h _ 6 q 6 e ^ 0 _ 6 h 5 q. 4 e 4 h 4 q 4 6 ^ 0 0 h 0 _ 6 :]
[: q 4 4 4 4 5 4 h 4 q 4 4 4 4 q. 4 e 3 h 2  :] [: h 2 5 5 4 4 3 q 1 0 h _ 6 q 6 ^ 4 4 5 h 4 4 :] / octave: -1,
[: q 0 0 2 2 1 _ 4 h ^ 0 q 0 _ 4 ^ 0 _ 2 4 4 h ^ 0 :] [: h 0 q _ 5 ^ 0 h 1 q _ 4 6 h ^ 0 q _ 3 5 6 r 4 r 2 4 r 3 h 0 4 :] / octave: -1
"

Samples can be combines as well as any other ziffers syntax:

ziff "
/ synth: :kalimba
h H X / X: :bd_808, H: {sample: :drum_cowbell, amp: 0.025}
h0 h. 2 q 2 h 1 0 3 3 2 1 2 4 4 #3 w. 4 h 2 h. 5 q 4 h 3 2 1 0 _6 2 1 0 0 _6 w. 0 / octave: 1
h4 h. ^ 0 q 0 h _ 6 5 q 5 6 ^ 0 1 h 0 _ 6 4 q 6 ^ 0 h 1 1 _6 1 0 0 h. 0 q 0 h 0 0 _ 1 q 2 3 h 4 4 6 5 5 4 w. 4
h2 h. 4 q 4 h 4 q 5 4 h 3 5 4 4 2 q 4 5 h 5 5 4 6 5 4 h. 3 q 4 h 3 4 _6 0 1 2 q 4 3 h 2 3 q 4 3 w. 2
h0 q 0 _ 6 h 5 4 5 3 q 5 6 h ^0 4 ^ 0 0 1 1 w. _4 h 0 h. _ 3 q 3 h 1 q 2 3 h 4 5 4 ^0 4 5 3 4 w. ^ 0
"

Long pieces can be positioned on different lines using line breaks \ (Ruby multiline operator and not part of ziffers syntax):

ziff "
/ synth: :piano
|[: q 2 2 1 0  | h _ 6 5  | q 2 2 #3 #4  | h 5 #4  | q 5 ^ 0 q. _ 6 e 5  | w 5 :] | \
| q 2 2 3 2  | q. 1 e 0 h 0  | q 2 #3 4 2  | q 5 4 h #3  | h 2 q 2 2  | q 1 0 h _ 6  | w _ 5  |

/ synth: :blade
|[: q 0 e 0 _ 6 q 5 5  | q _ 5 #4 h 2  | q _ 5 5 5 6  | q _ 5 6 h 6  | q _ 5 ^ 2 h 1  | w 0 :] | \
| q _ 5 6 5 5  | h _ 6 5  | q _ 5 5 e 6 5 q 4  | q 0 _ 6 h 5  | h _ 4 q 5 5  | q _ 5 5 5 #4  | w _ 2  |

/ synth: :kalimba
|[: q _ 5 4 3 2  | q _ 3 e 2 1 h 0  | e _ 0 1 q 2 e 1 2 q 3  | q _ 2 3 h 2  | q _ 2 5 h #4  | w _ 2 :] | \
| q _ 0 1 0 e 0 1  | h _ 2 2  | q _ 0 0 1 e 0 1  | q _ 2 2 1 0  | h __ 6 e ^ 0 1 q 2  | q _ 1 2 3 e 2 1  | w _ 0  |

/ synth: :pluck
|[: e __ 5 6 q ^ 0 e _ 3 4 q 5  | q __ 1 2 h 5  | e __ 5 6 q ^ 0 1 1  | q _ #0 #1 h 2  | e _ 0 _ 6 q 5 ^ 2 _ 2  | w __ 5 :] | \
| q __ 5 #4 5 5  | h __ 4 5  | q __ 5 5 4 0  | q __ 0 0 h 1  | h __ 2 e 5 6 q ^ 0  | e __ 3 4 q 5 1 3  | w ___ 5  |
"

Parameters can also be randomized using random (n,n) or random sequence syntax (n..n). Sequences can be mirrored using %.

Example:

ziffers "
/ bpm: 30
q (0..3)~ / release: (0.1,1.0)
q 0 1 2 3 / release: (0.1..1.0)
q 5 2 7 3 / amp: (0.1..0.5)%
"

Tracker syntax

Tracker syntax plays the measures in parallel and waits until all the measures in the row are finished. Bars (|) are used to separate the tracks.

Example:

ztracker "
/ synth: :piano, bpm: 30
w r  | s 0 _ 2 1 2 0 2 1 2 ^ 0 _ 2 1 2 0 2 1 2  | e ___ 5 ^ 2 5 2 _ 5 ^ 2 5 2
w r  | s 0 _ 3 2 3 0 3 2 3 ^ 0 _ 3 2 3 0 3 2 3  | e ___ 1 5 ^ 1 _ 5 1 5 ^ 1 _ 5
w r  | s _ 6 1 0 1 _ 6 ^ 1 0 1 6 1 0 1 _ 6 ^ 1 0 1  | e ___ 4 ^ 1 4 1 _ 4 ^ 1 4 1
w r  | s _ 6 2 1 2 0 2 1 2 6 2 1 2 0 2 1 2  | e __ 0 4 ^ 0 _ 4 0 4 ^ 0 _ 4
w r  | s _ 5 3 2 3 0 3 2 3 5 3 2 3 0 3 2 3  | e ___ 3 ^ 0 3 0 _ 3 ^ 0 3 0
w r  | s _ 6 3 2 3 1 3 2 3 6 3 2 3 1 3 2 3  | e ___ 6 ^ 3 6 3 _ 6 ^ 3 6 3
w r  | s _ 6 5 #4 5 2 5 #4 5 6 5 #4 5 2 5 #4 5  | e ___ 2 6 ^ 2 _ 6 2 6 ^ 2 _ 6
w r  | s 0 _ 5 #4 5 2 5 #4 5 ^ 0 _ 5 #4 5 6 5 #4 5  | e ___ 5 ^ 2 5 2 _ 5 ^ 2 5 2
w r  | s 0 _ 2 1 2 0 2 1 2 ^ 0 _ 2 1 2 0 2 1 2  | e. ___ 5 s ^^ 0 e _ 6 ^ 0 e. __ 5 s ^^ 0 e _ 6 ^ 0
w r  | s 0 _ 3 2 3 0 3 2 3 ^ 0 _ 3 2 3 0 3 2 3  | e. ___ 1 s ^ 3 e 2 3 e. _ 1 s ^ 3 e 2 3
w r  | s _ 6 1 0 1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r  | w _0_5  | w ___5__2
"

Tracker syntax can also be used to call methods from Sonic Pi:

Example:

define :b do |*p|
  sample :bd_boom, amp: p[0]
end

define :h do |*p|
  sample :drum_cymbal_closed, amp: p[0]
end

define :z do |*p|
  sample :drum_snare_soft, amp: p[0]
end


ztracker "
q :b        | q :h
e :b(5.0)   |
[:b,:z(3)] | q :h
q :b        | q :h(0.5)
"
Clone this wiki locally