Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Teensy 3 CC Messages Crashing Ableton Live 9

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    8

    Teensy 3 CC Messages Crashing Ableton Live 9

    I've just wrote a simple sketch that sends CC messages 0-127 from a potentiometer. As soon as I uploaded the sketch, Ableton live 9 which was currently running crashed. As soon as I tried to reboot, it gets as far as the splash screen then crashes again.

    Code:
    #define kMidiChannel 1
    #define kMidiControl 1
    
    void setup() {
      
    }
    
    void loop() {
      
      int val = analogRead(14);
      val = map(val, 0, 1023, 0, 127);
      
      usbMIDI.sendControlChange(kMidiControl, val, kMidiChannel);
    
      while (usbMIDI.read()); // read and discard any incoming MIDI messages
        
    }
    I'm using a Mac on 10.9.2

    Update: When I remove the code from the loop and recompile, Ableton seems to be stable. When I paste it back I get the same problem.
    Last edited by daz1761; 03-24-2014 at 08:49 PM.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,023
    This program will send MIDI control changes as fast as analogRead provides data, which is very fast on Teensy 3.

    The USB code on Teensy 3 is very fast and efficient.

    You might think a 96 MHz 32 bit microcontroller with 64K of RAM would not be able to overwhelm a 2+ GHz 64 bit processor with gigabytes of RAM, but even with Teensy 2.0 it sometimes happens. Teensy 3.0 and 3.1 are much faster, so you need to be careful not to transmit data so fast that you overwhelm the software running on the Mac.

    Try adding a 50 ms delay. Better yet, store the previously transmitted value and don't send again if it hasn't changed.

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    8
    Thanks for the reply

    Try adding a 50 ms delay. Better yet, store the previously transmitted value and don't send again if it hasn't changed.
    This has solved the crashing issue, but I can't get my potentiometer to learn a MIDI parameter within Ableton. Again, all seems ok in Max.

    In the mean time I'll have a go at your other solution that sends the CC message only if the value has changed.

    Click image for larger version. 

Name:	Ableton.png 
Views:	164 
Size:	21.4 KB 
ID:	1718

    Weirdly, when the teensy is first plugged in, Ableton names it "Teensy MIDI", but as soon as you attempt to learn some MIDI parameters, then go back to the preferences, it shows as "USB MIDI Device".
    Last edited by daz1761; 03-24-2014 at 10:02 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •