Ziffers - Numbered musical notation

Hi all!

I wanted to share my new project called “Ziffers”: https://github.com/amiika/ziffers

It is a new notation and parser for Sonic Pi that can be used to write, parse and play compact melodies. Its inspired by numbered musical notation. Basic syntax is composed of degree numbers 1 - 7 and lower letters w, h, q meaning w=whole, h=half, q=quarter … etc.

For example “Bluebird song” can be played using Ziffers function:

zplay q5353 5653 4242 4542 5353 5653 w5 q5432 w1

There is also support for repeats “:”, numbered repeats “;” and randomization using “?” character for random degrees or “(1,4)” for random between or “[1,3]” and “[1?3,232,4??]” to choose degrees from array. There’s also some support for synth based drum sounds, binaural effects and midi in/out.

Playing degrees using integer and integer arrays are supported:

zplay 3, key: :c, scale: :major
zplay [1,3,4,3], key: “D”, scale: “major”
zplay [[1,3,4,3],[0.25,0.25,1,1]], key: 70, scale: :minor

Ziffers parses strings and arrays to array of hash objects that can also be played using default Sonic Pi functions like:

use_synth :mod_beep
ievanpolka =
“|:q1e11q12|q3113;q2-77+2|q31h1;q.5e4q32|q31h1:|”
“|:q5e55q43|q2-77+2;q4e44q32|q3113;q4e44q32|q31h1:|”

m = zparse ievanpolka, key: :g4, scale: :minor
m = m.ring

live_loop :playz do
play m.tick
sleep m.look[:sleep]
end

Thats about it. To learn more, check out examples or test run that plays trough multiple examples.

If you have any new ideas or find any bugs, please report here or in github. Examples using ziffers are also very welcome :slight_smile:

14 Likes

To me it is very difficult to read, are you aware of ABC notation?

Sure. Been using it for many years, but i wanted to create something that works with numbers and is fast to write. New notations are always difficult to grasp. This notation is also aimed for those who dont necessarily know about note names or midi notes.

Basic syntax is very simple, basically one number and character per note. In my point of view, writing melodies cant be much simpler than this

zplay “h 3210 3210 q 1111 2222 h 321”
#If you omit key and scale its c major

This syntax is also great for creating semi-randomness like:

live_loop :rand do
zplay(“q 123? 323? 543? [123,323] (1,3)”)
end

5 Likes

This is ace, thank-you for working on this and sharing it. Please don’t be put down by dismissive comments - your work here is important and valued.

Huge hugs! :slight_smile:

4 Likes

I’m sure @amiika is aware of ABC notation. Please watch this fab talk by Evan Czaplicki which discusses in great detail about the impact of comments like this on important open source work:

5 Likes

That’s an interesting and thoughtful presentation. Thanks for the link!

1 Like

Thanks! I started to program ruby only recently when i found Sonic Pi from Github’s explore page. You have really created something that is very influential. Me and my girls are having fun programming backing tracks for their violin/flute scores.

1 Like

That’s wonderful to hear! Give them a big high-five from me :slight_smile: :raised_hands:

1 Like

Had a play with this today. It is very interesting and certainly gives a compact notation, and has some powerful features. Thanks for sharing it. Personally I am so steeped in using note names that I prefer to use them even at the expense of extra space, but using numbers like this certainly makes transposition and use of different keys very easy. I have enjoyed looking at it, and hipe to get to grips with it a bit more.

Great, i hope you find it useful. I created it for experimentation of melodies in different keys and scales. Im not familiar with most of the scales offered by Sonic pi, so its fun to hear how the melody changes using the same notation.

Its also useful for experimentation of chord progressions, if you ever have wondered something like how would “I - V - II - VI” progression sound in D Mixolydian you can simply try it by writing:

zplay(“i i %-1 iv iv %0 i i %-1 v v”, key: :d, scale: :mixolydian, chordSleep: 1)

% Character is used to inverse the following chords

Hi @amiika, nice to see you here. I did open the issue on your github, regarding midi support for ziffers, and because the issue is now closed, I just wanted to drop a huge thanks here, for both your work and kind help.
I see ziffers somewhere between the brutal efficiency of Tial and the more welcoming Sonic-Pi. :upside_down_face:
And I do absolutely love that it handles midi and allows me to quickly sketch ideas with VSTi’s.
All the best !

