Changeset 0b6a8a8
- Timestamp:
- Dec 17, 2016, 12:12:42 PM (8 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, sampler, yinfft+
- Children:
- 6c85b3a
- Parents:
- 17b08e6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/notes/notes.c
r17b08e6 r0b6a8a8 25 25 #include "notes/notes.h" 26 26 27 #define DEFAULT_NOTES_SILENCE -50. 27 #define AUBIO_DEFAULT_NOTES_SILENCE -70. 28 // increase to 10. for .1 cent precision 29 // or to 100. for .01 cent precision 30 #define AUBIO_DEFAULT_CENT_PRECISION 1. 31 #define AUBIO_DEFAULT_NOTES_MINIOI_MS 30. 28 32 29 33 struct _aubio_notes_t { … … 81 85 o->pitch = new_aubio_pitch (pitch_method, o->pitch_buf_size, o->hop_size, o->samplerate); 82 86 if (o->pitch_tolerance != 0.) aubio_pitch_set_tolerance (o->pitch, o->pitch_tolerance); 87 aubio_pitch_set_unit (o->pitch, "midi"); 83 88 o->pitch_output = new_fvec (1); 84 89 … … 93 98 o->newnote = 0.; 94 99 95 aubio_notes_set_silence(o, DEFAULT_NOTES_SILENCE); 100 aubio_notes_set_silence(o, AUBIO_DEFAULT_NOTES_SILENCE); 101 aubio_notes_set_minioi_ms (o, AUBIO_DEFAULT_NOTES_MINIOI_MS); 96 102 97 103 return o; … … 143 149 note_buffer->data[i] = note_buffer->data[i + 1]; 144 150 } 145 note_buffer->data[note_buffer->length - 1] = curnote; 151 //note_buffer->data[note_buffer->length - 1] = ROUND(10.*curnote)/10.; 152 note_buffer->data[note_buffer->length - 1] = ROUND(AUBIO_DEFAULT_CENT_PRECISION*curnote); 146 153 return; 147 154 } 148 155 149 static uint_t156 static smpl_t 150 157 aubio_notes_get_latest_note (aubio_notes_t *o) 151 158 { 152 uint_t i; 153 for (i = 0; i < o->note_buffer->length; i++) { 154 o->note_buffer2->data[i] = o->note_buffer->data[i]; 155 } 156 return fvec_median (o->note_buffer2); 159 fvec_copy(o->note_buffer, o->note_buffer2); 160 return fvec_median (o->note_buffer2) / AUBIO_DEFAULT_CENT_PRECISION; 157 161 } 158 162
Note: See TracChangeset
for help on using the changeset viewer.