amiika / ziffers

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

L-system like syntax and parameters for melody generation #9

Closed amiika closed 5 years ago

amiika commented 5 years ago

Generative fractal melodies using regexp is super simple in ruby, for example:

t = {"0"=> "10010", "1"=>"1?" }
n = "0"
3.times { n = n.gsub(Regexp.union(t.keys),t) }
print n

Add parameter for number of "generations" and "axioms" that supports ziffers syntax.

amiika commented 5 years ago

lsystem function Implemented in the new version. This ended up being bit more complex than single gsub. Implementation also supports context dependent matching and stochastic rules.