alda icon indicating copy to clipboard operation
alda copied to clipboard

Add something working as piano's sustain pedal

Open UlyssesZh opened this issue 4 years ago • 4 comments

piano: (pedal 1) c d (pedal 0) e (pedal 1) f g a (pedal 0)

It may sound like (where - stands for sustaining)

c: ----
d:   --
e:     --
f:       ------
g:         ----
a:           --

And (pedal 1) should be an abbr for (pedal 0) (pedal 1):

piano: (pedal 1) c d e (pedal 1) f g a (pedal 0)

should sound like

c: ------
d:   ----
e:     --
f:       ------
g:         ----
a:           --

UlyssesZh avatar Apr 06 '20 07:04 UlyssesZh

Interesting idea, thanks for proposing it!

I wonder if this idea could be generalized somehow. Gradual attribute changes are kind of similar in spirit, but not really the same thing.

I guess this might really be its own thing. Something like (pedal 'on) would put the score evaluator into a mode where it isn't sure what the lengths of the notes are yet, and then (pedal 'off) would "finalize" all of the lengths of the notes within that span.

Or, putting it in MIDI specific terms, it could mean scheduling NOTE ON messages but avoiding sending NOTE OFF messages until (pedal 'off) happens. But I'm not sure that I want to tie this idea to MIDI, specifically.

Maybe a more general (non-MIDI specific) way of expressing this is: allow notes to have an "indefinite" duration, and then provide a way to end them on demand.

I probably won't get to this for a long time, but I like the idea, so I'll keep the issue open as something that I'd like to implement at some point.

daveyarwood avatar Apr 06 '20 12:04 daveyarwood

MIDI note-ON/OFF should not be necessary. There are pedals in MIDI, defined as controllers. Check out the controller numbers 64-69. Probably number 64 is the right one here.

truj avatar Apr 06 '20 16:04 truj

Oh, interesting! I didn't realize there was something built-in for this in the MIDI spec.

I'm still curious to explore ways to do this that don't rely on features of MIDI. One of the goals I have for Alda is to eventually support non-MIDI instruments, so I think it would be useful to have a general solution that doesn't rely on implementation details of MIDI.

daveyarwood avatar Apr 06 '20 18:04 daveyarwood

...Of course, it would also be useful to provide a way to add "pedal" controller messages to the MIDI sequence, for those who want to use Alda to generate MIDI specifically.

daveyarwood avatar Apr 06 '20 18:04 daveyarwood