Go Down

Topic: Arduino to work with hairless MIDI, loop Midi to Ableton  (Read 3238 times) previous topic - next topic

HelpPlease218

Hi guys,

Using push buttons and potentiometer, I am trying to send variables from Arduino to Midi to Ableton, so i can assign those variables to the function on Ableton (such as the play function, or volume for potentiometer)

I have attached the code, but that assign a note to the potentiometer, as i turn the potentiometer, it plays that note on the Ableton. How do i send empty variables so i can assign it myself to the desire function on Ableton?  I am still new to the MIDI functions.
Code: [Select]

byte noteON = 144;//note on command
int potPin = A0;
byte push=13;
void setup() {
 Serial.begin(9600);
 
}

void loop() {
 
 int potVal = analogRead(potPin);//read data from potentiometer
 // (this is the range of MIDI notes)
 byte velocity = map(potVal, 0, 1023, 0, 127);
 byte note = 100;
 
 MIDImessage(noteON, note, velocity);//turn note on
 delay(300);//hold note for 300ms
 MIDImessage(noteON, note, 0);//turn note off (note on with velocity 0)
 delay(200);//wait 200ms until triggering next note
}

//send MIDI message
void MIDImessage(byte command, byte data1, byte data2) {
 Serial.write(command);
 Serial.write(data1);
 Serial.write(data2);

Thank you in Advance for Help

Grumpy_Mike

There is no such thing as an empty variable.

Read the rules and post your code correctly.

HelpPlease218

#2
Mar 21, 2016, 12:27 am Last Edit: Mar 21, 2016, 12:35 am by HelpPlease218
Then how can i assign push button on Ableton from arduino using Midi to the desire function on Ableton such as Play, Stop or Loop?

Grumpy_Mike

Then how can i assign push button on Ableton from arduino using Midi to the desire function on Ableton such as Play, Stop or Loop?
Use CC messages and assign them to a function in Ableton.

HelpPlease218

http://nickfever.com/music/midi-cc-list
This link has all the Midi CC, does that mean i have to assign them as variable in arduino send it. i am not i have seen people have this part in their codes. Why serial print?

Code: [Select]

void sendMessage ( char x, char x)

Serial.print(some argument);
Serial.print(argument);
Serial.print(argument);
 

Grumpy_Mike

Quote
Why serial print?
No, you do not use Serial print you use Serial write. You use it because you are sending data over a serial link.
That piece of code is incomplete.

Quote
does that mean i have to assign them as variable in arduino
No they are not variables, they are MIDI messages that the Arduino sends. It in in Ableton that you have to map these messages to the things you want them to do.

HelpPlease218

So i look at the midi cc list and MIDI cc 16-19 is for general purpose. Would I declare the varible X=midi CC16 and serial write X to the Ableton?

Thank you for all your help

Grumpy_Mike

Quote
Would I declare the varible X=midi CC16 and serial write X to the Ableton?
No.
You send a CC message. This consists of three bytes. The first byte is a combination of channel number and command, the most significant four bits being the command and the least significant four bits being the channel number. For a CC message on channel 0 ( you might call it channel 1 ) this works out to be the the number 0xB0 - this is in hexadecimal format to make it easy to work out.

The next byte is the CC channel number which can range from 0 to 127, so in your case this would be 16. The last byte is the CC value which can range from 0 to 127. This might be 0 for off and 127 for on. Then you send all three bytes to the MIDI output.

I do not have Ableton so I don't know how you tell it to map the received CC to an action. 

Go Up