Problems with Sending MIDI CC to Ableton

Hallo everyone,

This my first time on the forum and I need to specify I am veeeeery new to this all and these are my very first steps trying to put something together with Arduino and especially with programming.
So, I hope not to upset anyone with any stupid question. I know what will follow will be probably too easy for many in this forum that might not even be taken seriously… but I am in need of some advice on how to put together this project I am working on.

Here we go…

What I would like to achieve is being able to control the commands PLAY and STOP (via USB) for each scene in Ableton with buttons connected to the Arduino board.
My set up consist in ARDUINO Duemilanove (Atmega328) connected via USB to a Macbook pro to SERIAL-MIDI Converter V2 and eventually to Ableton 9.
Now, the code I am using does transfer MIDI since I can trigger some drum sounds in Ableton, altho I have a few problems here:

The code specify exactly the NOTE on/off - CHN - VELOCITY but what I need instead (I guess) it is MIDI CC messages to map to PLAY & STOP. is it right? This is the first hurdle since I don’t
really know how it should be programmed :~
I have also spent the whole yesterday on the web trying to find a suitable solution but a lot of what I’ve found was way too advanced or
the codes weren’t compiling properly, which means I was stuck anyway since, as mentioned already, I am still pretty useless with programming…even worst trying to find mistakes in it…

Other problem I seem to have is the different buttons trigger different sounds (sometimes) but they all arrive into Channel 10 in Ableton, Any idea why?

And last but not least, some buttons seem to work fine, others instead I cannot get them to work. I have used different buttons, changed jumpers, tried different pin, changed resistor, moved to different position on the BreadBoard…still not working. :cold_sweat:

I am adding down here the code and a small picture of my set up hoping it will help you to understand slightly better…

I apologies in advance if I have been very confusing :sweat_smile:

Looking forward to hear from you guys, and finally start getting out of the mud…even if just a finger! :grin:

#define drumchan 9 // Equates to MIDI Channel 10
// general midi drum notes
#define note_bassdrum 43
#define note_snaredrum 38
#define note_hihatclosed 42
// define the pins we use
#define switchAPin 7
#define switchBPin 6
#define switchCPin 40
#define ledPin 13 // for midi out status
int switchAState = LOW;
int switchBState = LOW;
int switchCState = LOW;
int currentSwitchState = LOW;
int val,t;
void setup() {
pinMode(switchAPin, INPUT);
pinMode(switchBPin, INPUT);
pinMode(switchCPin, INPUT);
digitalWrite(switchAPin, HIGH); // turn on internal pullup
digitalWrite(switchBPin, HIGH); // turn on internal pullup
digitalWrite(switchCPin, HIGH); // turn on internal pullup
pinMode(ledPin, OUTPUT);
Serial.begin(57600); // set MIDI baud rate
}


void loop() {

// deal with switchA
currentSwitchState = digitalRead(switchAPin);
if( currentSwitchState == LOW && switchAState == HIGH ) // push
noteOn(drumchan, note_bassdrum, 100);

if( currentSwitchState == HIGH && switchAState == LOW ) // release
noteOff(drumchan, note_bassdrum, 0);
switchAState = currentSwitchState;

// deal with switchB
currentSwitchState = digitalRead(switchBPin);
if( currentSwitchState == LOW && switchBState == HIGH ) // push
noteOn(drumchan, note_snaredrum, 100);

if( currentSwitchState == HIGH && switchBState == LOW ) // release
noteOff(drumchan, note_snaredrum, 0);
switchBState = currentSwitchState;

// deal with switchC
currentSwitchState = digitalRead(switchCPin);
if( currentSwitchState == LOW && switchCState == HIGH ) // push
noteOn(drumchan, note_hihatclosed, 100);
if( currentSwitchState == HIGH && switchCState == LOW ) // release
noteOff(drumchan, note_hihatclosed, 0);
switchCState = currentSwitchState;

// Send a MIDI note on message. Like pressing a piano key

// channel ranges from 0 15

}
void noteOn(byte channel, byte note, byte velocity) {
midiMsg( (0x90 | channel), note, velocity);
}

// Send a MIDI note off message. Like releasing a piano key

void noteOff(byte channel, byte note, byte velocity) {
midiMsg( (0x80 | channel), note, velocity);
}

// Send a general MIDI message
void midiMsg(byte cmd, byte data1, byte data2) {
digitalWrite(ledPin,HIGH); // indicate we're sending MIDI data
Serial.write(byte(cmd));
Serial.write(byte(data1));
Serial.write(byte(data2));
digitalWrite(ledPin,LOW);
}

Hi,

I'm currently having problems getting Serial-MIDI converter to work on my MAC, but I thinks I can help with your problem, from my understanding SMC has the limitation of only dealing with Note-on, off and Controller change messages, PLAY and STOP come under MIDI Machine Control, or MMC which is a SysEx message which I don't think it handles.

As I said I havent even got to first base with SMC so I cant test this for you, but this limitation is on their Web Site, but it has been ages since I have used MIDI, On some sequencers you can map MIDI note ons to start and Stop the sequencer, would that help you?

Pedantic

PS Im a newbe as well so hopefully a more experienced arduino and SMC user can with confirm this or correct me