ctlout to several instances of the same midi device
I have posted about this several times over the years, but I thought I would try again as this issue is giving me a huge headache. I am on OSX 10.8.5, 2.8 GHz Core duo power book on Max 6.1.7 in 32 bit mode.
I have 4 midi devices that I made that have the exact same name but are on different midi channels. This is because they are Arduino based and I changed the FTDI driver in the Arduino. They are on midi channels 1, 2, 3, and 4 respectively. When I boot up Max it automatically names these devices 1 device name, 2 device name, 3 device name, 4 device name. I tried renaming them in the Mac Audio/Midi setup but it didn’t work.
Here’s my problem: To send any of the ctlouts that I use a message I have to create identical ctlout objects and send all 4 the same message. For each ctlout I have to send it an initial message of port "1 device name," the second one gets port "2 device name" etc. Hopefully you can see how tedious this can be as I have lots of ctlouts. If I just select "All Devices by Channel" then nothing happens. In the MIDI setup window I can’t really use the abbreviation or offset because the midi devices are numbered differently every time I boot up Max.
Is there a message I can send a ctlout that will specify all ports by channel? Is there any other way that I don’t know about?
Thanks and if anyone can help I would be forever grateful.
- This topic was modified 1 year by nicnut.
OK, I guess since no one is responding to this, and since I have been trying to figure this out for several years to no avail, maybe it’s not possible right now.
So, Cycling 74′ if you are listening, this is a request that I pray you can implement in future versions of Max: Please, when using a ctlout object can you make it go to all devices by channel and not have to pick a specific device. Pretty Please.
I’m reading your post as I have a similar but different issue.
I’m using ctlout to connect to various controls inside my Elektron analog rytm.
There are a hundred or so controls that I want to connect to and I have noticed that every time I open my patch I have to go and right click every ctlout to set it to the right device. Obviously with more than one ctlout in a patch this gets very very tedious.
I started to look for some message that I could send dynamically or from a load message that would set all ctlout sat the same time and save me from going down into each subpatch and right clicking and selecting device.
I know how depressing it is to have an issue and seemingly no one cares…Im wondering if you have have any new insights on this now that we are at max version 7.
Also if I find a way I will be sure to come back and post my solution here :)
You could give ctlout port as an argument, or use midiout prepending control messages etc.
There ARE solutions to all this midi routing problems.
Now to Arduino Devices showing up with indentical names…
Could You provide more details on how this devices are connected to Mac.
Cascaded ? Parallel ?
And Jon, You could also send a message to all ctlout objects, in all b or subpatchers,
setting the out port/device, if You need to stay flexible.
Just have a look in ctlout help file under outport
Hey Source Audio,
Thanks for the reply…I found a solution earlier today – not sure if its the right way but it is very flexible and works well for my situation.
My solution is as follows…be nice to hear feedback on this.
How to get a ctlout to automatically connect to the right midi device
1) Open Max and Go to ‘Options > MIDI Setup…’
2) A small panel should open with a list of connected/previously connected devices
3) In this panel should be an ‘Abbrev’ column
4) Click inside the ‘Abbrev’ row/column that corresponds to your device
5) You should see a drop-down of letters. The alphabet
6) Select any letter ‘e’ for example as an ‘Abbrev’ for your device. I used ‘e’ for my Elektron device
7) Do this for both input/output for your device (im not sure if you have to)
8) Then find a ctlout that should always connect to this midi device and set its first argument to ‘e’. The text inside your ctlout should look like this ‘ctlout e’ (make sure you have the space between ctlout and e).
I could see there was some info in the docs about using an argument/symbol to set the device but there weren’t any clear steps and I wasn’t really sure what was meant by using a ‘symbol’ to set the device.
I did try using a message to loud the name of my device into the ctlout via ctlouts left most port but the name of the Elektron device is…
‘Elektron Analog Rytm Analog Rytm out 1’ and being a coder I was pretty sure that the spaces in the device name were an issue.
I hope this helps someone
Let me know your thoughts
Hi Jon, You are right about spaces, but if You pack the Device Name in a Symbol,
like "Elektron Analog Rytm Analog Rytm out 1" then it should work.
I would prefer this approach instead of fiddling with max midi setup,
because it could be incidentally changed.
In fact You could add a receive object to all ctlout objects You need
and send a message port "Elektron Analog Rytm Analog Rytm out 1"
Also there is midiinfo object in max which gives You all available midi inputs
and outputs, and if needed specifically controllers.
It can fill the umenu with device names, which then can be selected…
Well try this with message port "Elektron Analog Rytm Analog Rytm out 1".
I am sure it will work.
Another question – You mentioned having really many ctlout objects
in the patch, have You tested sending all of them at once,
making sure nothing gets dropped out ?
I’m glad there is some activity on this post. I don’t know if any of your suggestions will work for my situation. Maybe the "midiinfo" object will work, I didn’t know about that one, I’ll try it out.
Here’s my situation again. I have several Arduino megas that I made into devices recognized as midicontrollers by my computer, by installing Hiduino in the chip that controls the USB port on the Arduino, each one is on a different midi channel (1, 2, 3, 4). When plugged into a computer these devices show up as: MIDI/MOCO for LUFA. They are all called this. When I plug all 4 of them in at the same time Max will automatically and arbitrarily number them, like MIDI/MOCO for LUFA #2, MIDI/MOCO for LUFA #3, etc. This numbering system seems different every time, so to be safe, if I want to send a control message I have to make 4 ctlout objects, all to the same controller number and channel and send the message 4 times. I think sometimes it is too much data and info doesn’t make it or gets lost.
So, I wish there was a way to use one ctlout object that only sent to one midi channel, or to give each device a special ID, regardless of how they are plugged in, that could be specific to midi channel.
I tried using the Midi Setup window and the abbreviations, but that doesn’t work because the devices get re-named everytime I launch Max, so device "a" might be a different device next time.
thank you and let’s keep this discussion going, maybe there is a way to figure this out.
Using symbols is the bit Im stuck on.
When you say pack it into a symbol I’m not sure what to do here – is a symbol different to using a message box? I tried writing the device name in a message box then attaching it to the left most port of ctlout and triggering it but to no avail.
I would prefer not to use the global midi setup menu if I can.
I did try with midiinfo, attaching it to an attrui and then seeing what gets output when I make a choice from the menu but I also couldn’t make it work…although Im sure there is a way.
Please forgive me if I sound dumb, my new years resolution is to finally learn Max 7 inside and out so this is my first few days properly diving into it.
Hi Nick, I understand now what is going on with 4 Arduinos.
That would happen with any other multiple USB Midi Devices.
Even worse a single Device could get assigned #2 extension if one connects it to
different USB port.
So what to do ?
Did You try to connect the 4 Arduinos to powered Hub, allways sitting on same ports ?
I think that probably only true solution would be to reflash the 4 Arduinos
to get own Midi Device Names.
That is because not Max, but OS (in case of OSX) midi setup will assign them
#1, #2, #3 extensions depending on order in which they initialised.
Now how to do that.
There must be USB descriptor file in the Hiduino Firmware Distribution, where You will find
MIDI/MOCO for LUFA somewhere in the text string under devices.
You could change that to :
MIDI/MOCA for LUFA
MIDI/MOCB for LUFA
MIDI/MOCC for LUFA
MIDI/MOCD for LUFA
Changing only 1 letter is important because then You don’t need to change device descriptor
name length etc.
So one would have to rename the File, upload to Arduino B,
rename again, upload to Arduino C, and D
Yes it is shity job to do, but I have no better solution to offer.
What could be done on software side …
Well if You could programm something that each arduino sends
as identifier, then one could get this messages in Max and detect
which Device is for example sending CC1 Value 3.
That Device will get assigned ctlouts and other midi send objects
intended for Arduino 3.
Does that sound complicated…
Let’s try again :
If each of 4 Arduinos sends indentifier like CC 1 Value 1, CC1 Value 2, CC1 Value 3 etc
then You could find out which one of the 4 is sending CC1 Value 1, and if that is
MIDI/MOCA for LUFA #2, than You would assign all ctlouts that are meant for Arduino 1
to that Device.
And so on.
Does that make any sense ?
Hi Jon, here is patch demonstrating what I am saying.
Please make sure that the name of the device is EXACT as it appears
in audio midi setup, including Capital letters.
It has to totaly match, otherwise it will not work.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 750.3oc2X00SaCCE84zeEV44BJ1IwIcZZRnoo8BOMwaCDxMwTLKwNJwsCFh+ 6yez.EF00kEpZ4E2du185y43qsut2OJHbp3VZWH3SfeBBBteTPfwk1QvR6fv ZxsEUjNyvBqoccjYzvw19jzakF+cTYuuFhr3ZFe1kszBoM1oo3iiFCfIo5Oh QGmpLxNNBbwxeCqzDEwzaNBl2GnqDbImTSMc8cJmtfz2EedMiWQkFPgdxoXt r2Kbknzw9iIJvH07acaGo7tFpEhggfKz87vnQ5lw+m5QQEkz5gh.QFEI1XrN EI6.VQdEtGixLzM2jMfRbSd7GgzgYTInlUx.p4ATRWvJTa6VuBk.yWI6.FMw oBkdHoPb5uUf9eDnJAobJgOyUZCVCFPVhtM0zBmrFIIdakD3fHIFF7ljk40T 97MS9kmfByxbRejGzugzp5PRaujxISqLCIxeoIdKkFFWcAgJoYrIwoGyRZsk +elV2Hu6KgCWFkd6FiekvCQ0tMKI2olB+.rKqPVol.WJRj8FZaZVB1ohDssJ R7qpHQqQQ1oGtjaV7w4a9rk7CsiVblK.HfXGxBBEuR9PpycHYGJoCOxbjClC SLUo5EywGbLG5f4Xj2K4oGJDuEbl3jSO8nud1oaj4nLCyyPtXdx1x7n8uaC5 7RTrmLBQ1huhcIJCTUWCX5v5pGuQzJAmG9sJ5ujsBN3DNoRLC7i6j0O665cK vyC2n7LIwimxf1Gpfv.rvJF+ku62vMs+mKmch4sE8gp+0nfm3WIsSx3DISvW cP4OaPWyJKo7UWaKYc5hNMhyquv5Mdx8AO3MfGU0hMBUMpKEkTbp8+n.aedN 9QqmlngiAdonn2FCrPOFO4Qq2CFnAGzm0.n+LHQUPtQ0sO3SUqdu06ACh8YM .t6xpgCQNwvgmDefSzdEbx1qPCdmgFeNOb+JwIcmgFjGnI9MhF6MqjllEz1t kgz.DUII2HZ0l3wFSF2ZZhXXKcAqe74izQ6gQ+0rUiFu -----------end_max5_patcher-----------
And Nick, would You tell me which firmware exactly You flashed the Arduinos with.
I am asking as there are several moco lufa versions, I have looked at one, it would maybe
be possible to rename Arduinos without recompiling the hex, just edit it.
So if You could give me download link, I will check it and report.
for my most recent projects I used this link for my firmware:
It allows you to name your hid device. But, when you plug it into a Mac (maybe windows too) it is listed as a midi device called "MIDI/MOCA for LUFA." if you go to "about this mac" in the apple pull down menu and look at USB devices that are plugged in it will give you the unique name that you selected in your firmware, other than that, I can’t see any evidence of a unique name.
I do have the .hex code, and I have looked at it. It’s all numbers. I tried putting it in hex translators, but I can’t find any way to understand it. I did think I could just change the name in the .hex code, but it seems really difficult.
I would love a software solution in Max. Since every device is on a different midi channel, it seems like this would be the best identifier. Also, just to clarify, this issue is only a problem with ctlout. With ctlin everything is fine.
Thanks for your suggestions, Let me know if you have some more input.
Hi Nick, there seems to be even a newer Version of firmware, it is just a bit complicated
to trace who did compile what after the initial release…
Checks this link :
Could You also tell me what types of Arduino You use ( mega 2560 with which 8u2 or 16u2)
Intel Hex has owbn format, so one needs dedicated software to read anything understandable.
I will have a look in The Firmwares from the link, and let You know, bin a bit bussy,
but I will manage that today.
Also some sort of detection in software should be no problem, I started something Yesterday night,
but did not finish it yet.
I also would be helpful if You tell me what do You usually send – receive from Arduinos,
so that one can think of midi message for indentifying which would not be included
in usual messages. ( maybe some SYSEX ??)
anyway, well’ll have something done soon, I believe.
Hey Source Audio,
Thanks for sending me an example…I will have to wait till after work today to try it out.
Really appreciate your efforts and help!
Best of luck to Nick as I know he was trying to solve his issue since 2012! I think Source Audio might have the answer…sorry my solution was not much help.
Nick, I have looked into several versions of Moco for LUFA or whatever they call it.
Well as I said there are several versions, all having own "Name", like hiduino, Moco LUFA
arduino midi etc, but they ALL share the same Vendor Device IDs.
First Vendor ID being Atmel, than Device ID for Midi Demo For LUFA.
I have not found any Firmware containing name Moco for LUFA…
So can You post the firmware that You used to Flash Your Arduinos here ?
Just zip it.
If it does not work, I will give You mail to do so.
I did programm some sort of ID recognition by midi, but it is not really
what I would prefer.
Much better to reflash Arduinos, give them own ID and name, finito, no trouble any more.
I saw You asked for help some yeras back in Arduino forums, and they at the end
gave You the right solution to the problem, but nobody gave You the exact instructions
how to do that, and compiling Firmware from the source is not everyones cup of tee…
Source Audio and Jon Mosley, Thank you very much for your input, I really appreciate it.
Ok, Source Audio here is more info. I use Arduino Mega 2560. I am sending and receiving control change data, using ctlin and ctlout. The Megas I most recently flashed use a 16u2 chip.
Are you thinking of coming up with a new driver that has customizable name? If that is possible that would obviously be the best solution. Although it would be great if ctlout was specific to midi channels and you didn’t have to name the device, like the way ctlin works.
Thank you again for your input.
Hi Nick, ok You called it pyramidi1, right ?
here is modified hex file, just Device ID is changed.
As I have no mega at hand to flash, could You do it on one
of the arduinos, and check what name does it get ?
If that alone works I will send You easy instructions to go and modify the rest of them.
Holy Sh*t. It worked!! How did you do that? I flashed my mega 2560 with the code you uploaded. When I plugged it into my Mac, and into Max, it came up as Pyramidi1.
So next question: Is there a way that I can customize output01.hex with other names so that each device will have a unique name?
Thank you very much for your input and for putting time into this. This issue has been driving me crazy for years.
Hi Nick, I am glad it works as expected.
I will send You all the infos.
In the meantime I have prepaired Firmware for 6 Arduinos,
with names pyramidi1, pyramidi2, pyramidi3 etc.
I will upload it in few hours, when I get home,
together with all details on what I did.
Thank you for taking the time to explain all this and make those extra firm wares.
So, let’s say i use the amazon news link to name my own drivers, then change the number you specified, which is the vendor and device ID ( I would only change the device ID).
When doing the Hex checksum do I only need to change the one line that I altered? Or do I need to check every line in the file?
Also, Is there a way to send you a message off list? I have some other questions as well.
If you want, here is my email as well: firstname.lastname@example.org
only the lines that are modified need to get new checksum.
I forgot to mention that I also changed Vendor ID from 03EB(atmel)
to 03EF which is not used, in the pyramidi1-6.
If You create new firmwares on amazonaws link, and change the Vendor and / or Device ID,
just take into account that the 8 chars representing HEX numbers could be split into 2 lines.
That depends on the length of chosen name.
That could make searching/replacing the HEX digits a bit more difficult.
If You want to contact me off list -> email@example.com
Coming back to the original problem. Is there a specific reason for different midi channels on those Arduinos? I would set all of them to 1 and then differentiate by the port. Or the Arduinos have to send an information who they are either on request by sending them a specific command and they respond or on initialisation (switch them on after you load your patch).
For sending out midi you always have to specify a channel, no matter which midi object you use. With 4 ctlouts sending to all devices by channel nicely placed inside a subpatcher you can send control data to all your devices. 12 of those midi messages won’t find someone to listen to, but that should not cause any problem….
I would say simple as it is, if one makes Arduino act like midi device, and also maybe as
midi interface as well, sending and receiving on 5 pin midi,
it is essential to know what midi device You are sending data to,
Reducing Arduino to only 1 channel, or trying to create some sort of indentifier etc
by midi messages is a possible, but a bad, uncomplete solution.
In this particular case it is possible to reflash the atmega chip and solve the problem.
In another case when that is not possible, one might go with other workarounds.
Hi Stefan Tiedje,
Yes it is just really time consuming to have to make 4 ctlout’s for everything I do. And it’s easier for programming if the midi devices are the same, except are on different midi channels. It’s hard enough to keep track of what the control numbers are of each sensor. And like I said, for ctlin it’s totally great, it’s just ctlout that is the problem.
I think, for now, definitely reflashing the atmega chip is a great solution for my situation.
Forums > MaxMSP