Hi! I'm using the BU16 as a simple Ableton controller to start/stop scenes in my liveset.
For some songs it would be awesome to have a "visual metronome" and I thought about using the BU16s LEDs for that – my plan was to send midi notes (via a midi clip) to the BU16 and make the LEDs blink, 1 for the start of the bar and 1 for the subdivisions.
My first thought was that the BU16s buttons send midi notes, so if I'll just send the corresponding midi note back to the BU16 that will make the LED blink – turns out that it's not that easy.
When researching on how to do this, I stumbled upon this page: https://docs.intech.studio/wiki/more/midi-rx/#set-value-and-led-intensity-on-buttons
I understand that you have to use the Midi Rx event to listen to incoming Midi data, but I'm struggling on how to adopt this guide to the simple task of e.g.: Sending Midi note B1 to the BU16 makes the bottom right buttons LED blink.
Thanks in advance for your help!
Trigger/blink BU16 LEDs with midi notes (for visual metronome)
Replies (6)
if ch == 0 and (cmd == 0x80 or cmd == 0x90) and param1 == 35 then
led_value(15, 1, cmd == 0x80 and 0 or 127)
endMidi channel (ch) numbers are zero-based, so the 0 above represents midi channel 1. Midi status values, represented here by cmd, start with 0x80 for note off and 0x90 for note on. param1 contains the note number (and bear in mind that there is no standard for what "B1" means, so you may need to change the value in the code above) and param2 should, for a note on or note off, contain a velocity. Sometimes the velocity alone is enough to do what you want (some things send a note off with a velocity of zero, some things don't) but just in case that isn't enough I made sure the code above just sets the led value based on the midi status value. For 0x80, the note off, this sets intensity to zero. For 0x90, the note on, this sets intensity to full.
If you have trouble determing the right note number, for param1, consider temporarily removing the param1 == 35 part, just to get the blinking going regardless of note number, and then add this temporarily on a line of its own: print(param1) and then look at the Debug Monitor in the Grid Editor.
Once you get this going for one of the buttons, you should be able to copy/paste it and get it going for the other one by changing just the value to which param1 is compared and then altering the 15 in the example above to reference a different button element index.
Thank you so much – I was able to find the note numbers by printing it into the Debug Monitor as you suggested and added 2 more leds for the subdivisons. Works like a charm (your code and also playing to the lights).
wow really cool idea and implementation!
Sweet! Glad it worked quickly for ya!
View on Discord
This post is from the Intech Studio Discord community.