Teensy++ 2.0 Midi Controller - Issues with triggering notes in Ableton

Status
Not open for further replies.

Joooop

Member
Hello! I'm working on a DIY Arcade Button midi controller: http://imgur.com/a/Y1dwy

I had a few issues with some possible defective I/O on my teensy. Luckily, I wasn't using all of the inputs on the board so I still had enough room for all 40 buttons. Now that I have all the buttons working, I'm seeing some strange interactions when triggering them in Ableton (the DAW I intend on using my controller with). First of all, samples only play (when using the drum rack) after I've let go of the button. So If I leave a button pressed, I will get no sound until letting go of it. Also, It looks like the notes are getting stuck on after pressing the buttons.

Here's an example of triggering samples with my DIY controller: https://gyazo.com/25c6c550a1dd3d35aa7ac4b3c8080b49
(The buttons stay "on" even though i've already let go of them and at the end of the GIF, I show what holding down a button (D1) looks like)

and here's an example of what I'm aiming for (This is what it looks like triggering buttons with my Launchpad controller) : https://gyazo.com/1aebc738f89243142a1b3d8766690a67
(The buttons only stay on if I hold them and they turn off after released.)

Here is my code, I'm using the bounce library:

Code:
#include <Bounce.h>  // Bounce library makes button change detection easy
const int channel = 1;



// Pad One 4x4
Bounce button0 = Bounce(0, 5);
Bounce button1 = Bounce(33, 5); // Original Pin 1 Defective
Bounce button2 = Bounce(34, 5); // Original Pin 2 Defective
Bounce button3 = Bounce(3, 5);
Bounce button4 = Bounce(4, 5);
Bounce button5 = Bounce(5, 5); 
Bounce button6 = Bounce(32, 5); // Original Pin 6 Defective
Bounce button7 = Bounce(7, 5);
Bounce button8 = Bounce(8, 5);
Bounce button9 = Bounce(9, 5);
Bounce button10 = Bounce(10, 5);
Bounce button11 = Bounce(11, 5);
Bounce button12 = Bounce(12, 5);
Bounce button13 = Bounce(13, 5);
Bounce button14 = Bounce(14, 5);
Bounce button15 = Bounce(15, 5);

// Pad Two 4x4
Bounce button16 = Bounce(16, 5);
Bounce button17 = Bounce(17, 5);
Bounce button18 = Bounce(18, 5);
Bounce button19 = Bounce(19, 5);
Bounce button20 = Bounce(20, 5);
Bounce button21 = Bounce(21, 5);
Bounce button22 = Bounce(22, 5);
Bounce button23 = Bounce(23, 5);
Bounce button24 = Bounce(24, 5);
Bounce button25 = Bounce(25, 5);
Bounce button26 = Bounce(26, 5);
Bounce button27 = Bounce(27, 5);
Bounce button28 = Bounce(28, 5);
Bounce button29 = Bounce(29, 5);
Bounce button30 = Bounce(30, 5);
Bounce button31 = Bounce(31, 5);

// Top Row
Bounce button38 = Bounce(38, 5);
Bounce button39 = Bounce(39, 5);
Bounce button40 = Bounce(40, 5);
Bounce button41 = Bounce(41, 5);
Bounce button42 = Bounce(42, 5);
Bounce button43 = Bounce(43, 5);
Bounce button44 = Bounce(44, 5);
Bounce button45 = Bounce(45, 5);

void setup() {
  pinMode(0, INPUT_PULLUP);
  pinMode(33, INPUT_PULLUP); // Original Pin 1 Defective
  pinMode(34, INPUT_PULLUP); // Original Pin 2 Defective
  pinMode(3, INPUT_PULLUP);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP); 
  pinMode(32, INPUT_PULLUP); // Original Pin 6 Defective
  pinMode(7, INPUT_PULLUP);
  pinMode(8, INPUT_PULLUP);
  pinMode(9, INPUT_PULLUP);
  pinMode(10, INPUT_PULLUP);
  pinMode(11, INPUT_PULLUP);
  pinMode(12, INPUT_PULLUP);
  pinMode(13, INPUT_PULLUP);
  pinMode(14, INPUT_PULLUP);
  pinMode(15, INPUT_PULLUP);
  
  pinMode(16, INPUT_PULLUP);
  pinMode(17, INPUT_PULLUP);
  pinMode(18, INPUT_PULLUP);
  pinMode(19, INPUT_PULLUP);
  pinMode(20, INPUT_PULLUP);
  pinMode(21, INPUT_PULLUP);
  pinMode(22, INPUT_PULLUP);
  pinMode(23, INPUT_PULLUP);
  pinMode(24, INPUT_PULLUP);
  pinMode(25, INPUT_PULLUP);
  pinMode(26, INPUT_PULLUP);
  pinMode(27, INPUT_PULLUP);
  pinMode(28, INPUT_PULLUP);
  pinMode(29, INPUT_PULLUP);
  pinMode(30, INPUT_PULLUP);
  pinMode(31, INPUT_PULLUP);
  
  pinMode(38, INPUT_PULLUP);
  pinMode(39, INPUT_PULLUP);
  pinMode(40, INPUT_PULLUP);
  pinMode(41, INPUT_PULLUP);
  pinMode(42, INPUT_PULLUP);
  pinMode(43, INPUT_PULLUP);
  pinMode(44, INPUT_PULLUP);
  pinMode(45, INPUT_PULLUP);
}

void checkButton(int note, Bounce pushButton) {
  pushButton.update();

  if (pushButton.fallingEdge()) {
    usbMIDI.sendNoteOn(note, 99, channel);
  }

  if (pushButton.risingEdge()) {
    usbMIDI.sendNoteOff(note, 0, channel);
  }
  
}

void loop() {
  checkButton(36, button0);
  checkButton(37, button1);
  checkButton(38, button2);
  checkButton(39, button3);
  checkButton(40, button4);
  checkButton(41, button5);
  checkButton(42, button6);
  checkButton(43, button7);
  checkButton(44, button8);
  checkButton(45, button9);
  checkButton(46, button10);
  checkButton(47, button11);
  checkButton(48, button12);
  checkButton(49, button13);
  checkButton(50, button14);
  checkButton(51, button15);
  
  checkButton(52, button16);
  checkButton(53, button17);
  checkButton(54, button18);
  checkButton(55, button19);
  checkButton(56, button20);
  checkButton(57, button21);
  checkButton(58, button22);
  checkButton(59, button23);
  checkButton(60, button24);
  checkButton(61, button25);
  checkButton(62, button26);
  checkButton(63, button27);
  checkButton(64, button28);
  checkButton(65, button29);
  checkButton(66, button30);
  checkButton(67, button31);

  
  checkButton(104, button38);
  checkButton(105, button39);
  checkButton(106, button40);
  checkButton(107, button41);
  checkButton(108, button42);
  checkButton(109, button43);
  checkButton(110, button44);
  checkButton(111, button45);
  
}

Sorry for the lack of comments but this is pretty straight forward.

So am I doing something wrong with my teensy sketch? Is it not possible to use the bounce library to get the button triggers im looking for? Is this a problem/setting in ableton? Any help would be appreciated.
 
Last edited:
Problem fixed. The issue was that I was calling pushButton.update(); individually before every rise / fall check. To fix this, I just took that part out of checkButton() and I individually updated each button before checking them all.
 
Status
Not open for further replies.
Back
Top