Changeset 8c3f717
- Timestamp:
- Apr 10, 2013, 6:43:02 PM (12 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, pitchshift, sampler, timestretch, yinfft+
- Children:
- e8bc8e9
- Parents:
- 2693655
- Location:
- src/pitch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitch/pitch.c
r2693655 r8c3f717 36 36 #include "pitch/pitch.h" 37 37 38 #define DEFAULT_PITCH_SILENCE -50. 39 38 40 /** pitch detection algorithms */ 39 41 typedef enum … … 83 85 aubio_pitch_convert_t conv_cb; /**< callback to convert it to the desired unit */ 84 86 aubio_pitch_get_conf_t conf_cb; /**< pointer to the current confidence callback */ 87 smpl_t silence; /**< silence threshold */ 85 88 }; 86 89 … … 131 134 aubio_pitch_set_unit (p, "default"); 132 135 p->bufsize = bufsize; 136 p->silence = DEFAULT_PITCH_SILENCE; 133 137 p->conf_cb = NULL; 134 138 switch (p->type) { … … 281 285 } 282 286 287 uint_t 288 aubio_pitch_set_silence (aubio_pitch_t * p, smpl_t silence) 289 { 290 if (silence < 0 && silence > -200) { 291 p->silence = silence; 292 return AUBIO_OK; 293 } else { 294 AUBIO_ERR("pitch: could do set silence to %.2f", silence); 295 return AUBIO_FAIL; 296 } 297 } 298 299 smpl_t 300 aubio_pitch_get_silence (aubio_pitch_t * p) 301 { 302 return p->silence; 303 } 304 283 305 284 306 /* do method, calling the detection callback, then the conversion callback */ … … 287 309 { 288 310 p->detect_cb (p, ibuf, obuf); 311 if (aubio_silence_detection(ibuf, p->silence) == 1) { 312 obuf->data[0] = 0.; 313 } 289 314 obuf->data[0] = p->conv_cb (obuf->data[0], p->samplerate, p->bufsize); 290 315 } -
src/pitch/pitch.h
r2693655 r8c3f717 83 83 uint_t aubio_pitch_set_unit (aubio_pitch_t * o, char_t * mode); 84 84 85 /** set the silence threshold of the pitch detection object 86 87 \param o pitch detection object as returned by new_aubio_pitch() 88 \param silence level threshold under which pitch should be ignored, in dB 89 90 */ 91 uint_t aubio_pitch_set_silence (aubio_pitch_t * o, smpl_t silence); 92 93 /** set the silence threshold of the pitch detection object 94 95 \param o pitch detection object as returned by new_aubio_pitch() 96 97 \param return level threshold under which pitch should be ignored, in dB 98 99 */ 100 smpl_t aubio_pitch_get_silence (aubio_pitch_t * o); 101 85 102 /** get the current confidence 86 103
Note: See TracChangeset
for help on using the changeset viewer.