Changes in / [34e505f:8605361]
- Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/sink_apple_audio.c
r34e505f r8605361 37 37 extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int segmentSize); 38 38 extern void freeAudioBufferList(AudioBufferList *bufferList); 39 extern CFURLRef getURLFromPath(const char * path);39 extern CFURLRef createURLFromPath(const char * path); 40 40 char_t *getPrintableOSStatusError(char_t *str, OSStatus error); 41 41 … … 138 138 139 139 AudioFileTypeID fileType = kAudioFileWAVEType; 140 CFURLRef fileURL = getURLFromPath(s->path);140 CFURLRef fileURL = createURLFromPath(s->path); 141 141 bool overwrite = true; 142 142 OSStatus err = noErr; 143 143 err = ExtAudioFileCreateWithURL(fileURL, fileType, &clientFormat, NULL, 144 144 overwrite ? kAudioFileFlags_EraseFile : 0, &s->audioFile); 145 CFRelease(fileURL); 145 146 if (err) { 146 147 char_t errorstr[20]; -
src/io/source_apple_audio.c
r34e505f r8605361 52 52 extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int max_source_samples); 53 53 extern void freeAudioBufferList(AudioBufferList *bufferList); 54 extern CFURLRef getURLFromPath(const char * path);54 extern CFURLRef createURLFromPath(const char * path); 55 55 char_t *getPrintableOSStatusError(char_t *str, OSStatus error); 56 56 … … 99 99 100 100 // open the resource url 101 CFURLRef fileURL = getURLFromPath(path);101 CFURLRef fileURL = createURLFromPath(path); 102 102 err = ExtAudioFileOpenURL(fileURL, &s->audioFile); 103 CFRelease(fileURL); 103 104 if (err == -43) { 104 105 AUBIO_ERR("source_apple_audio: Failed opening %s, " -
src/io/utils_apple_audio.c
r34e505f r8605361 34 34 } 35 35 36 CFURLRef getURLFromPath(const char * path) {36 CFURLRef createURLFromPath(const char * path) { 37 37 CFStringRef cfTotalPath = CFStringCreateWithCString (kCFAllocatorDefault, 38 38 path, kCFStringEncodingUTF8); 39 39 40 returnCFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath,40 CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath, 41 41 kCFURLPOSIXPathStyle, false); 42 CFRelease(cfTotalPath); 43 return url; 42 44 } 43 45 -
src/pitch/pitchmcomb.c
r34e505f r8605361 336 336 uint_t run = 0; 337 337 for (cur = 0; cur < nbins; cur++) { 338 run = cur + 1; 339 for (run = cur; run < nbins; run++) { 338 for (run = cur + 1; run < nbins; run++) { 340 339 if (candidates[run]->ene > candidates[cur]->ene) 341 340 CAND_SWAP (candidates[run], candidates[cur]); … … 352 351 uint_t run = 0; 353 352 for (cur = 0; cur < nbins; cur++) { 354 run = cur + 1; 355 for (run = cur; run < nbins; run++) { 353 for (run = cur + 1; run < nbins; run++) { 356 354 if (candidates[run]->ebin < candidates[cur]->ebin) 357 355 CAND_SWAP (candidates[run], candidates[cur]); -
src/tempo/beattracking.c
r34e505f r8605361 410 410 411 411 smpl_t 412 aubio_beattracking_get_period (aubio_beattracking_t * bt) 413 { 414 return bt->hop_size * bt->bp; 415 } 416 417 smpl_t 418 aubio_beattracking_get_period_s (aubio_beattracking_t * bt) 419 { 420 return aubio_beattracking_get_period(bt) / (smpl_t) bt->samplerate; 421 } 422 423 smpl_t 412 424 aubio_beattracking_get_bpm (aubio_beattracking_t * bt) 413 425 { 414 426 if (bt->bp != 0) { 415 return 60. * bt->samplerate/ bt->bp / bt->hop_size;427 return 60. / aubio_beattracking_get_period_s(bt); 416 428 } else { 417 429 return 0.; -
src/tempo/beattracking.h
r34e505f r8605361 68 68 fvec_t * out); 69 69 70 /** get current beat period in samples 71 72 \param bt beat tracking object 73 74 Returns the currently observed period, in samples, or 0 if no consistent 75 value is found. 76 77 */ 78 smpl_t aubio_beattracking_get_period (aubio_beattracking_t * bt); 79 80 /** get current beat period in seconds 81 82 \param bt beat tracking object 83 84 Returns the currently observed period, in seconds, or 0 if no consistent 85 value is found. 86 87 */ 88 smpl_t aubio_beattracking_get_period_s (aubio_beattracking_t * bt); 89 70 90 /** get current tempo in bpm 71 91 -
src/tempo/tempo.c
r34e505f r8605361 65 65 sint_t blockpos; /** current position in dfframe */ 66 66 uint_t winlen; /** dfframe bufsize */ 67 uint_t step; /** dfframe hopsize */ 68 uint_t samplerate; /** sampling rate of the signal */ 67 uint_t step; /** dfframe hopsize */ 68 uint_t samplerate; /** sampling rate of the signal */ 69 69 uint_t hop_size; /** get hop_size */ 70 70 uint_t total_frames; /** total frames since beginning */ 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 … … 91 93 aubio_beattracking_do(o->bt,o->dfframe,o->out); 92 94 /* rotate dfframe */ 93 for (i = 0 ; i < winlen - step; i++ ) 95 for (i = 0 ; i < winlen - step; i++ ) 94 96 o->dfframe->data[i] = o->dfframe->data[i+step]; 95 for (i = winlen - step ; i < winlen; i++ ) 97 for (i = winlen - step ; i < winlen; i++ ) 96 98 o->dfframe->data[i] = 0.; 97 99 o->blockpos = -1; … … 104 106 /* end of second level loop */ 105 107 tempo->data[0] = 0; /* reset tactus */ 106 i=0;108 //i=0; 107 109 for (i = 1; i < o->out->data[0]; i++ ) { 108 110 /* if current frame is a predicted tactus */ … … 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 … … 226 231 } 227 232 233 smpl_t aubio_tempo_get_period (aubio_tempo_t *o) 234 { 235 return aubio_beattracking_get_period (o->bt); 236 } 237 238 smpl_t aubio_tempo_get_period_s (aubio_tempo_t *o) 239 { 240 return aubio_beattracking_get_period_s (o->bt); 241 } 242 228 243 smpl_t aubio_tempo_get_confidence(aubio_tempo_t *o) { 229 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 } 230 278 } 231 279 -
src/tempo/tempo.h
r34e505f r8605361 122 122 smpl_t aubio_tempo_get_threshold(aubio_tempo_t * o); 123 123 124 /** get current beat period in samples 125 126 \param bt beat tracking object 127 128 Returns the currently observed period, in samples, or 0 if no consistent 129 value is found. 130 131 */ 132 smpl_t aubio_tempo_get_period (aubio_tempo_t * bt); 133 134 /** get current beat period in seconds 135 136 \param bt beat tracking object 137 138 Returns the currently observed period, in seconds, or 0 if no consistent 139 value is found. 140 141 */ 142 smpl_t aubio_tempo_get_period_s (aubio_tempo_t * bt); 143 124 144 /** get current tempo 125 145 … … 141 161 smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o); 142 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 143 187 /** delete tempo detection object 144 188
Note: See TracChangeset
for help on using the changeset viewer.