1 Like

Since reading about number notation (in Jean-Jacques Rousseau’s book on the origins of music!), haven’t been able to shake the feeling that it’d have helped me in sax playing, particularly in Jazz. Wish my formal education in music had used numbers instead of note names. It’s even worse with French note names as it’s harder to internalize note relationships.

Thanks. That was a great idea. I also got my casio lk280 with lighted keys to work with ziffers and im planning to do some kind of “haunted keyboard” for halloween :ghost: :smile:

I have no experience with VSTi’s and it would be great if you could also provide some small code example with ziffers to show how to cycle the sound to VSTi and back to Sonic Pi. I did some googling and found Tunefish and ProtoPSG which are supposedly open source VSTi:s i could try to use.

1 Like

Im also considering writing a preparser for notation that uses small letters as note names and numbers as note lengths. It would parse alternative notation like “2 cc 4 dddd 2 cc - 4 aaaa” to “h 11 q 2222 h 11 - q 6666” in key of c.

You might want to try Helm as well (software synth also available as VST). It is free (but certainly can use a donation).

1 Like

I usually don’t send the audio back to Sonic-Pi, but instead record straight into a DAW ( Reaper ). If on mac OSX, loopback audio is a little app that will let you send audio back and forth between Sonic-Pi and any DAW.
Some of my favourite VSTi are Aalto and Kaivo from Madrona Labs, Diva, Bazille and Zebra from U-He, but also Kontakt and a small bunch of libraries ( Spitfire Audio and Sound Dust ) or Reaktor. or the TAL sampler … Most of those have free demos you can install and play with.
@robin.newman has posted great in-depth examples of playing with midi, osc and audio routing withiin Sonic-Pi : https://rbnrpi.wordpress.com/2017/07/19/sonic-pi-3-0-arrives-get-going-with-its-midi-and-osc-commands/
Hope it gives you new ideas, cheers ! :slightly_smiling_face:

Thanks. I’ll look into it. Im also still trying to to make portamento work with midi so slides would play something with midi. I understand the basic concept from the keyboard but cant reproduce it with code.

Just added new syntax support for note lengths and note names. Ended up adding fractions as one option to define note lengths. Degree notation can now be parsed from note names using zpreparse:

print zpreparse "1/4 cdefg - cab", :c
# Prints 1/4 12345 - 167"

This notation can also be played with zplay when using parsekey parameter. These examples all play the same melody:

# Original ziffers degree notation 
zplay("|:q1231:|:q34h5:|@:e5654q31:|:q1-5+h1:@|", key: :e, scale: :major)

# Same melody using fractions as note length / sleep
zplay("|:1/4 1231:|:34 2/4 5:|@:1/8 5654 1/4 31:|:1 -5+ 2/4 1:@|", key: :e, scale: :major)

# Same melody with note names in c, transposed to e
zplay("|:1/4 cdec:|:ef 2/4 g:|@:1/8 gagf 1/4 ec:|:c -g+ 2/4 c:@|", parsekey: :c, key: :e)

# Same melody using Z escape char and float
zplay("|:Z0.25 cdec:|:ef Z0.5 g:|@:Z0.125 gagf Z0.25 ec:|:c -g+ Z0.5 c:@|", parsekey: :c, key: :e)

You can add as many spaces as you want to make it more pretty and spaces are also important when “escaping” value from Z or fraction. So options options options, but it all parses to nice hash array to play with.

1 Like

Helm’s cool. There’s a bunch of LV2 plugins which work on Raspbian through MODEP. Though it doesn’t have a full UI in this context, TAL Noisemaker is among my favourites.
Almost makes me want to go back to my Ubuntu MATE laptop. Got two Linux DAWs (Bitwig and Tracktion Waveform). Only one is Raspbian-friendly (Tracktion Waveform).

Here’s new experimental ziffers util that maps keyboards white keys to degrees and prints ziffers notation after you play some notes. Big thanks to @robin.newman for his posts about midi stuff.

You can use this code to play sort of “always on key & scale” instrument and record ziffers notation on the fly. Still pretty experimental and no support for octave changes. Tested it only with VMPK but planning to buy some fancy micro synth like QuNexus.

2 Likes