Arduino and ableton

Hi
I've been trying to find a way to make my arduino talk to Ableton Live.
I want to connect piezos to the arduino and control drums in Ableton. I've had some succes using s2midi and midiyoke. With the example sketch in the s2midi download I can control one drum. I want more. But I have no idea how to write a sketch for it. I've been searching for something like this, (here should be a link to the Ardrumo, but I'm apparently not allowed to post links yet) , but haven't been able to find anything. Can anyone lead me in the right direction?
Thanks.

If i'm not much wrong, then all you need is to send MIDI note on messages possibly with velocity, and midi note off messages .

There are many many Arduino + MIDI projects around the big interweb.

One that springs to mind is :

http://todbot.com/blog/2006/10/29/spooky-arduino-projects-4-and-musical-arduino/

Yeah, I've been reading through that a couple of times. But he uses hardware to send midi. I just want to use software.
http://code.google.com/p/ardrumo/

You cant send MIDI without extra HW.

The MIDI spec. requires that MIDI connections are optoisolated, so you need the optoisolator and a few resistors.

Otherwise you should investigate MIDI over serial, but that probably requires a serial MIDI driver on the PC end, that seems to be what he does in the post you linked.

you can send MIDI messages through the serial port, and have something (I use PureData, maybe Bome is OK) read the serial port and send MIDI messages through a virtual MIDI cable (midiyoke or, if you have windows 7 64-bit, loopbe1 or loopbe30).

In my current project, the arduino sends OSC messages to the serial port, the messages are read bu PD and translated to MIDI messages.

There are many solutions to your problem :slight_smile:

Thanks for the input. I already have my arduino sending piezo hits through s2midi and midyoke to Ableton Live. But the sketch I found was for one digital input. I want to use the analog inputs and I want to use all of them. That was what I was looking for a sketch for. I learn faster when I have the right answer to work from.

Ok. I found what I needed, but now I've run in to another problem.
I used this sketch

//
// BY: MARK DEMERS Copywrite 20009
// April. 2009
// VERSION: 1.b
//
// DESCRIPTION:
// Arduino analog input used to sense piezo drum hits then sent serialy to processing.
//
// Required - Hardware:
// 1. Drum kit - kit (From SpikenzieLabs.com)
// 2. Arduino
//
// Required - Software:
// 1. Serial MIDI converter
// 2. Garage Band, Ableton Live etc ...
//
// LEGAL:
// This code is provided as is. No guaranties or warranties are given in any form. It is your responsibilty to
// determine this codes suitability for your application.

//*******************************************************************************************************************
// User settable variables
//*******************************************************************************************************************

unsigned char PadNote[6] = {52,16,66,63,40,65}; // MIDI notes from 0 to 127 (Mid C = 60)

int PadCutOff[6] = {600,600,600,600,600,600}; // Minimum Analog value to cause a drum hit

int MaxPlayTime[6] = {90,90,90,90,90,90}; // Cycles before a 2nd hit is allowed

#define midichannel 0; // MIDI channel from 0 to 15 (+1 in "real world")

boolean VelocityFlag = true; // Velocity ON (true) or OFF (false)

//*******************************************************************************************************************
// Internal Use Variables
//*******************************************************************************************************************

boolean activePad[6] = {0,0,0,0,0,0}; // Array of flags of pad currently playing
int PinPlayTime[6] = {0,0,0,0,0,0}; // Counter since pad started to play

unsigned char status;

int pin = 0;
int hitavg = 0;

//*******************************************************************************************************************
// Setup
//*******************************************************************************************************************

void setup()
{
Serial.begin(57600); // connect to the serial port 115200
}

//*******************************************************************************************************************
// Main Program
//*******************************************************************************************************************

void loop()
{
for(int pin=0; pin < 6; pin++)
{
hitavg = analogRead(pin); // read the input pin

if((hitavg > PadCutOff[pin]))
{
if((activePad[pin] == false))
{
if(VelocityFlag == true)
{
// hitavg = 127 / ((1023 - PadCutOff[pin]) / (hitavg - PadCutOff[pin])); // With full range (Too sensitive ?)
hitavg = (hitavg / 8) -1 ; // Upper range
}
else
{
hitavg = 127;
}

MIDI_TX(144,PadNote[pin],hitavg);
PinPlayTime[pin] = 0;
activePad[pin] = true;
}
else
{
PinPlayTime[pin] = PinPlayTime[pin] + 1;
}
}
else if((activePad[pin] == true))
{
PinPlayTime[pin] = PinPlayTime[pin] + 1;

if(PinPlayTime[pin] > MaxPlayTime[pin])
{
activePad[pin] = false;
MIDI_TX(128,PadNote[pin],127);
}
}
}
}

//*******************************************************************************************************************
// Transmit MIDI Message
//*******************************************************************************************************************
void MIDI_TX(unsigned char MESSAGE, unsigned char PITCH, unsigned char VELOCITY)
{
status = MESSAGE + midichannel;
Serial.print(status);
Serial.print(PITCH);
Serial.print(VELOCITY);
}

I run it through s2midi and midiyoke and use drum samples in Ableton Live. It works great except there is a lot of latency.
I've tried different baud rates, but even at 115000 I still get very notacable latency.
Anyone know how to fix this?

Have you tried to use the same setup with another MIDI input device than Arduino ?

Maybe is't not Arduino but s2midi or midiyoke that is causing the latency ?