-
Notifications
You must be signed in to change notification settings - Fork 270
Closed
Description
Hey, I'm trying to use an Arduino Uno to create a device to do all sorts of MIDI manipulation, including turning PitchBend messages into CC messages (I have a sequencer that doesn't accept pitch bend, but uses a CC value for pitch shifting).
For some reason, in this particular project, when I use MIDI.sendControlChange, I get a load of NoteOn messages:
Link to screenshot on imgur
Here's a simplified version of part of a sketch I've written. I've not mentioned NoteOn at all here - any ideas of what could be happening? Thanks in advance!
#include <MIDI.h>
//constants
#define PITCHBENDMAX 8191
#define PITCHBENDMIN -8192
//variables
int CCPitch = 64;
MIDI_CREATE_DEFAULT_INSTANCE();
void setup()
{
MIDI.begin(MIDI_CHANNEL_OMNI);
MIDI.setHandlePitchBend(TranslatePitchBend);
MIDI.turnThruOff();
}
void loop()
{
MIDI.read();
}
void TranslatePitchBend(byte channel, int bend)
{
CCPitch = 1+ 127* float(
(bend - PITCHBENDMIN)/
float(PITCHBENDMAX-PITCHBENDMIN));
MIDI.sendControlChange(80, CCPitch, channel);
}