- Timestamp:
- Nov 2, 2015, 11:15:31 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:
- 8605361, f4cc4a8
- Parents:
- 810b3b6
- Location:
- src/tempo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tempo/tempo.c
r810b3b6 r95748a6 71 71 uint_t last_beat; /** time of latest detected beat, in samples */ 72 72 uint_t delay; /** delay to remove to last beat, in samples */ 73 uint_t last_tatum; /** time of latest detected tatum, in samples */ 74 uint_t tatum_signature; /** number of tatum between each beats */ 73 75 }; 74 76 … … 114 116 } 115 117 o->last_beat = o->total_frames + (uint_t)ROUND(tempo->data[0] * o->hop_size); 118 o->last_tatum = o->last_beat; 116 119 } 117 120 } … … 215 218 onset2 = new_fvec(1); 216 219 }*/ 220 o->last_tatum = 0; 221 o->tatum_signature = 4; 217 222 return o; 218 223 … … 238 243 smpl_t aubio_tempo_get_confidence(aubio_tempo_t *o) { 239 244 return aubio_beattracking_get_confidence(o->bt); 245 } 246 247 uint_t aubio_tempo_was_tatum (aubio_tempo_t *o) 248 { 249 uint_t last_tatum_distance = o->total_frames - o->last_tatum; 250 smpl_t beat_period = aubio_tempo_get_period(o); 251 smpl_t tatum_period = beat_period / o->tatum_signature; 252 if (last_tatum_distance < o->hop_size) { 253 o->last_tatum = o->last_beat; 254 return 2; 255 } 256 else if (last_tatum_distance > tatum_period) { 257 if ( last_tatum_distance + o->hop_size > beat_period ) { 258 // next beat is too close, pass 259 return 0; 260 } 261 o->last_tatum = o->total_frames; 262 return 1; 263 } 264 return 0; 265 } 266 267 smpl_t aubio_tempo_get_last_tatum (aubio_tempo_t *o) { 268 return (smpl_t)o->last_tatum - o->delay; 269 } 270 271 uint_t aubio_tempo_set_tatum_signature (aubio_tempo_t *o, uint_t signature) { 272 if (signature < 1 || signature > 64) { 273 return AUBIO_FAIL; 274 } else { 275 o->tatum_signature = signature; 276 return AUBIO_OK; 277 } 240 278 } 241 279 -
src/tempo/tempo.h
r810b3b6 r95748a6 161 161 smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o); 162 162 163 /* set number of tatum per beat 164 165 \param o beat tracking object 166 \param signature number of tatum per beat (between 1 and 64) 167 168 */ 169 uint_t aubio_tempo_set_tatum_signature(aubio_tempo_t *o, uint_t signature); 170 171 /* check whether a tatum was detected in the current frame 172 173 \param o beat tracking object 174 175 \return 2 if a beat was detected, 1 if a tatum was detected, 0 otherwise 176 177 */ 178 uint_t aubio_tempo_was_tatum(aubio_tempo_t *o); 179 180 /* get position of last_tatum, in samples 181 182 \param o beat tracking object 183 184 */ 185 smpl_t aubio_tempo_get_last_tatum(aubio_tempo_t *o); 186 163 187 /** delete tempo detection object 164 188
Note: See TracChangeset
for help on using the changeset viewer.