Bonjour a tous
Avec un arduino uno je souhaiterai communiquer en MIDI avec des ports DIN Classique IN et OUT
Mon Arduino uno connecté en usb a l'ordinateur et un DAW

J'ai donc réalisé et également acheté une interface midi din pour arduino
Le but étant de communiquer en midi avec un instrument externe (Midi Note,Pitch,Velocity....)
mais egalement synchroniser le TEMPO d'un Daw avec cet instrument externe.
J ai effectué plusieurs test avec differents programmes en utilsant la Bibliotheque Midi Pour l'arduini
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
MIDI.begin(MIDI_CHANNEL_OMNI);
MIDI.turnThruOff();
MIDI.setHandleNoteOn(MyHandleNoteOn);
MIDI.setHandleNoteOff(MyHandleNoteOff);
MIDI.setHandleControlChange(MyHandleControlChange);
MIDI.setHandleProgramChange(MyHandleProgramChange);
MIDI.setHandlePitchBend(MyHandlePitchBend);
MIDI.setHandleClock(MyHandleClock);
}
void loop() {
MIDI.read();
}
void MyHandleNoteOn(byte channel, byte number, byte velocity) {
MIDI.sendNoteOn(number, velocity, 1);
digitalWrite(LED_BUILTIN, HIGH);
}
void MyHandleNoteOff(byte channel, byte number, byte velocity) {
MIDI.sendNoteOff(number, velocity, 1);
digitalWrite(LED_BUILTIN, LOW);
}
void MyHandleControlChange(byte channel, byte number, byte value) {
MIDI.sendControlChange(number, value, 1);
}
void MyHandleProgramChange(byte channel, byte program) {
MIDI.sendProgramChange(program, 1);
}
void MyHandlePitchBend(byte channel, int value) {
MIDI.sendPitchBend(value, 1);
}
void MyHandleClock(byte tempo) {
MIDI.sendRealTime(tempo);
}
Le deuxième programme utilise un timer
#include <MIDI.h>
#include <MsTimer2.h>
using namespace midi;
MIDI_CREATE_DEFAULT_INSTANCE();
#define PPQ 24
float bpm = 110.0;
float delay_time = (60000000 / bpm) / 24;
// when the sequencer starts, set the timer with the new tempo, something like 75 or 125, a normal bpm.
void setTimer(int beatsPerMinute)
{
// sync period in milliSeconds
int period = ((1000L * 60)/beatsPerMinute)/PPQ;
MsTimer2::set(period, syncMIDI);
MsTimer2::start();
}
// Called by timer
void syncMIDI()
{
Serial.write(0xF8); // Midi Clock Sync Tick
}
void handleNoteOn(byte pitch, byte velocity, byte channel) {
MIDI.sendNoteOn(pitch, velocity, channel);
}
void handleNoteOff(byte pitch, byte velocity, byte channel) {
MIDI.sendNoteOff(pitch, velocity, channel);
}
void handleCC(byte ctrlNum, byte ctrlVal, byte channel) {
MIDI.sendControlChange(ctrlNum, ctrlVal, channel);
}
void handleClock()
{
MIDI.sendRealTime(Clock);
}
void handleStart()
{
MIDI.sendRealTime(Start);
}
void handleStop()
{
MIDI.sendRealTime(Stop);
}
void handleCont()
{
MIDI.sendRealTime(Continue);
}
void setup()
{
Serial.begin(115200);
while (!Serial);
MIDI.begin(MIDI_CHANNEL_OMNI);
MIDI.setHandleNoteOn(handleNoteOn);
MIDI.setHandleNoteOff(handleNoteOff);
MIDI.setHandleControlChange(handleCC);
MIDI.setHandleClock(handleClock);
MIDI.setHandleStart(handleStart);
MIDI.setHandleStop(handleStop);
MIDI.setHandleContinue(handleCont);
}
void loop()
{
MIDI.read();
}
Pour communiquer avec l'arduino en midi je passe par le logiciel HairLess Midi
Comme Synthetiseur j'utilse un SUB 37 et comme DAW ableton Live
J'ai également testé cette solution qui n'a aboutie a rien car rien ne se passe.
Ce que j'obtiens à l'heure actuelle ;
-Lorsque j'appuie sur une note du synthétiseur la note Midi est bien envoyé vers ableton Live
-Lorsque j'effectue un action via le synthtiseur un message midi envoyé
-Lorsque je passe en synchronisation externe via ableton et que je fait varie le tempo de l'arpeggiator du synthétiseur je vois dans Ableton une variation du tempo
-Ableton perd La synchronisation avec l'instrument externe
Autre chose de bizzare également dans Hairless Midi J'ai toujours un Note OFF qui en envoyé.
Est ce que ce que je veux réaliser est possible avec un arduino uno ?

