ElectroTechnique / TSynth-Teensy4.1

TSynth for Teensy 4.1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sustain Pedal support

callimero opened this issue · comments

There is a Midi cc# 64 which is mostly used for sustain pedals.

I was able to hack that in. However as I am not digged deep into the code I just made a proof that I am more a hacker than a developer. I just setting release to the decay value when the pedal is pressed. And restore it when released. This works for the piano type sound (well Rhodes) besides that I did not manage to stop the releasing when the pedal is left off (allNotesOff(); seems not to do it) so I use closeEnvelopes(); but that just cuts (ok for me here).

Of course a Hold should put the envelopes into the Decay phase I guess. I only can imagine that this could be done by not sending NoteOff()s but I did not found a way to do it right now.

The other thing in this context is that maybe a hardware port for a sustain pedal should be supported? I think this is a nice thing to have for a 12 voices synth.

Erm... could it be that simple? Sounds fine to me.

void myNoteOff(byte channel, byte note, byte velocity) { if (ampHold==0) { decNotesOn(); if (unison == 0) { endVoice(getVoiceNo(note)); } else { //UNISON MODE for (int i = 0; i < NO_OF_VOICES; i++) { endVoice(getVoiceNo(note)); } } } }

case CChold: if (value>0) { ampHold = ampRelease; } else { ampHold=0; allNotesOff(); } break;

There is also another way, which could be a setting (I am just keep saying here, I have no clue if this is all doable)

MIDI CC 66 | Sostenuto On/Off Switch | On/Off switch – Like the Sustain controller (CC 64), However it only holds notes that were “On” when the pedal was pressed. People use it to “hold” chords” and play melodies over the held chord.

Sorry I am a github noob, I should have done branches for every feature.