I'm creating my own MIDI Controller using the Arduino MIDI library.
I succeed sending notes into Ableton Live, but I have some problems sending MIDI controls.
I want to trigger a loop with a button but there is lag and Ableton Live just starts to go crazy and I have to close it. Maybe should I use another CC number? or another Arduino input?
I selected cc 16 because it's for general purpose (i read it here: http://nickfever.com/402/production-tips-and-resources/midi-cc-list/)
Here is my code:
#include <MIDI.h>
//Starting MIDI
MIDI_CREATE_DEFAULT_INSTANCE();
//VARIABLES
//the Led will shine while the button is pressed
int led = 13;
//button1 sends note, button2 sends Control Change
int button1 = 2;
int button2 = 4;
//last button state counter
int lastB1State = 0;
int lastB2State = 0;
//curent button state counter
int currentB1State = 0;
int currentB2State = 0;
//Note 60 = C
int note = 60;
//Control 16 = general purpose
int cc = 16;
//Setup:
void setup(){
//Start midi connection
MIDI.begin();
//Serial connection 115200 for Hairless MIDI
Serial.begin(115200);
//input button, output led
pinMode(led, OUTPUT);
pinMode(button1, INPUT);
pinMode(button2, INPUT);
}
//Loop:
void loop(){
//FIRST PART WORKING PERFECT
//BUTTON1 = B1 = piano key
currentB1State = digitalRead(button1);
if( currentB1State == 1){
if (lastB1State == 0) {
MIDI.sendNoteOn(note,127,1);
digitalWrite(led, HIGH);
}
lastB1State = 1;
}else{
if(currentB1State == 0){
if (lastB1State == 1) {
MIDI.sendNoteOff(note,0,1);
digitalWrite(led, LOW);
}
lastB1State = 0;
}
}
//HERE I HAVE PROBLEMS
//BUTTON2 = B2 = CC
currentB2State = digitalRead(button2);
if( currentB2State == 1){
if (lastB2State == 0) {
MIDI.sendControlChange(cc,127,1); //HERE IS WHERE I WANT TO SEND THE CONTROL CHANGE
digitalWrite(led, HIGH);
}
lastB2State = 1;
}else{
if(currentB2State == 0){
if (lastB2State == 1) {
MIDI.sendControlChange(cc,0,1);
digitalWrite(led, LOW);
}
lastB2State = 0;
}
}
//50ms space
delay(50);
}
Thank you very much, now it works with controls like stop tracks, solo, rec, etc... but when I trigger a loop it overflows.
Maybe there are some controls that are better than others? I don't really understand how Midi CC works in Ableton Live.
I want to send Midi CC through a button in order to trigger loops in Ableton Live like in this video Novation // Launchpad - Official promo - YouTube. Is like a binary state where the button is HIGH or LOW, and it doesn't need intermediate values, but I don't know which values I have to send, and why ableton overflows when it recieves Midi CC.
hey rogevila
instead of the configuration you 've maded i would like to have for example 5 button one in each different midi note to controll the drum rack notes
in ableton
The problem was the Ableton Live config. You have to disable the MIDI port output and disable the MIDI clock sync.
It's explained here.
This is a snapshot of my Ableton config now. I can send MIDI notes and use them like Midi CC so the same buttons can be used as a keyboard or a launchapad.
Thanks for your last post @Roger i knew this midi configuration in ableton but was helpfull as well , i appreciate this, i just was asking for something that can explain me how to send different note than C3 in each channel out (pin) cause in the tutorial for the MIDI library i couldn't find it .I'm just a beginner and i'm triyng to write down my own code....P.S. not for you @roger but i also write in other Posts here in the forum and i notice that in this in these ''arduino FORUM'' the kindness is a rare stuff...
Kind regards
your project is cool and helpfull for thousand people who needs some way to configure arduino with ableton.. well done
I think your cultural sensitivity is all wrong.
We are kind in that we give up our time to help you.
Get it into your head that we do not do it for you.
All contain code that will help you learn. So stop trying to make out you are a victim and do a little to educate yourself, and if you get stuck then ask specific questions. Do not ask for some one to write code for you.
thank you very much for you help and suggests @Grumpy_Mike
i learned a lot from this post about configurations , coding ...manners.... and i will follow your suggests trying to write down my own code and changing my manners like a beginner who wants to learn like am i and not just begging people for code
thank you sir !!