Teensy 3.0 USB MIDI crashing?

usedtobe

Member
Hello!

I'm playing with some super simple USB MIDI code, but it keeps crashing. Anyone have any ideas why?

I'm running Arduino 1.0.4 on OSX 10.6.8, Teensyduino version 1.15

byte cc = 0;
byte last_cc = 0;
void setup() {
analogReadResolution(10);
analogReadAveraging(4);
}

void loop() {
cc = analogRead(0) >> 3;


if(abs(last_cc - cc) > 3) {
usbMIDI.sendControlChange(1, cc, 1);
last_cc = cc;
}


}

Not much goin on here. I have a pot wired as a voltage divider with the wiper connected to A0. It starts up fine, then I map it to a parameter in ableton live, works for about 30 seconds, then stops sending any midi. If I reset, it works again (but only for ~30s, then stops again)

Thanks in advance!
 
it stops sending? or stops receiving? my guess is that you might be sending your midi data a bit too fast. midi baud rate is just 31250bps, and certain hardware (and i figure software) can handle much less. try using a timer
 
Last edited:
it stops sending? or stops receiving? my guess is that you might be sending your midi data a bit too fast. midi baud rate is just 31250bps, and certain hardware (and i figure software) can handle much less. try using a timer

MIDI baud rate over DIN is 31250. Over USB its 12000000 (12Mbit/sec).
As Paul posted in the other thread, this is likely due to the Teensy MIDI receive buffer not being read, and eventually filling up. The sending is fine. The problem is that Ableton is talking back.
 
Last edited:
Back
Top