Skip to content

Add Per-Note Pitch Bending to Local ZynAddSubFX #7906

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

regulus79
Copy link
Contributor

This PR adds pitch bending support to the local ZynAddSubFX plugin, so you can pitch bend from the piano roll and have the notes actually change pitch correctly.

Demo

2025-05-26.14-06-52.mp4

Per-note demonstration (because I forgot to in the previous video)

2025-05-26.14-24-18.mp4

How it works

  1. A note is played by the user
  2. ZynAddSubFX::playNote() is triggered, which calls LocalZynAddSubFX::setKeyDetuning(note, detuning)
  3. LocalZynAddSubFX::setKeyDetuning reaches into the actual ZynAddSubFX plugin and calls Master::setKeyDetuning
  4. Master::setKeyDetuning calls Part::setKeyDetuning on each of its parts, which saves the detuning float in the note struct corresponding to the note being pitch-bended.
    • This is possible because ZynAddSubFX only allows one note to be played per key at once, so instead of indexing each note by some kind of global id which would need to be shared with LMMS, you can index it by its key and it works just fine.
  5. In the audio side, Part::RunNote calls SynthNote::setKeyDetuning on the note about to be played. The behavior of this function depends on which synth is used, AdSynth, SubSynth, or PadSynth.
  6. In each synth implementation, Ad/Sub/PadSynth::computecurrentparameters() is usually changed to incorperate the detuning amount in the pitch calculation. It depends though, since each synth is different.

Notes

Unfortunately, this PR only works when the UI is closed. This is because when the UI is open, the ZynAddSubFXRemotePlugin is used, which appears to only accept communication via standard midi signal codes/remote plugin codes. I do not believe per-note pitch bending is one of them, so it may be difficult to get that working.

... Or I could just invent a new midi code and use that I guess LOL... That's probably a bad idea though.

Also, I can't figure out how to modify the pitch of SubSynth, so currently it only works for AdSynth and PadSynth.

@regulus79
Copy link
Contributor Author

Apologies while I try to figure out how to link submodule changes into a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant