I never passed General Math in High School, and I shouldn't try writing code...


i suck @ math. should easy figure out brain. :smiley-cry:

i line 1-18 consolidated line 20, similar line 21.
you'll notice (pitch == x) decreases while velocity of message sent increasing.  can't figure out math in 1 line  :smiley-roll: please , thanks!

code: [select]
  /*else if (pitch == 0x7f) {pt.send(midi::controlchange,0x0d,0x00,1);}
  else if (pitch == 0x7e) {pt.send(midi::controlchange,0x0d,0x01,1);}
  else if (pitch == 0x7d) {pt.send(midi::controlchange,0x0d,0x02,1);}
  else if (pitch == 0x7c) {pt.send(midi::controlchange,0x0d,0x03,1);}
  else if (pitch == 0x7b) {pt.send(midi::controlchange,0x0d,0x04,1);}
  else if (pitch == 0x7a) {pt.send(midi::controlchange,0x0d,0x05,1);}
  else if (pitch == 0x79) {pt.send(midi::controlchange,0x0d,0x06,1);}
  else if (pitch == 0x78) {pt.send(midi::controlchange,0x0d,0x07,1);}
  else if (pitch == 0x77) {pt.send(midi::controlchange,0x0d,0x08,1);}
  else if (pitch == 0x76) {pt.send(midi::controlchange,0x0d,0x09,1);}
  else if (pitch == 0x75) {pt.send(midi::controlchange,0x0d,0x0a,1);}
  else if (pitch == 0x74) {pt.send(midi::controlchange,0x0d,0x0b,1);}
  else if (pitch == 0x73) {pt.send(midi::controlchange,0x0d,0x0c,1);}
  else if (pitch == 0x72) {pt.send(midi::controlchange,0x0d,0x0d,1);}
  else if (pitch == 0x71) {pt.send(midi::controlchange,0x0d,0x0e,1);}
  else if (pitch == 0x70) {pt.send(midi::controlchange,0x0d,0x0f,1);}
  else if (pitch == 0x6f) {pt.send(midi::controlchange,0x0d,0x10,1);}
  else if (pitch == 0x6e) {pt.send(midi::controlchange,0x0d,0x11,1);}
  else if (pitch == 0x6d) {pt.send(midi::controlchange,0x0d,0x12,1);}*/

    else if (pitch >= 0x6d) {pt.send(midi::controlchange,0x0d,pitch+0x00-0x01,1);}    //not good, make above
    else if (pitch <= 0x13) {pt.send(midi::controlchange,0x0d,pitch+0x40-0x01,1);}   //this good

that's pretty vague question. can't tell or you're running on (arduino board wise) "you are, post." internet made of people sets of skills. not miracle workers, if want answer question you, might tell them question is.

no offense intended give work with. , i'm sure happy answer question.


Arduino Forum > Using Arduino > Project Guidance > I never passed General Math in High School, and I shouldn't try writing code...


arduino

Comments