Midi controllers not working reliably
Hi. I have made a 3-person looper, with 3 controllers. The controllers send midi notes to switch Record, Delete, Reset and Overdub. The controllers are recognised and send midi perfectly (I have checked with a DAW and they send midi perfectly). I can assign the midi notes to objects and that works. But ONLY works at that time! If I save and reload the patch nothing works. If I build an exe it doesn't work. This needs to be a plug and go system for live use. Why is Max losing its midi input? The controllers are present and selected in Midi Options, but nothing is working. Is it the objects I'm mapping to not holding the assignment? Is it Max? I have Overdrive active, and I have set all 'clear' commands to 'clearlow'. No difference. Help please!
can you share the patch?
Also I'm not using Live. Trying to keep the Patch as small as possible.

learn how to use midiinfo to assign midi ports and devices
to max midi objecs in first place.
you have 3 boxes - what are they ?
3 different usb devices ?
it is trivial thing to read their port & device names
at patch or app start and detect if they are present
and rute their output to objects that need to receive midi input from them.
Yes I have done that, as you can see in the patch. The devices are very carefully mounted as midi a, midi b, and midi c. I plug them in a specific order so they pick up the correct names. As I said the midi is getting in and out, but Max does not always respond as it should. As if the mapping gets lost. As I said it will work, then not work.
i see something which *might* be a case for trouble, but for the midi out: if something goes wrong with the audio clock, like beeing too fast, you are sending the midi bytes from the messageboxes with 0,7 ms distance.
as for the midi in part, i was not able to find that between all these color contrast experiments. where is it?
MIDI mapping doesn't seem lost, at least I can see it in the "Show Mappings" sidebar where everything seems fine.
However, this doesn't make sense and that's most likely why you can't retrieve your MIDI connexion.
Look at the the [midiinfo] helpfile:
and find the difference...
It's not because it works in one case that it should work in all cases. Little happy accidents are just a pain until you realize these are just accidents.
I never used the built-in MIDI mapping feature, nor the MIDI device letter abreviation, and I don't know how they persist accross midi device being unplugged/replugged, opening the patch on another computers, or through a .exe export. But still, my advice would be to use plain midi device name, such as [notein @name "My midi device name"], or make your pedals use specific midi channels.
in my experience midiinfo is not threadsafe in the sense of "works when loadbanged".
sometimes the menu with the buses remains empty. so i leave let the user press a button.
OK, thanks for the suggestions! I'll try and get into it tomorrow and see what I can do.
The Controllers are Arduino-based, and appear as 'Arduino Micro' 'Arduino Micro #2' and 'Arduino Micro #3'.
In the Midi Settings I have them assigned as 'a' 'b' 'c' at the moment, which is why the 3 'notein' boxes have the a b and c suffixes.
I thought this was a quick way to assign the Midi Port names, but maybe that is not what the 'assigned' letters are for in the Midi settings? So I think I'll try and fix their real names into the Midi IN selectors first.
For the Midi Out (which simply drives the LED tempo indicators) that seems to work pretty well, it's the Midi IN switches that have the 'working/not working' issues.
And the LED timing doesn't need to be ultra-precise, just a rough guide for the band to visually sit with.
This is my first Max patch, I started it 4 months ago, and it is put together piece-by-piece - that is why it's not as 'tidy' as a proper Max Patcher would make!
Thanks again folks, I'll try the suggestions and post the results back here.
If you have arduino 32u4 based midi devices, you have better options then
to have to plug them in any order.
needs few lines added in boards.txt file, and each of them can
get own USB descriptor & Midi Device name.
I can help you with that if you wish to try.
For that few midi events one single Arduino would have worked too,
would also avoid spaghetti with 3 USB Cables on the stage.
and why do you use midi mappings for 12 midi events,
instead of assigning fixed routings ?
midi devices have attribute machport to work only with assigned midi port name.

you have also option to listen to any midi device, and route events by midi channel or specific message !?
Never thought of such simple solutions ?
Unfortunately spaghetti will be unavoidable on a large stage with the 3 controllers as far away as the musicians may be!
I suppose I could have made them as 3 simple remote switches and LED's for one BIG central Board, but the boxes may be used individually, or separately or in different combinations, so each being self-contained seemed useful at the time.
I'm new to Max and Arduino (4 months) so I'm not an 'expert', nor am I great at maths or coding - a very nice chap wrote the code for the boards for free in 2 hours and got it perfect first time - after I'd spent 3 months melting my brain getting nowhere.
So yes, I know there is a lot of Max I don't know yet, but I'll be working on peoples suggestions, trying to make them work!
So the schedule now is to :
1 - Name the Boards
2 - Put Board names into Max
3 - Work on the Midi notes in Max
Finger crossed, and thankyou to all who sent helpful suggestions.
Thankyou SOURCE AUDIO for the Board Names hint - worked perfectly!
On to the next bit - I'll try not using Mapping this time, and just using direct Route+Filter instead.

Could you post which midi events your devices send or receive ?
About spaghetti - you mention eventual
long distances from devices on the stage
to computer, I guess you are aware of usb cable
length limits ?
And you can make many switches on a single
analog input using resistors.
that way one can plug additional multi footswitches
into one master arduino using a guitar jack cable