modV icon indicating copy to clipboard operation
modV copied to clipboard

MIDI channelData is producing weird results

Open TimPietrusky opened this issue 1 year ago • 4 comments

Operating system and application version

  • OS: Any
  • Version: 3.27.0

Describe the bug With channelData the connected MIDI controller gets out of sync once the preset was saved and loaded once, because it tries to memorize the last state of the device, for example a button press. But that data is not used anywhere in the UI or at least not correctly, which is why it's producing weird results. Especially when combined with other software that actually saves the state AND loads it back once the controller is connected.

To Reproduce Hard to reproduce, just get rid of this.

Expected behavior channelData is not used anywhere.

TimPietrusky avatar Apr 20 '23 07:04 TimPietrusky

Unfortunately we can't just get rid of channelData, it's used for the MIDI inputLinks. https://github.com/vcync/modV/blob/cab2b8254ec80867547033d4542c91d9b5db9f90/src/components/InputLinkComponents/MIDI.vue#L61

the connected MIDI controller gets out of sync once the preset was saved and loaded once

Yes, this is because there is no universal way to sync the state of a MIDI device.

We can't really sync the preset state to a device and neither can we update modV's state as there is no way to get the state from a MIDI device, at least without creating some sort of specific device mapping if the controller supports it - this is where the MIDI mapper project comes in.

Especially when combined with other software that actually saves the state AND loads it back once the controller is connected.

Do you have an example setup? I'm not sure what this looks like.

2xAA avatar Apr 22 '23 10:04 2xAA

For what it's worth, when I've created presets with a MIDI controller and have used buttons, I just ensure all the buttons are off or on - whatever's easiest. The state is then always correct between modV and the controller.

The same with sliders/faders/knobs - though it's less of an issue with them as they'll just have the value overwritten.

2xAA avatar Apr 22 '23 10:04 2xAA

For what it's worth, when I've created presets with a MIDI controller and have used buttons, I just ensure all the buttons are off or on - whatever's easiest. The state is then always correct between modV and the controller.

The same with sliders/faders/knobs - though it's less of an issue with them as they'll just have the value overwritten.

When I have a preset for a show, I have some modules activated by using the MIDI controller as the initial state, so for example the Logo of the event. So that I can start my setup and then it already has the logo showing.

When the preset is then saved and loaded again, I'm out of sync, as pressing the button again to deactivate the logo might work or not. I'm actually not sure how to enforce this persistently.

TimPietrusky avatar Apr 25 '23 10:04 TimPietrusky

@TimPietrusky This error is specific to how Launchpad (versions lower than mk3. mk3 and above have a configuration tool which allow assigning buttons to CC values) uses MIDI to send state.

Notes can't represent button state - think of them like piano keys. Keys can't stay down by themselves, a finger always needs to hold them down.

We need this code block in modV to understand how to transform a note on and note off into a latched button/switch:

https://github.com/vcync/modV/blob/next/src/application/setup-midi.js#L93-L110

If the buttons on a Launchpad used CC data instead, the device itself could hold state about the buttons and send the updated CC value - modV would just react to that without having to latch note on and note off. (e.g. send 0 for when the button is off and 127 for when the button is on - this is common on most controllers)

This is why I didn't want to add a latch functionality in the first place - it's pretty much an abuse of the MIDI spec and horrible to support.

However, the #296 issue would probably fix this as Launchpad also can receive MIDI notes which turns the LEDs on and off behind the buttons.

So, write a handler for Launchpad devices lower than MK3 and send modV's state back to the device where appropriate, for example after loading a preset.

The Launchpad docs: https://fael-downloads-prod.focusrite.com/customer/prod/s3fs-public/downloads/Launchpad%20MK2%20Programmers%20Reference%20Manual%20v1.03.pdf

Page 5 mentions note on/off will set the LED. Page 16 has a device enquiry which will let you detect a Launchpad in need of this functionality.

2xAA avatar Jun 18 '23 10:06 2xAA