amiika / ziffers

Numbered musical notation for composing algorithmic and generative melodies
MIT License
81 stars 5 forks source link

New syntax for list transformations #66

Closed amiika closed 1 year ago

amiika commented 1 year ago

There has been experimental syntax for list transformations for some time now. I'v never been happy with it and felt it's been too "object oriented".

So finally got an idea for the new syntax:

zplay "(0 1).inverse(1)" # Current syntax
zplay "(0 1)<inverse>(1) # New syntax
zplay "(0 1)<i>(-1)" # Current shorthands (in this case inverse transposition) works as usual
zplay "(0 1 2)<fuse>(3 2 5)" # ... just feels nice, goes along with syntax for euclid cycles, arpeggios and doesnt scream OOP! :) 
amiika commented 1 year ago

Also adding support for multiple parameters:

# Example of new permutation method called from ziffers syntax:
z1 "(0 1 2)<p>(4)" # Permutation index 4
z1 "(0 1 2)<p>(2,2)" # Permutation index 2, size 2
z1 "(0 1 2)<p>(0 3 2 1) # Cycle permutation index
z1 "(0 1 2)<p>((0,3),2)" # Random parameters
z1 "(i iva)@(q 0 1 2)<p>((0,7))" # Random permutations as arpeggios