Changeset f761f06
- Timestamp:
- Oct 2, 2018, 2:56:52 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
- Children:
- 6bba139
- Parents:
- c7155e9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/notes/notes.c
rc7155e9 rf761f06 26 26 27 27 #define AUBIO_DEFAULT_NOTES_SILENCE -70. 28 #define AUBIO_DEFAULT_NOTES_LEVEL_DROP 10. 28 29 // increase to 10. for .1 cent precision 29 30 // or to 100. for .01 cent precision … … 57 58 58 59 uint_t isready; 60 61 smpl_t last_onset_level; 62 smpl_t level_delta_db; 59 63 }; 60 64 … … 101 105 aubio_notes_set_silence(o, AUBIO_DEFAULT_NOTES_SILENCE); 102 106 aubio_notes_set_minioi_ms (o, AUBIO_DEFAULT_NOTES_MINIOI_MS); 107 108 o->last_onset_level = AUBIO_DEFAULT_NOTES_SILENCE; 109 o->level_delta_db = AUBIO_DEFAULT_NOTES_LEVEL_DROP; 103 110 104 111 return o; … … 185 192 //notes->data[0] = o->curnote; 186 193 //notes->data[1] = 0.; 194 //AUBIO_WRN("notes: sending note-off at onset, not enough level\n"); 187 195 notes->data[2] = o->curnote; 188 196 } else { … … 192 200 /* kill old note */ 193 201 //send_noteon(o->curnote,0, o->samplerate); 202 //AUBIO_WRN("notes: sending note-off at onset, new onset detected\n"); 194 203 notes->data[2] = o->curnote; 195 204 /* get and send new one */ … … 199 208 o->curnote = new_pitch; 200 209 } 210 o->last_onset_level = curlevel; 201 211 } 202 212 } else { 203 if (o->median) { 213 if (curlevel < o->last_onset_level - o->level_delta_db) 214 { 215 // send note off 216 //AUBIO_WRN("notes: sending note-off, release detected\n"); 217 notes->data[0] = 0; 218 notes->data[1] = 0; 219 notes->data[2] = o->curnote; 220 // reset last_onset_level to silence_threshold 221 o->last_onset_level = o->silence_threshold; 222 o->curnote = 0; 223 } 224 else if (o->median) 225 { 204 226 if (o->isready > 0) 205 227 o->isready++; … … 208 230 /* kill old note */ 209 231 //send_noteon(curnote,0); 210 notes->data[2] = o->curnote; 232 if (o->curnote != 0) 233 { 234 //AUBIO_WRN("notes: sending note-off, new note detected\n"); 235 notes->data[2] = o->curnote; 236 } 211 237 o->newnote = aubio_notes_get_latest_note(o); 212 238 o->curnote = o->newnote;
Note: See TracChangeset
for help on using the changeset viewer.