drum pad, midi controller for Ableton live

Status
Not open for further replies.

seayaker

Active member
Can anyone tell me how to get Ableton live to recognize the teensly 3.6? I downloaded the Arduino and Teensyduino, have the 3.6 on a breadboard with a piezo connected to first analog + and ground Is there a some simple code I could download just to get it working and go from there? Any help is greatly appreciated.

What is the code used for this? https://www.youtube.com/watch?v=QpKEve9p7yw
 
Last edited:
In Arduino, first make sure you have the correct Teensy selected in Tools > Boards.

Then click File > Examples > Teensy > USB_MIDI > Buttons

Before you upload, you also need to click Tools > USB Type and change it to MIDI. By default Arduino+Teensyduino makes your Teensy become a serial device. This is the place where to tell it to turn your Teensy into a USB MIDI device.

Then click the Upload button.

A few seconds after Teensy starts running the Buttons example, you should see a new MIDI device. Open it with Ableton or whatever other software you like. Connect buttons to the first few pins, or just use a wire or paperclip to touch them to the GND pin to "press" the buttons. This example sends note on / off codes, but hopefully it's easy to understand and can give you a good starting point for more interesting work.
 
Thanks for responding, I got to the point where I can open it in Ableton and trigger notes by touching the wires. Now I need to trigger with a piezo and make it velocity sensitive. Anyone who has done this and can guide me I'd appreciate it.
 
Last edited:
I still can't get the piezo to trigger anything, for example note 36 which is the kick drum, is set up in my DAW tested with another midi device. I connect the Teensy 3.6 which triggered a note with the buttons sketch but cannot get it to work with any of the piezo drum sketches. I have a 1m ohm resistor connected across the piezo which puts out 1 volt max. still get nothing with any analog pins. I tried changing to serial+midi hoping to see it on the serial monitor it does not show, is there a way to see what is being triggered and map it to the right midi note?

Code:
/*
Arduino-Drum 
Project's decription can be found here: http://arduinodrumkit.blogspot.com/
*/

#include <MIDI.h> 
MIDI_CREATE_DEFAULT_INSTANCE();

//analog Arduino's inputs
const int Pad1 = A0;
const int Pad2 = A1;
const int Pad3 = A2;
const int Pad4 = A3;
const int Pad5 = A4;

//volume threshold variable, being used to determine
//if user stikes the drum pad
const int volumeThreshold = 380;

//variables for volume magnitude of each drum pad
int Drum1_val = 0;
int Drum2_val = 0;
int Drum3_val = 0;
int Drum4_val = 0;
int Drum5_val = 0;

//variables used in program logic
//variables used in proces of separation of vibrtion from
//exact force impact
int signalTest2 = 0;
int signalTest1 = 0;
int signalTest3 = 0;
int signalTest4 = 0;
int signalTest5 = 0;

//midi mapping - addictive drums mapping
byte snareDrum = 38;
byte kick = 36; 
byte hihatClosed = 53;
byte crash = 77;
byte hihatOpened = 56;

void setup()
{
  MIDI.begin(4);
  //starts serial communication between arduino na serial USB port
  Serial.begin(115200); 
}

void loop()
{ 
  /*1st pad*/
  //checks if magnitude of analoginput is higher than volumeThreshold
  if(analogRead(Pad1) >= volumeThreshold) 
  {
  signalTest1 = 1;
  }
  //if magnitude of analoginput was higher than volumeThreshold
  //program checks again if the signal is decreasing
  //if so, it means that drum pad was hit
  if(signalTest1 == 1 && analogRead(Pad1) <= (volumeThreshold-100))
  {
    //sets the velocity
    Drum1_val= analogRead(Pad1);
    int velocity = Drum1_val/3 + 78;
    if(velocity >= 120)
      velocity = 125;
    else if(velocity < 0)
      velocity = 0;

    //sends midi signal over USB serial port
    MIDI.sendNoteOn(hihatOpened, velocity, 1);
    MIDI.sendNoteOff(hihatOpened, 0, 1);
    //sets signalTest again to 0
    signalTest1 = 0;
  }

  /*2nd pad*/
  if(analogRead(Pad2) >= volumeThreshold) 
  {
  signalTest2 = 1;
  } 
  Drum2_val = analogRead(Pad2);
  if(signalTest2 == 1 && analogRead(Pad2) <= (volumeThreshold-95))
  {
   Drum2_val= analogRead(Pad2);
   int velocity = Drum2_val/3 + 35;
   
   if(velocity >= 120)
      velocity = 125;
    else if(velocity < 0)
      velocity = 0;  
      
    MIDI.sendNoteOn(snareDrum, velocity, 1);
    MIDI.sendNoteOff(snareDrum, 0, 1);
    signalTest2 = 0;
  }

  /*3rd pad*/
  if(analogRead(Pad3) >= volumeThreshold) 
  {
  signalTest3 = 1; 
  }
  Drum3_val = analogRead(Pad3);
  if(signalTest3 == 1 && analogRead(Pad3) <= (volumeThreshold-95))
  {
   Drum3_val= analogRead(Pad3);
   int velocity = Drum3_val/2 + 77;
   
   if(velocity >= 120)
      velocity = 125;
    else if(velocity < 0)
      velocity = 0;
      
    MIDI.sendNoteOn(hihatClosed, velocity, 1);
    MIDI.sendNoteOff(hihatClosed, 0, 1);
    signalTest3 = 0;
  }

  /*4th pad*/
  if(analogRead(Pad4) >= volumeThreshold) 
  {
  signalTest4 = 1; 
  }
  if(signalTest4 == 1 && analogRead(Pad4) <= (volumeThreshold-95))
  {
   Drum4_val= analogRead(Pad4);
   int velocity = Drum4_val/3 + 75;
   
   if(velocity > 120)
      velocity = 125;
    else if(velocity < 0)
      velocity = 0;  
      
    MIDI.sendNoteOn(crash, velocity, 1);
    MIDI.sendNoteOff(crash, 0, 1);
    signalTest4 = 0;
  }

  /*5th pad*/
  if(analogRead(Pad5) >= volumeThreshold) 
  {
  signalTest5 = 1; 
  Drum5_val = analogRead(Pad5);
  }
  if(signalTest5 == 1 && analogRead(Pad5) <= (volumeThreshold-95))
  {
   int velocity = Drum5_val; 
   if(velocity >= 12)
      velocity = 125;
    else if(velocity < 0)
      velocity = 0;   
       
    MIDI.sendNoteOn(kick, velocity, 1);
    MIDI.sendNoteOff(kick, 0, 1);
    signalTest5 = 0;
  }
}
 
Last edited:
Status
Not open for further replies.
Back
Top