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 channelData is producing weird results #848

Open
TimPietrusky opened this issue Apr 20, 2023 · 4 comments
Open

MIDI channelData is producing weird results #848

TimPietrusky opened this issue Apr 20, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@TimPietrusky
Copy link
Member

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 TimPietrusky added the bug Something isn't working label Apr 20, 2023
@2xAA
Copy link
Member

2xAA commented Apr 22, 2023

Unfortunately we can't just get rid of channelData, it's used for the MIDI inputLinks.

location: `midi.devices['${id}-${name}-${manufacturer}'].channelData['${channel}']['${type}']`,

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
Copy link
Member

2xAA commented Apr 22, 2023

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.

@TimPietrusky
Copy link
Member Author

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.

@2xAA
Copy link
Member

2xAA commented Jun 18, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants