Der neue Sketch ergänzt das Arduino Midi Filter mit der Weitergabe der Midi Clock zur Temposynchronisation (Arduino-Midi-Library ist Voraussetzung):
#include <MIDI.h>
// Arduino Midi Filter
// Version 1.1 by Christian Streng
// Midi Out is on Channel 1.
// www.christianstreng.de/arduino-midi-filter
MIDI_CREATE_DEFAULT_INSTANCE();
void setup() {
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);
}
void MyHandleNoteOff(byte channel, byte number, byte velocity) {
MIDI.sendNoteOff(number, velocity, 1);
}
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);
}
2
2 comments