Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 09-18-2023, 01:08 AM   #1
ijijn
Human being with feelings
 
ijijn's Avatar
 
Join Date: Apr 2012
Location: Christchurch, New Zealand
Posts: 482
Default CLAP plugins with MIDI-out slowly losing note velocity

Hi there team!

I've recently noticed a weird thing whereby a CLAP plugin (specifically with MIDI-out functionality enabled) will lose note velocity bit by bit. As far as I can tell, this appears to be related to an integer/floating-point roundtrip conversion issue. There are certain velocity values that remain stable, but notes with velocities below 9 in particular lose one point for every instance of such a plugin in the chain, disappearing completely when the velocity reaches 0, as you would perhaps expect.

VST3 builds of essentially the same plugins aren't affected, nor are CLAP plugins that pass MIDI straight through unaltered.

Specifically, if I multiply the velocity by 128.0/127.0 proactively then the problem goes away, but I've been assured by my audio plugin framework's lead developer that this shouldn't be necessary and is a problem with Reaper's handling of CLAP's velocity somewhere along the line. After further digging, this is somewhat borne out by the fact that (e.g.) fellow CLAP host MuLab doesn't do any of this.

If it's helpful for testing, here's a CLAP plugin that should simply echo the incoming MIDI.

Thoughts would be most appreciated
ijijn is offline   Reply With Quote
Old 09-18-2023, 04:53 AM   #2
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,696
Default

I note that the plugin is passing back velocity values that are slightly less than the values REAPER is passing in, by about 1.0e-8, so the plugin is touching the value in some way. That's enough for the truncated conversion to be less than the original integer value.

Having said that we can certainly round the conversion when receiving MIDI from the plugin, which will fix the problem.

Last edited by schwa; 09-18-2023 at 05:01 AM.
schwa is offline   Reply With Quote
Old 09-18-2023, 05:41 AM   #3
ijijn
Human being with feelings
 
ijijn's Avatar
 
Join Date: Apr 2012
Location: Christchurch, New Zealand
Posts: 482
Default

Quote:
Originally Posted by schwa View Post
I note that the plugin is passing back velocity values that are slightly less than the values REAPER is passing in, by about 1.0e-8, so the plugin is touching the value in some way. That's enough for the truncated conversion to be less than the original integer value.

Having said that we can certainly round the conversion when receiving MIDI from the plugin, which will fix the problem.
Thanks so much, Schwa! And yes please, I'd really appreciate that!

Hmm, the plugin uses 32-bit floating point velocities internally, which I imagine could explain those subtle truncation errors from CLAP's native 64-bit ones?

Thank you again and I'm very much looking forward to this particular update!
ijijn is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:47 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.