free-audio / interop-tracker

A place to track bugs between host and plugins
5 stars 0 forks source link

Bitwig sends polyphonic modulation values before but not after note on events #51

Closed robbert-vdh closed 1 month ago

robbert-vdh commented 1 year ago

Right now Bitwig always sends polyphonic modulation every 64 samples with no regard for note start times. This results in notes/voices potentially getting their first polyphonic modulation value up to 63 samples after the note start. Before that point the note ID doesn't technically exist yet, and Bitwig is sending invalid events for invalid note IDs. This looks a little something like this:

image

To fix this, Bitwig would need to (re)send the initial modulation value just after the CLAP_EVENT_NOTE_ON event.

swesterfeld commented 1 year ago

I think what I'd like to have from a plugin point of view to get the initial value for the modulation right would be this:

  1. the host should never send a modulation event for a clap_id before the note on event for this clap_id
  2. for parameters which are modulated by clap_id, the host should send the initial value for the modulation with the same time stamp after the note on event for this clap_id
  3. for parameters which are modulated by channel/key, the host should send the initial value for the modulation with the same time stamp after the note on event for this channel/key
  4. for parameters which are modulated for all voices, the plugin should track the state of the global modulation and copy it into new voices

See also https://github.com/free-audio/clap/discussions/316

@abique what do you think?

abique commented 1 year ago

Should be fixed for Bitwig 5.0 Beta 7.

robbert-vdh commented 1 year ago

Very excited to give that a try, should make a huge difference when using polyphonic modulation with extremer values!

abique commented 1 year ago

@robbert-vdh did you have a chance to test this? BTW, I've changed a bit that code for the beta 9.

robbert-vdh commented 12 months ago

I tried testing this with Beta 9 but I'm running into audio engine crashes and I was getting out of bounds events at one point. I submitted a crash report. And here's the backtrace with no symbols if you have a way to retrieve those from the offsets:

``` 0. /opt/bitwig-studio/bin/BitwigAudioEngine-X64-AVX2(+0x384f097) [0x55f5d772d097] 1. /opt/bitwig-studio/bin/BitwigAudioEngine-X64-AVX2(+0x38522fb) [0x55f5d77302fb] 2. /usr/lib/libc.so.6(+0x39ab0) [0x7f16db278ab0] 3. /opt/bitwig-studio/bin/BitwigAudioEngine-X64-AVX2(+0x3634d6e) [0x55f5d7512d6e] 4. engine::AudioBuffer::madd(engine::AudioBuffer const&, float, unsigned int) 5. /opt/bitwig-studio/bin/BitwigAudioEngine-X64-AVX2(+0x33b82bb) [0x55f5d72962bb] 6. /opt/bitwig-studio/bin/BitwigAudioEngine-X64-AVX2(+0x2f635ba) [0x55f5d6e415ba] 7. /opt/bitwig-studio/bin/BitwigAudioEngine-X64-AVX2(+0x2f3d0a4) [0x55f5d6e1b0a4] 8. /opt/bitwig-studio/bin/BitwigAudioEngine-X64-AVX2(+0x2f497ab) [0x55f5d6e277ab] 9. /opt/bitwig-studio/bin/BitwigAudioEngine-X64-AVX2(+0x2f464c9) [0x55f5d6e244c9] 10. /opt/bitwig-studio/bin/BitwigAudioEngine-X64-AVX2(+0x2ff96dd) [0x55f5d6ed76dd] 11. /opt/bitwig-studio/bin/BitwigAudioEngine-X64-AVX2(+0x2f201c2) [0x55f5d6dfe1c2] 12. /opt/bitwig-studio/bin/BitwigAudioEngine-X64-AVX2(+0x387c698) [0x55f5d775a698] 13. base::core::Thread::thread_run_func(void*) 14. /usr/lib/libc.so.6(+0x8744b) [0x7f16db2c644b] 15. /usr/lib/libc.so.6(+0x10ae40) [0x7f16db349e40] ```
abique commented 8 months ago

@robbert-vdh I think it isn't crashing anymore. I'll double check that shortly.

abique commented 1 month ago

@robbert-vdh please re-open if not fixed for you. I've just verified it and looks good to me.