Last active
January 10, 2018 13:49
-
-
Save polyclick/34bcc062a3883a96e16b0d4615e339fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float timeDiff = ofGetElapsedTimef() - lastPitchChangeTime; | |
if(roundedCurrPitch != roundedPrevPitch && pitchConfidence > minimumConf && timeDiff > pitchRelease) { | |
// first, send [off note] for previous note | |
midiOut.sendNoteOff(channel, roundedPrevPitch); | |
// send current note value over midi | |
// scale the ascii values to midi velocity range 0-127 | |
// see an ascii table: http://www.asciitable.com/ | |
velocity = 127 * pitch.pitchConfidence; | |
midiOut.sendNoteOn(channel, roundedCurrPitch, velocity); | |
prevPitch = currPitch; | |
lastPitchChangeTime = ofGetElapsedTimef(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment