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

MIDI velocity values get rounded incorrectly #1088

Open
olilarkin opened this issue Apr 20, 2024 · 1 comment
Open

MIDI velocity values get rounded incorrectly #1088

olilarkin opened this issue Apr 20, 2024 · 1 comment
Labels
VST3 Issue relates to VST3 plug-ins

Comments

@olilarkin
Copy link
Member

From: Certain MIDI velocity values get decremented by 1 when read into VST3

If you send out a midi note with iPlug2 VST3 and read it back in with iPlug2 VST3 certain velocity values get decremented by 1. These are a set of values to test with…
9, 13, 18, 26, 36, 52
they arrive as…
8, 12, 17, 25, 35, 51

I was discussing this with the guys at Blue Cat Audio and they pointed me to this line (84) of code in IPlugVST3_ProcessorBase.cpp:

msg.MakeNoteOnMsg(event.noteOn.pitch, event.noteOn.velocity * 127, event.sampleOffset, event.noteOn.channel);

Rounding up of the velocity is needed. This works for me:

msg.MakeNoteOnMsg(event.noteOn.pitch, (int)(event.noteOn.velocity * 127.0 + 0.5), event.sampleOffset, event.noteOn.channel);

@olilarkin olilarkin added the VST3 Issue relates to VST3 plug-ins label Apr 20, 2024
@AlexHarker
Copy link
Collaborator

std::round() might be better than a manual rounding/truncate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VST3 Issue relates to VST3 plug-ins
Projects
None yet
Development

No branches or pull requests

2 participants