alda-lang / alda

A music programming language for musicians. :notes:
https://alda.io
Eclipse Public License 2.0
5.59k stars 286 forks source link

There should be a convenient way to write long slurs #378

Closed UlyssesZh closed 1 year ago

UlyssesZh commented 3 years ago

There are cases where there are like dozens of notes lying under a slur. Then, appending each note with a tilde is very inconvenient, like:

piano: c16~ d~ e~ f~ g~ f~ e~ d~ c2 | d16~ e~ f~ g~ a~ g~ f~ e~ d2

This is extremely inconvenient if at some moment I suddenly say "let's delete the slurs!" In this case, maybe we can design a function slur so that the code above is equivalent to

piano: (slur 'on) c16 d e f g f e d c2~ | d16 e f g a g f e d2~ (slur 'off)

(after (slur 'on), the notes without ~ are slurred while those with ~ are not slurred), or even something like

piano: [~ c16 d e f g f e d c2] [~ d16 e f g a g f e d2]

(just like how we write a long slur to cover a sequence of notes in sheet music).

daveyarwood commented 3 years ago

For practical purposes, you can use (quant 100) and it will sound exactly the same as if the note is slurred. For example:

piano: c8~ d~ e~ f~ g~

is effectively the same thing as:

piano: (quant 100) c8 d e f g

The default quantization value is 90, so if you want to "turn off" the automatic slurring, you can use (quant 90).


All that being said, it might still be useful to add a "slur mode" that you can enable/disable with (slur 'on) and (slur 'off), or maybe something like (slur) and (/slur). This would be useful specifically for exporting an Alda score to a format like MusicXML that supports slurs, i.e. so that we can export to sheet music that has notes under long slurs.