Midi CC toggle button
Hello,
I’ve been trying to emulate this stream deck workflow I had with the Elgato software. I’d like a single button to toggle between CC values 0 and 127 (off/on) and have separate images for each button state. I haven’t found a good way to do this. Can anyone help guide me?
Thanks!
In reply toDryw_Owens⬆:Raphael Sepulveda @raphaelsepulveda2025-11-14 21:52:47.017ZHey @Dryw_Owens,
Sorry it took a while to get to this one. I'm happy to help.
Here is a script that will toggle between two CC values. I've set it up so that it does so between 0 and 127 on CC64 (Sustain Pedal).
Feel free to adjust the rest of the settings to your liking at the bottom of the script:
/** * @param {{ * outputNum: number, * midiChannel: number, * midiCC: number, * minValue: number, * maxValue: number * }} args */ function toggleMidiCC({ outputNum, midiChannel, midiCC, minValue, maxValue }) { const id = `${outputNum}_${midiChannel}_${midiCC}`; // Initialize state if (globalState.toggleMidiCC === undefined) { globalState.toggleMidiCC = {}; } if (globalState.toggleMidiCC[id] === undefined) { globalState.toggleMidiCC[id] = { isOn: false }; } const state = globalState.toggleMidiCC[id]; // Flip the toggle state.isOn = !state.isOn; // Send the corresponding CC value sf.midi.sendCC({ outputNum, midiChannel, midiCC, value: state.isOn ? maxValue : minValue }); return { state }; } toggleMidiCC({ outputNum: 1, midiChannel: 1, midiCC: 64, minValue: 0, maxValue: 127 });
In reply toDryw_Owens⬆:Raphael Sepulveda @raphaelsepulveda2025-11-14 22:04:16.140ZRegarding your second inquiry, unfortunately it is currently not possible to have different images on a button to reflect state.
It is a feature that is requested often though, so please make sure to like and comment on the following link to keep bringing attention to it and hopefully have it implemented soon!