Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the sustain button on MIDI controllers #10

Closed
probonopd opened this issue Feb 20, 2022 · 10 comments
Closed

Support the sustain button on MIDI controllers #10

probonopd opened this issue Feb 20, 2022 · 10 comments
Labels
enhancement New feature or request

Comments

@probonopd
Copy link
Owner

Support the sustain button on MIDI controllers.

(Once #8 is implemented I can say which MIDI message the sustain button sends.)

@dcoredump
Copy link
Contributor

Will do this with adding MIDI processing support for Synth_Dexed (see also #9, #11)

@probonopd
Copy link
Owner Author

probonopd commented Mar 15, 2022

@rsta2:

Wild guess: MIDI B0 40 7F -> m_pSynthesizer->setSustain(1) in src/mididevice.cpp, MIDI B0 40 00 -> m_pSynthesizer->setSustain(0)?

(How does one translate the MIDI B0 40 ... to something suitable for src/mididevice.cpp?)

@rsta2
Copy link
Contributor

rsta2 commented Mar 15, 2022

@probonopd Yes, Dexed::setSustain() gets a bool. According to this list (MIDI CC 64) everything <= 63 is off and >= 64 is on. I will provide a patch. Luckily my keyboard has a sustain button, so I can test it. ;)

@rsta2
Copy link
Contributor

rsta2 commented Mar 15, 2022

Here is a small patch to implement MIDI CC Sustain (Damper). The behavior is different from the damper pedal of my Yamaha home keyboard. When you release the sustain button, the note does not go off. You have to press the key again, to switch it off. This is managed by Synth_Dexed. @dcoredump I don't know, if it is intended?

sustain.zip

probonopd added a commit that referenced this issue Mar 17, 2022
@probonopd
Copy link
Owner Author

probonopd commented Mar 17, 2022

On my M-AUDIO Keystation Mini 32 Mk3 a LED goes on when I press the sustain key (sending B0 40 7F), and the LED goes off when I press the same key again (sending B0 40 00).

@probonopd
Copy link
Owner Author

probonopd commented Mar 17, 2022

Pressing the sustain key works.

But pressing it again, the already sustained notes keep playing forever (for voices that keep playing forever if pressed forever, like brass or organs).

No matter how often I press the sustain key, the notes never stop.
Only by plaing the same note again, this time with the sustain key not lit up, will the notes stop.

This is probably not like it should be? (Or is it?)

probonopd added a commit that referenced this issue Mar 17, 2022
@rsta2
Copy link
Contributor

rsta2 commented Mar 17, 2022

The sustain code in Dexed is here. I think line 386-393 have to be added to Dexed::setSustain() in Synth_Dexed. This will trigger the keyup() events automatically, when the sustain button/pedal is released.

@rsta2
Copy link
Contributor

rsta2 commented Mar 17, 2022

Here is a patch for Synth_Dexed, which enables the full sustain support:

diff --git a/src/dexed.cpp b/src/dexed.cpp
index be43a27..a93521a 100644
--- a/src/dexed.cpp
+++ b/src/dexed.cpp
@@ -406,6 +406,15 @@ void Dexed::setSustain(bool s)
     return;
 
   sustain = s;
+
+  if (!sustain) {
+      for (int note = 0; note < max_notes; note++) {
+          if (voices[note].sustained && !voices[note].keydown) {
+              voices[note].dx7_note->keyup();
+              voices[note].sustained = false;
+          }
+      }
+  }
 }
 
 bool Dexed::getSustain(void)

It's tested, it works.

@probonopd
Copy link
Owner Author

@dcoredump could you add it please? Thanks.

@dcoredump
Copy link
Contributor

It's fixed now in https://codeberg.org/dcoredump/Synth_Dexed

Thanks @rsta2!

probonopd added a commit that referenced this issue Mar 18, 2022
edwardgeorge pushed a commit to edwardgeorge/audio-resources that referenced this issue Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants