wvanderveeb
Member
Hi everyone,
First time poster, long time lurker here. I haven't found a thread on this specific issue yet, so I appreciate any help you all can give!
I am working on a project where (among other things) I am using a Teensy 3.2 to receive Midi data through both/either USB Midi, or a 5 Din Midi connector on the RX1 pin, and pass it through to a separate synth chip attached to the TX1 pin. As of now, I can plug a midi controller into the 5din connector and it passes the midi data through from RX1 to TX1 like a dream with like 5 lines of code:
Great!
However, I can't for the life of me get midi data coming in from USB Midi, to output to the TX1 pin. I have tried using basically the same code, which throws a compile error:
I have also tried using the method shown on the usbMidi library page, where you set handlers in setup (such as "usbMIDI.setHandleNoteOff(myNoteOff);") and have a separate loop that triggers for various note events. Those separate loops will compile and work fine for just about anything EXCEPT sending midi data to TX1 it seems. For example, this is fine:
But neither of these will work:
I have confirmed that I have the most up-to-date versions of both the Arduino IDE, and Teensyduino. Does anyone have a hot tip on how I can read data coming from usbMidi and use good 'ole MIDI.send on it?
Thanks, I really appreciate any input!
-Wesley
First time poster, long time lurker here. I haven't found a thread on this specific issue yet, so I appreciate any help you all can give!
I am working on a project where (among other things) I am using a Teensy 3.2 to receive Midi data through both/either USB Midi, or a 5 Din Midi connector on the RX1 pin, and pass it through to a separate synth chip attached to the TX1 pin. As of now, I can plug a midi controller into the 5din connector and it passes the midi data through from RX1 to TX1 like a dream with like 5 lines of code:
Code:
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
void setup() {
MIDI.begin();
}
void loop() {
if (MIDI.read())
{
MIDI.send(MIDI.getType(),
MIDI.getData1(),
MIDI.getData2(),
MIDI.getChannel());
}
}
Great!
However, I can't for the life of me get midi data coming in from USB Midi, to output to the TX1 pin. I have tried using basically the same code, which throws a compile error:
Code:
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
void setup() {
MIDI.begin();
usbMIDI.begin();
}
void loop() {
// RX1 to TX1
if (MIDI.read())
{
MIDI.send(MIDI.getType(),
MIDI.getData1(),
MIDI.getData2(),
MIDI.getChannel());
}
}
//USB Midi to TX1
if (usbMIDI.read())
{
MIDI.send(usbMIDI.getType(),
usbMIDI.getData1(),
usbMIDI.getData2(),
usbMIDI.getChannel());
}
}
I have also tried using the method shown on the usbMidi library page, where you set handlers in setup (such as "usbMIDI.setHandleNoteOff(myNoteOff);") and have a separate loop that triggers for various note events. Those separate loops will compile and work fine for just about anything EXCEPT sending midi data to TX1 it seems. For example, this is fine:
Code:
void myControlChange(byte channel, byte control, byte value) {
Serial.print("Control Change, ch=");
Serial.print(channel, DEC);
Serial.print(", control=");
Serial.print(control, DEC);
Serial.print(", value=");
Serial.print(value, DEC);
Serial.println();
}
But neither of these will work:
Code:
void myNoteOn(byte channel, byte note, byte velocity) {
MIDI.send(usbMIDI.getType(),
usbMIDI.getData1(),
usbMIDI.getData2(),
usbMIDI.getChannel());
}
void myNoteOff(byte channel, byte note, byte velocity) {
MIDI.send(0x80, note, velocity, 1);
}
I have confirmed that I have the most up-to-date versions of both the Arduino IDE, and Teensyduino. Does anyone have a hot tip on how I can read data coming from usbMidi and use good 'ole MIDI.send on it?
Thanks, I really appreciate any input!
-Wesley