Add Per-Note Pitch Bending to Local ZynAddSubFX #7906
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
ZynAddSubFX::playNote()
is triggered, which callsLocalZynAddSubFX::setKeyDetuning(note, detuning)
LocalZynAddSubFX::setKeyDetuning
reaches into the actual ZynAddSubFX plugin and callsMaster::setKeyDetuning
Master::setKeyDetuning
callsPart::setKeyDetuning
on each of its parts, which saves the detuning float in the note struct corresponding to the note being pitch-bended.Part::RunNote
callsSynthNote::setKeyDetuning
on the note about to be played. The behavior of this function depends on which synth is used, AdSynth, SubSynth, or PadSynth.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.