Skip to content

sendPitchBend #239

Answered by franky47
RiNoize asked this question in Q&A
Aug 30, 2021 · 3 comments · 4 replies
Discussion options

You must be logged in to vote

Here's what a sketch that continuously sends PitchBend messages based on a potentiometer reading would look like:

#include <MIDI.h>

// User settings
static const int pitchBendPotPin            = A0;
static const int analogMaxResolutionBits    = 10; // max 10, reduce to filter out noise
static const byte midiOutputChannel         = 1;

// Computed settings
static const int analogFilterShift  = 10 - analogMaxResolutionBits;
static const int analogMaxValue     = (1 << analogMaxResolutionBits) - 1;

MIDI_CREATE_DEFAULT_INSTANCE();

void setup()
{
  MIDI.begin();
}

void loop()
{
  // Read the potentiometer value (10 bits of resolution)
  const int rawPitchBendPotValue = analogRead(pitchBendP…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@RiNoize
Comment options

@franky47
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@franky47
Comment options

@RiNoize
Comment options

Answer selected by franky47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants