amiika / ziffers

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

Negative degrees #8

Closed amiika closed 5 years ago

amiika commented 5 years ago

Planning breaking change in syntax. Current octave change characters: -+ will change to _^

This change allows use of -+ characters with negative degrees. Two octaves using negative and positive degrees: "-7654321+1234567". This can also be more intuitive in some cases, for example "1-123" is more intuitive than current "1-765", which would be "1_765" after the change.

Negative degrees also come in handy when creating harmonies and inverse melodies. Inverse melody can be created by inversing the degree and adding offset. Simple way to add this:

degrees.each do |degree|
    -(degree)+inverse+offset if degree!=inverse && degree!=0
end

zplay "1231", inverse: 0 # Complete inversion. Plays "-1231"
zplay "1231", inverse: 1 # Inversion with same starting point. Plays "1-12+1"
zplay "1231", inverse: 1, offset: 3 # --..-- and offset. Plays "4254"

These two parameters would then make easy way to invert melodies and create harmonies when playing same original melody in multiple threads.

amiika commented 5 years ago

Implemented in the new version. Users should migrate old melodies using - and + characters to _ and ^.