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.