NEED SOME HELP ON "sendeMIDI"

HEY GUYS !I would like to know what is the connection between sendemidi and value number,like "244", and are there have any document listed those correspondence of numbers.Is there
have any library be used for "sendeMIDI" ?

CODE:

int joyX = 0; //Pitch Bend
int joyY = 0; //CC1 und CC20

int pitchBend = 0;
int controllerWert = 0;

int button = LOW;
int buttonAlt = LOW;
int schalter = 0;

void setup() {
Serial.begin (9600);
pinMode (8, INPUT_PULLUP);
}

void loop() {
joystickAbfragen();
buttonAbfragen();
}

void joystickAbfragen() {
joyX = analogRead(A0);
if (joyX > 530) {
pitchBend = map(joyX,530,1023,65,127);
sendeMIDI(224,0,pitchBend);
}
if (joyX < 520) {
pitchBend = map(joyX,0,520,0,63);
sendeMIDI(224,0,pitchBend);
}
else if ((joyX > 520 && joyX < 530) && pitchBend != 64) {
pitchBend = 64;
sendeMIDI(224,0,pitchBend);
}

joyY = analogRead(A1);
if (joyY > 530) {
controllerWert = map(joyY,530,1023,0,127);
sendeMIDI(176,1,controllerWert);
}
else if (joyY < 520) {
controllerWert = map(joyY,520,0,0,127);
sendeMIDI(176,20,controllerWert);
}
}

void buttonAbfragen() {
button = digitalRead(8);

if (button == LOW && buttonAlt == HIGH) {
if(schalter == 0){
sendeMIDI(176, 64, 127);
schalter = 1;
}
else {
sendeMIDI(176, 64, 0);
schalter = 0;
}
}
buttonAlt = button;
}

void sendeMIDI(int statusByte, int dataByte1, int dataByte2) {
Serial.write(statusByte);
Serial.write(dataByte1);
Serial.write(dataByte2);
}

What does that have to do with Installation and Troubleshooting? You should ask a moderator to move it.

@otomic, your topic has been moved to a more suitable location on the forum. See About the Installation & Troubleshooting category.

Can you please spend some time reading How to get the best out of this forum and next apply what you read about the use of code tags to your post.

That function is stand alone and nothing more is needed.
However it only sends three byte MIDI messages, there are also two byte and one byte messages.

Midi uses 16 channels, and with a three byte message the least significant four bits of the first byte of the message is the channel number. The most significant four bits is the action or what it does.

You can get a summary of the MIdI messages here:-
https://www.midi.org/specifications-old/item/table-1-summary-of-midi-message

There is a lot more to MIDI and I spend almost two thirds of my book explaining and exploring it. I would recommend it, but then I would wouldn’t I.

https://www.apress.com/gb/book/9781484217207

Almost certainly that speed is way too slow for MIDI. What do you want to do with MIDI?
What are you going to connect it to?

Heyyy bro! Now the code content is a joystick to control the ableton through the hairless bridge connection. I also want to add 12 buttons to control the midi note in an octave, but I don’t know how to change and increase the button information in this code, and it can also Transmit midi information through hairless (hairless is a serial to midi communication)

Yeah! you are right, it should not be 9600, it should be 11520, I forgot to modify the post, sry

You need to look at the basic state change example in the IDE. But instead of turning an LED on an off, you send a MIDI note ON message when the button is pressed and a MIDI note OFF message when it is released.

You will find life so much easier if you use Hexadecimal notation for your message numbers. For example 176 in decimal is B0 in hex. To write a number in hex then use the prefix 0x -

Would be the pitch bend message.
The messages you want to send are:-
Note On is 0x90 and note off is 0x80

It looks like you, or whoever wrote that code, might be dyslexic, I am too and I recognise that extra 'e' in the function name as a mistake I would make. It just need to be sendMidi

Or it's just German :wink:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.