Skip to content

Instantly share code, notes, and snippets.

@polyclick
Last active January 10, 2018 13:49
Show Gist options
  • Select an option

  • Save polyclick/34bcc062a3883a96e16b0d4615e339fa to your computer and use it in GitHub Desktop.

Select an option

Save polyclick/34bcc062a3883a96e16b0d4615e339fa to your computer and use it in GitHub Desktop.

Revisions

  1. polyclick revised this gist Jan 10, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions synesthesia-snippet-openframeworks.cpp
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,10 @@ float timeDiff = ofGetElapsedTimef() - lastPitchChangeTime;

    if(roundedCurrPitch != roundedPrevPitch && pitchConfidence > minimumConf && timeDiff > pitchRelease) {

    // send off note of previous note
    // first, send [off note] for previous note
    midiOut.sendNoteOff(channel, roundedPrevPitch);

    // send current note over midi
    // 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;
  2. polyclick renamed this gist Dec 6, 2017. 1 changed file with 0 additions and 0 deletions.
  3. polyclick created this gist Dec 6, 2017.
    16 changes: 16 additions & 0 deletions synesthesia-snippet-openframeworks
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    float timeDiff = ofGetElapsedTimef() - lastPitchChangeTime;

    if(roundedCurrPitch != roundedPrevPitch && pitchConfidence > minimumConf && timeDiff > pitchRelease) {

    // send off note of previous note
    midiOut.sendNoteOff(channel, roundedPrevPitch);

    // send current note 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();
    }