- Timestamp:
- Feb 8, 2016, 6:06:52 PM (9 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:
- a33d406
- Parents:
- fa74361
- Location:
- src/tempo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tempo/tempo.c
rfa74361 r7e80dc9 28 28 #include "mathutils.h" 29 29 #include "tempo/tempo.h" 30 31 // TODO implement get/set_delay32 33 /** set current delay34 35 \param o beat tracking object36 37 \return current delay, in samples38 39 */40 uint_t aubio_tempo_get_delay(aubio_tempo_t * o);41 42 /** set current delay43 44 \param o beat tracking object45 \param delay delay to set tempo to, in samples46 47 \return `0` if successful, non-zero otherwise48 49 */50 uint_t aubio_tempo_set_delay(aubio_tempo_t * o, uint_t delay);51 30 52 31 /* structure to store object state */ … … 70 49 uint_t total_frames; /** total frames since beginning */ 71 50 uint_t last_beat; /** time of latest detected beat, in samples */ 72 uint_t delay; /** delay to remove to last beat, in samples */51 sint_t delay; /** delay to remove to last beat, in samples */ 73 52 uint_t last_tatum; /** time of latest detected tatum, in samples */ 74 53 uint_t tatum_signature; /** number of tatum between each beats */ … … 125 104 uint_t aubio_tempo_get_last (aubio_tempo_t *o) 126 105 { 127 return o->last_beat -o->delay;106 return o->last_beat + o->delay; 128 107 } 129 108 … … 138 117 } 139 118 140 uint_t aubio_tempo_set_delay(aubio_tempo_t * o, uint_t delay) {119 uint_t aubio_tempo_set_delay(aubio_tempo_t * o, sint_t delay) { 141 120 o->delay = delay; 121 return AUBIO_OK; 122 } 123 124 uint_t aubio_tempo_set_delay_s(aubio_tempo_t * o, smpl_t delay) { 125 o->delay = delay * o->samplerate; 126 return AUBIO_OK; 127 } 128 129 uint_t aubio_tempo_set_delay_ms(aubio_tempo_t * o, smpl_t delay) { 130 o->delay = 1000. * delay * o->samplerate; 142 131 return AUBIO_OK; 143 132 } … … 145 134 uint_t aubio_tempo_get_delay(aubio_tempo_t * o) { 146 135 return o->delay; 136 } 137 138 smpl_t aubio_tempo_get_delay_s(aubio_tempo_t * o) { 139 return o->delay / (smpl_t)(o->samplerate); 140 } 141 142 smpl_t aubio_tempo_get_delay_ms(aubio_tempo_t * o) { 143 return o->delay / (smpl_t)(o->samplerate) / 1000.; 147 144 } 148 145 -
src/tempo/tempo.h
rfa74361 r7e80dc9 185 185 smpl_t aubio_tempo_get_last_tatum(aubio_tempo_t *o); 186 186 187 /** get current delay 188 189 \param o beat tracking object 190 191 \return current delay, in samples 192 193 */ 194 uint_t aubio_tempo_get_delay(aubio_tempo_t * o); 195 196 /** get current delay in seconds 197 198 \param o beat tracking object 199 200 \return current delay, in seconds 201 202 */ 203 smpl_t aubio_tempo_get_delay_s(aubio_tempo_t * o); 204 205 /** get current delay in ms 206 207 \param o beat tracking object 208 209 \return current delay, in milliseconds 210 211 */ 212 smpl_t aubio_tempo_get_delay_ms(aubio_tempo_t * o); 213 214 /** set current delay 215 216 \param o beat tracking object 217 \param delay delay to set tempo to, in samples 218 219 \return `0` if successful, non-zero otherwise 220 221 */ 222 uint_t aubio_tempo_set_delay(aubio_tempo_t * o, sint_t delay); 223 224 /** set current delay in seconds 225 226 \param o beat tracking object 227 \param delay delay to set tempo to, in seconds 228 229 \return `0` if successful, non-zero otherwise 230 231 */ 232 uint_t aubio_tempo_set_delay_s(aubio_tempo_t * o, smpl_t delay); 233 234 /** set current delay 235 236 \param o beat tracking object 237 \param delay delay to set tempo to, in samples 238 239 \return `0` if successful, non-zero otherwise 240 241 */ 242 uint_t aubio_tempo_set_delay_ms(aubio_tempo_t * o, smpl_t delay); 243 187 244 /** delete tempo detection object 188 245
Note: See TracChangeset
for help on using the changeset viewer.