Pitch-bend / Vibrato using Force Sensitive Resistor (FSR )


i making midi musical instrument using arduino controlling wav-trigger sd card sample player
i wish add vibrato using fsr.
i trying achieve adding vibrato msb , lsb existing,
  // send midi note-on message. ( so)
pitch_bend(channel, bendlsb, bendmsb, serialchannels );

this example rough idea code trying below;

//read vibrato pin - if it's changed change bend value msb , lsb
vibratoval = analogread(vibratopin);         // read fsr
if ( vibratoval <  min_pressure){
int pitchbend= 8192;  // no bend
} else
   {
int  pitchbend = map( vibratoval, min_pressure, max_pressure, ,8192, 9640);//use min 600 -max 680 pressure range measured fsr
pitchbend = constrain (pitchbend ,8192, 9640); // (aprox)+1 semitone

my questions decimal numbers pitch bend use in mapping equation 1 semitone bend correct ,( max possible bend range+ 5 semitones) , basic sketch on right track , more important wish convert pitchbend msb , lsb pass midi note-on message, how do this?
for converting decimal pitchbend values binary lsb ,msb way;
  byte lowvalue = pitchbend & 0x7f;     byte highvalue = pitchbend >> 7;  ?
can please code achieve aims?

i'm not midi expert...

according this page amount of pitch bend particular integer value depends on instrument/device.

do know real  min_pressure & max_pressure readings you're getting fsr?  if not, you'll need write little test program find out.

of course vibrato, you'll need pitch-shift positive & negative.

to msb & lsb, look-up bit masking & bit shifting.   i.e. if mask (block-out) 8 msbs 16-bit integer you're left 8 lsbs, , can convert byte (8-bits).   and, if right-shift 8-bits, 8-msbs shifted 8-lsb locations zeros shifted msb positions , can convert/read 8-msbs byte.

...bit manipulation may confusing if not used working binary (or hexadecimal) numbers, because doesn't make sense decimal numbers...   but, when you  see regular decimal integer, remember it's really  binary inside computer (or inside arduino).


Arduino Forum > Using Arduino > Audio > Pitch-bend / Vibrato using Force Sensitive Resistor (FSR )


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts