Ziffers 2 cheatsheet

Ziffers 2 is now beta meaning no more breaking syntax changes for generative notation. Basic syntax has been stable for some time but generative part has evolved a lot during past few months.

Fast way to find out whats new in Ziffers is to read Ziffers cheatsheet. Thanks goes to @Bubo for the idea and helping out.

One other interesting thing might also be Musescore export plugin for Ziffers. It’s pretty straightforward way to transform existing midi’s or sheet music to Ziffers format to fool around with.


This is some significant work - congrats!

I’d love to know a bit more about the background and goals of Ziffers. I’d especially love to hear more about the usecases for the generators, enumerators and pc classes. These all look really interesting and I’d love to know how Ziffers is leveraging them.

1 Like

Thanks Sam!

Short history of Ziffers is going from “I have no idea what i am doing” to “I sort know what i would like and having fun while experimenting” during ~5 years.

One of the first goals (meaning i sort of knew what i would like) was to make minimalistic numerical notation that enables live coder to improvise meaningful melodic sequences on the fly. I think this is accomplished but it requires some practice for sure. If you can hum a melody and imagine those as integers you are good to go. Then you just have to pick key and a scale and maybe find one you like. For rhythm you have to know bit more syntax to get what you want, for example:

0 4 2 6 4 1 # Imagined melody
0 4 [2 6] [4 1] # Rhythm as subdivision
0 4 h 2 6 4 1 # Rhyhm as "standard" note durations
zplay "h 0 4 q 2 6 4 1", key: :d, scale: :minor # Ziffers realization with a key and scale
z1 "h 0 4 q 2 6 4 1", key: :d, scale: :minor, add: [0,-2,-1,3] # Realization as a loop & transformations

I did not mean to create my own “sublanguage” for Sonic Pi, but minimalist in me forced me to do it :slight_smile: … but you can always use Ziffers as a way to parse melodies to data and code everything else yourself if you want:

melody = zparse "h 0 4 q 2 6 4 1", key: :d, scale: :minor
print melody # Nice data format for the melody

I wanted an easy way to evolve the melodies and that was the main reason creating my own methods for looping, transforming and adding effects. The end result is that you can create complete live compositions using Ziffers.

There is also a long history in using numerical notation, musical set theory, musical analysis, mathematical transformations and use of number sequences to compose music. Some things i have reinvented and some picked up somewhere along the way.

The most recent goal i’v been working on for the last year has been to implement notation for generative music. So instead of coding all generative things, you would have a simple notation for some of it. Simple here is also bit relative as it goes from simple to complex as soon as you start doing list operations and recursion.

z1 "h 0 2 [q 3 2, h5] 4 [h2, q 3 1]", synth: :piano # Simple semirandom melody
z1 "q 0 (5,7) 2 (4,6)", synth: :piano # Another simple semirandom melody
z1 "h 0 2 (1,(3,6)) [2 3,[1 2,3 (2,4)]]" # Gaining complexity with recursion
z1 "h (0..3*[1,2,4])~+(0 2 6 1)" # Using lists to make things complex
z1 "h ((1..7)*(2 4 1))%7+(: (1,6) :4)" # Making totally random yet interesting things
z1 "h {%>0.5?(1..4*[2,4,6]):(1..4*3)}" # Conditional statements are also fun
z1 "q (1..7){x%2==0?x-(1,3):x+(2,4)}" # Or conditional functions doing random things

… and that rabbithole goes deep :slight_smile:

Use of enumerators is bit of a sidetrack but related to my passion for math and integer sequences. One of my hobbies is to get lost in online encyclopedia of integer sequences to find musically interesting sequences. Those sequences (like pi, recaman, noergaard …) are usually easiest to implement as enumerators that can be used to compose infinite music by combining the melody (integers as pitch classes in a certain scale) with some rhythmic elements.

Enumerators seemed like a good way to organize other types of recurring sequences as well, like integers generated with markov chains or cellular automatons. Ziffers can play any integer or a sequence in a given scale, so given an enumerator ziffers just keeps asking for more until the end of time or computer crashes :slight_smile:

While experimenting with things i’v come across many interesting topics and examples here in these forums and github, so thanks you all sharing ideas, especially @Bubo, @enkerli, @Nechoj, @blipson, @mlange, @emlyn, @perpetual_monday, @robin.newman, @d0lfyn for many interesting conversations and feedback.


On pitch-class sets and set theory…

Last Summer, I got into a rabbithole about PC sets. My own goal had to do with finding chords which fit my “noodling scale”. So, basically, an application of “combinatorial music theory”.
Was playing with those ideas in a café when the barista (a friend’s son who was in the music program at McGill University) led me to PC set notation…
…which sounded a lot like Sonic Pi.
Some of that relates to minimalistic generative @amiika.

What’s funny about this is that I’m also into microtuning, while PC sets epitomize 12TET. Yet nothing prevents us from building PCS tools which work with numbers different from 12 (for the EDO side) or tune each pitch class through some form of Just Intonation.

Eventually, I want to apply both Set Theory and JI in the same semi-generative practice.

lilypond notation seems to have interesting constructions for sequences of notes, chords and their respective durations (+graphical/lyrics/staff directives that can be skipped of course).
File format itself seems (relatively) simple to parse.

I have considered this. The issue is that Lilypond is a useful program designed to engrave music, not to write music. However, some well-defined subset of the text input might be useful to input notes. The notation listed in Lilypond’s “Supported notation for MIDI” might be a good place to start if you want to work on it.

Yes, its a very nice notation. There’s also plenty of others note name based notations which are more focused on algorithmic composition like alda.io or miti. Ziffers is a bit of a oddball and focuses on numerical notation, but it’s also possible to parse note names to numbers using Ziffers.

1 Like