Midi controller. How to know assigned effect status

Hi! I want to build a very simple USB midi controller to use in Ableton. What I want to achieve and don't know how, is to have a led that shows the status of a button.

For example button 1 has a led that represents it, so when you assign it to turn on/off any effect, the led shows if the effect is on or off. Of course I could make the led turn on when the button is pressed, but that could not represent the current state of the effect.

My APC40 has this feature with every button, it behaves like this as soon as its assigned.

Thanks!!

Just listen for the same note number that you use for the button. However, most DAWs do not send out note events for buttons mapped using the "MIDI learn" feature, only for specific control surfaces.

A solution is to mimic the APC40, or something like the Mackie Control Universal (MCU), since that one is supported by all major DAWs.

You can use the Control Surface library to handle the buttons and LEDs: NoteButton example, NoteLED example

Pieter

Thanks for pointing me for a direction!

A solution is to mimic the APC40, or something like the Mackie Control Universal (MCU), since that one is supported by all major DAWs.

What you mean by mimic? I mean how do you do that? You mean the controller should tell the DAW it's a APC40?? How?

You can use the Control Surface library to handle the buttons and LEDs: NoteButton example, NoteLED example

I understand these are internally handled led's. Without listening to the DAW, right?

Thanks again!

Pancra85: What you mean by mimic? I mean how do you do that? You mean the controller should tell the DAW it's a APC40?? How?

Many DAWs allow you to select the kind of Control Surface you've connected in the settings. The DAW will expect specific MIDI commands and addresses (e.g. Mute button/LED for Track #1 is MIDI Note #0), these are listed in the PDF I linked to.

Pancra85: I understand these are internally handled led's. Without listening to the DAW, right?

No, they listen to the DAW on the address you specify.

IT WORKS!!!! :))))

Thankssss a lot!!! Can't believe how easy it was with this library, if feels as cheating :smiling_imp:

You can use the Control Surface library to handle the buttons and LEDs: NoteButton example, NoteLED example

I just used these examples together and it worked straight out. APC40 control surface was already selected (as I was using it previously), I don't know if it's necesary to select it or not, need to test it again.

:slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Another question:

How do I read the raw data incoming from USB? Or maybe more appropriate is how do I recall what the Control Surface library has already read.

I would like to implement a one led metronome, that keeps timing.

Tried to use MidiUSB library and reading incoming data, it works but it’s not very reliable, it misses some clock data. That might be the case because it needs to read the input two times per loop.

Glad to hear you got it working!

You can attach MIDI input callbacks to Control Surface as demonstrated here.

If you want Control Surface to listen for a given address and remember the value for you, you can use the NoteValue class:

[color=#5e6d03]#include[/color] [color=#434f54]<[/color][b][color=#d35400]Control_Surface[/color][/b][color=#434f54].[/color][color=#000000]h[/color][color=#434f54]>[/color] [color=#434f54]// Include the Control Surface library[/color]

[color=#434f54]// Instantiate a MIDI over USB interface.[/color]
[b][color=#d35400]USBDebugMIDI_Interface[/color][/b] [color=#00979c]midi[/color][color=#000000];[/color]

[color=#5e6d03]using[/color] [color=#5e6d03]namespace[/color] [color=#000000]MIDI_Notes[/color][color=#000000];[/color]
[b][color=#d35400]NoteValue[/color][/b] [color=#000000]noteval[/color] [color=#434f54]=[/color] [color=#000000]{[/color][color=#000000]note[/color][color=#000000]([/color][color=#000000]C[/color][color=#434f54],[/color] [color=#000000]4[/color][color=#000000])[/color][color=#000000]}[/color][color=#000000];[/color]

[color=#00979c]void[/color] [color=#5e6d03]setup[/color][color=#000000]([/color][color=#000000])[/color] [color=#000000]{[/color]
  [b][color=#d35400]Control_Surface[/color][/b][color=#434f54].[/color][color=#d35400]begin[/color][color=#000000]([/color][color=#000000])[/color][color=#000000];[/color] [color=#434f54]// Initialize Control Surface[/color]
  [b][color=#d35400]Serial[/color][/b][color=#434f54].[/color][color=#d35400]begin[/color][color=#000000]([/color][color=#000000]115200[/color][color=#000000])[/color][color=#000000];[/color]
[color=#000000]}[/color]
 
[color=#00979c]void[/color] [color=#5e6d03]loop[/color][color=#000000]([/color][color=#000000])[/color] [color=#000000]{[/color]
  [b][color=#d35400]Control_Surface[/color][/b][color=#434f54].[/color][color=#5e6d03]loop[/color][color=#000000]([/color][color=#000000])[/color][color=#000000];[/color] [color=#434f54]// Update the Control Surface[/color]
  [b][color=#d35400]Serial[/color][/b][color=#434f54].[/color][color=#d35400]println[/color][color=#000000]([/color][color=#000000]noteval[/color][color=#434f54].[/color][color=#d35400]getValue[/color][color=#000000]([/color][color=#000000])[/color][color=#000000])[/color][color=#000000];[/color]
[color=#000000]}[/color]

If you want Control Surface to call a callback function when it receives a message for a given address, you can look at this example. (It’s not a great example, since it was written for a specific use case, so feel free to ask more questions if you think you need callbacks like that.)

Everything works perfectly! You are my savior :)

Also this way you can use charlieplexing for leds, or other custom things that the library is not meant to be used with.

Thankssss