Pages: [1]   Go Down
Author Topic: Renaming an Arduino midi device....  (Read 2977 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have 2 midi devices that are Arduino based and each uses an Arduino Mega. It's a little confusing when they are plugged in because both show up on my computer as "Moco for Lufa 1" or "Moco for Lufa 2" and it really has nothing to do with what order they are plugged in, as either one could be device 1 or 2. It's a little confusing, but not that big a deal as each one is on a different midi channel.

However I am now considering adding a third Arduino based midi controller to my setup and it might get really confusing to have them all have the same name. Is there something I can add to my code that will enable me to change what name my computer will call this device when I plug it in?


Thank you in advance for any help.

Nick
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I guess this might be something people don't know how to do. Just checking again incase anyone might have any input or be able to lead me in the right direction.

thank you again, Nick
Logged

Offline Offline
Edison Member
*
Karma: 49
Posts: 1666
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think this is a common problem in Windows when you have multiple identical MIDI devices (e.g. 2 or 3 identical keyboards). Windows distinguishes them by just adding a number and as you have discovered it doesn't always assign the same number to the same device. The only sure way I can think of to get around it would be if you have the ability to change the actual device name within the MIDI device. i.e. if you can get at the device software and change "Moco for Lufa" to "Moco for Lufa A" in one of them and "Moco for Lufa B" in the next etc.
A less certain way would be to always power each device up in the same order and power them down in the reverse order but Windows will probably find a way to screw that up too.

Pete
Logged

Yorkshire England
Offline Offline
Sr. Member
****
Karma: 2
Posts: 267
Arduino good init
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You are using the Mega as a USB MIDI device? It sounds like you are and if so the channel the midi is on is irrelevant as each device have 16 channels. Do yo have a separate midi interface using the standard 'old' 5 pin din? This is what you would use if you wanted then all on the same device i.e the midi interface. That's what midi 'thru' was for to pass channel information onto the next device. Sound like you a bit confused as to how midi works.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi again,

Thank you for all your replies. Sorry I left out some details. I am using 2 arduinos now going into a USB hub, and that goes into my computer USB port, which is a Mac. No midi cables, or thru devices used at all.  The arduinos are on different Midi Channels and everything is working. They show up as Moco for Lufa 1 and Moco for Lufa 2, which is annoying, but I can work with it. In terms of midi in this is not a big deal since the devices are on separate midi channels. For midi out it's annoying because, even though they are on separate channels, I have to send the midi out message to both devices. Part of the problem is I am using Maxmsp and you have to specify the device for midi out. To be sure it works I just send out messages to both devices. FYI I'm sending digital out messages to turn on and off LEDs.

I can see that as I make more devices, which I want to do, this will get more confusing. I just wanted to know if there is anyway to give Arduino midi controllers a unique name. This would be very helpful and if anyone has any insight please let me know.

thanks again for your help.

Nick
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34532
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Look at the end of this project for changing the name of a USB device
http://www.thebox.myzen.co.uk/Hardware/Mini_Monome.html
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Grumpy Mike,

Wow, that is an incredible interface. Thank you so much for the info and I enjoyed reading about that interface. I'm going to find a friend with a windows machine and try that out.

thanks, Nick
Logged

Nice, France
Offline Offline
Full Member
***
Karma: 11
Posts: 237
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You are using the Mega as a USB MIDI device? It sounds like you are and if so the channel the midi is on is irrelevant as each device have 16 channels. Do yo have a separate midi interface using the standard 'old' 5 pin din?

The original poster is using MIDI-over-USB, not MIDO over 5-pin DIN connectors. However, unless you have come across MOCP for LUFA before it would be easy to miss that.

This is what you would use if you wanted then all on the same device i.e the midi interface. That's what midi 'thru' was for to pass channel information onto the next device.

MIDI over USB does not chain like that. On the other hand, each device has an actual name, rather than being described as 'whatever MIDI interface' that you plugged it into.

Sound like you a bit confused as to how midi works.

That conclusion does not really follow. It is increasingly common for MIDI devices to connect over USB.
Logged

Nice, France
Offline Offline
Full Member
***
Karma: 11
Posts: 237
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Look at the end of this project for changing the name of a USB device
http://www.thebox.myzen.co.uk/Hardware/Mini_Monome.html

Really nicely documented! I'm vaguely aware of OSC but it looked scarily complicated compared to MIDI so I am starting with MIDI. Despite the fact that one of the controllers I'm building can't really use MIDI as the note-on note-off style is inappropriate for continuous pitch controllers.

I will have a read of your project and see if OSC might be an option for that part.
Logged

Yorkshire England
Offline Offline
Sr. Member
****
Karma: 2
Posts: 267
Arduino good init
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes i know, or think i do/did. I wasnt impliying that you use usb midi in a thru configuration. But as i understand you are creating a midi device as such each device has sixteen channels of midi avalable to it. By adding another device you are adding sidteen more but on a, seperate, midi network. They they are connected via th sequancer. Cubase can run hundreds of channels of midi but they are in groups of sixteen via seprate devices. So as i said you will only get a channel conflict if youre on th swme device. If i,m wrong and the device you are using actualy represents just one channel, but you would still have a common device. Maybe youre right.
Logged

Nice, France
Offline Offline
Full Member
***
Karma: 11
Posts: 237
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Aha, I see what you mean. But I don't think the OP was having a problem with channel conflicts. Instead, they were having a problem with inconsistent device names. I can see how that would be really irritating if you save a project in your DAW where 'Moco for Lufa 1' is controlling some synth, but when you reload the project you have to edit it because that physical device now is called 'Moco for Lufa 2' and 'Moco for Lufa 1' is something else.

The basic problem is that the USB spec allows a manufacturer name and a device name, these are typically hardcoded in firmware and not user editable. So if you have two of the same device then Windows tacks on a number to distinguish them; and that number can change.

If you make two Arduino MIDI devices, say a keyboard and a set of drum pads, both using the same USB controller part, it would be better to be able to edit the device name to something meaningful like 'Super Padset' or 'Awesome Key61' or whatever.

However it looks as if you have to register as a manufacturer and get assigned some code. The values are not simple text strings.

Looking in the HIDUNNO source, Descriptors.c, I see:

Code:
.VendorID               = 0x03EB,
.ProductID              = 0x2048,
.ReleaseNumber          = VERSION_BCD(00.01),

.ManufacturerStrIndex   = 0x01,
.ProductStrIndex        = 0x02,

oh but wait, later on I see

Code:
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
 *  and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
 *  Descriptor.
 */
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header                 = {.Size = USB_STRING_LEN(8), .Type = DTYPE_String},

.UnicodeString          = L"HIDUINO"
};

that looks editable.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nantonos,

So in your last post are you suggesting that I upload Descriptors.c into my code? I still haven't tried Grumpy Mike's suggestion as I am having a hard time finding a friend with a windows machine.

Descriptors.c looks editable, but where would you type in what you would like to name the device? Next to .UnicodeString   maybe?

If you have a suggestion please let me know and thank you for your help.

Nick
Logged

Nice, France
Offline Offline
Full Member
***
Karma: 11
Posts: 237
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nantonos,

So in your last post are you suggesting that I upload Descriptors.c into my code?

Not exactly. I was suggesting editing Descriptors.c and then recompiling HIDUNNO to make a new library with a modified name and product ID.

Descriptors.c looks editable, but where would you type in what you would like to name the device? Next to .UnicodeString   maybe?

It looks as if you would change from
Code:
.ProductID              = 0x2048,

.UnicodeString          = L"HIDUINO"
to
Code:
.ProductID              = 0x2049,

.UnicodeString          = L"NICK001"
« Last Edit: September 25, 2012, 02:41:17 pm by Nantonos » Logged

Pages: [1]   Go Up
Jump to: