Hi, I am using the following example to experiment with transposing incoming MIDI notes with a Teensy LC, using a hardware MIDI circuit:
The above sketch works as expected where the incoming MIDI note C3 (48) plays an additional C2 (36) . So the note is effectively "doubled" C2/C3.Code://Arduino for Musicians //Listing 5.8: MIDI Library input callback #include <MIDI.h> MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI); const byte transposition = -12; //transpose all input down 12 semitones //Define the callback functions. Parameters and return value must match the //values listed in the MIDI library: void myHandleNoteOn(byte channel, byte note, byte velocity) { MIDI.sendNoteOn(note + transposition, velocity, channel); } void myHandleNoteOff(byte channel, byte note, byte velocity) { MIDI.sendNoteOff(note + transposition, velocity, channel); } void setup() { //Connect the callback functions to the MIDI library MIDI.setHandleNoteOn(myHandleNoteOn); MIDI.setHandleNoteOff(myHandleNoteOff); MIDI.begin(MIDI_CHANNEL_OMNI); // Listen on all channels } void loop() { //Call MIDI.read(). MIDI class will automatically call callback //functions as needed. MIDI.read(); }
What I am trying to accomplish is have the sketch play only the lower octave and struggling to come up with a way to "filter" out the base incoming note and have only the lower octave play...
Would I need to do something to the effect of "zero-ing" out the velocity of the base note (C3 for example) or is there another suggested approach?
Still learning the basics here so any help or hints to a solution is greatly appreciated.