You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I try to get this working since a while, but each time I fail :-|
The goal is quite simple:
The code is made on a Raspberry pi pico (RP2040, earlephilhower core), just some custom midi USB controller.. but up to 16 (every one sending on a different channel) of them on one host system. All the same, only a 4 position DIP switch to select the channel.
The embedded side is working quite well but I am aware that multiple MIDI devices with the same name may provoke unexpected behaviour. Also I trie to program a MIDI to OSC Bridge in python (noob level) and I realize that having many ports with the same name is quite disturbing to me. I look at a list with all the same interface name.
So I tried something like this (this should compile even if I didn't checked it, needs Midi.h from Arduino library manager):
#include <Arduino.h>
#include <Adafruit_TinyUSB.h>
#include "MIDI.h"
#define DEBUG
Adafruit_USBD_MIDI usb_midi;
MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MIDI);
uint8_t ID[4] = {10, 11, 12, 13};
void getID()
{
// ID not zero indexed!
id |= !digitalRead(ID[3]) << 3;
id |= !digitalRead(ID[2]) << 2;
id |= !digitalRead(ID[1]) << 1;
id |= !digitalRead(ID[0]);
id += 1;
#ifdef DEBUG
Serial.println();
Serial.print("Interface ID :\t");
Serial.println(id);
Serial.println();
#endif
}
void setupIDpins()
{
for (int i = 0; i <= 3; i++) {
pinMode(ID[i], INPUT_PULLUP);
}
delay(100);
getID();
}
void setup()
{
setupIDpins();
delay(100);
char nam[16];
// MIDI channels are not zero indexed 1-16,
// here I like to have more like "MIDI-INTERFACE 0-F"
// hex identifier to respect a 16byte long Product Descriptor
sprintf(nam, "MIDI-INTERFACE %1X", id - 1);
USBDevice.setProductDescriptor(nam);
usb_midi.setStringDescriptor(nam);
#if defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_RP2040)
// Manual begin() is required on core without built-in support for TinyUSB such as mbed rp2040
TinyUSB_Device_Init(0);
#endif
#ifdef DEBUG
Serial.println();
Serial.print("ID : ");
Serial.println(id);
Serial.print("\n Midi Name :\t");
for (int i = 0; i < sizeof(nam); i++)
{
Serial.print(nam[i]);
}
Serial.print("\n\t\t\t");
Serial.println(sizeof(nam));
Serial.println();
#endif
}
void loop()
{
delay(10);
}
But this doesn't work, the MIDI device is now recognized as "pico".
Until now I used : USBDevice.setProductDescriptor("MIDI-INTERFACE "); usb_midi.setStringDescriptor("TinyUSB MIDI");
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I try to get this working since a while, but each time I fail :-|
The goal is quite simple:
The code is made on a Raspberry pi pico (RP2040, earlephilhower core), just some custom midi USB controller.. but up to 16 (every one sending on a different channel) of them on one host system. All the same, only a 4 position DIP switch to select the channel.
The embedded side is working quite well but I am aware that multiple MIDI devices with the same name may provoke unexpected behaviour. Also I trie to program a MIDI to OSC Bridge in python (noob level) and I realize that having many ports with the same name is quite disturbing to me. I look at a list with all the same interface name.
So I tried something like this (this should compile even if I didn't checked it, needs Midi.h from Arduino library manager):
But this doesn't work, the MIDI device is now recognized as "pico".
Until now I used :
USBDevice.setProductDescriptor("MIDI-INTERFACE "); usb_midi.setStringDescriptor("TinyUSB MIDI");
And this works fine!
Thank you for any ideas,
Simon
Beta Was this translation helpful? Give feedback.
All reactions