Changes in / [8605361:34e505f]
- Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/sink_apple_audio.c
r8605361 r34e505f 37 37 extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int segmentSize); 38 38 extern void freeAudioBufferList(AudioBufferList *bufferList); 39 extern CFURLRef createURLFromPath(const char * path);39 extern CFURLRef getURLFromPath(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 = createURLFromPath(s->path);140 CFURLRef fileURL = getURLFromPath(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);146 145 if (err) { 147 146 char_t errorstr[20]; -
src/io/source_apple_audio.c
r8605361 r34e505f 52 52 extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int max_source_samples); 53 53 extern void freeAudioBufferList(AudioBufferList *bufferList); 54 extern CFURLRef createURLFromPath(const char * path);54 extern CFURLRef getURLFromPath(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 = createURLFromPath(path);101 CFURLRef fileURL = getURLFromPath(path); 102 102 err = ExtAudioFileOpenURL(fileURL, &s->audioFile); 103 CFRelease(fileURL);104 103 if (err == -43) { 105 104 AUBIO_ERR("source_apple_audio: Failed opening %s, " -
src/io/utils_apple_audio.c
r8605361 r34e505f 34 34 } 35 35 36 CFURLRef createURLFromPath(const char * path) {36 CFURLRef getURLFromPath(const char * path) { 37 37 CFStringRef cfTotalPath = CFStringCreateWithCString (kCFAllocatorDefault, 38 38 path, kCFStringEncodingUTF8); 39 39 40 CFURLRef url =CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath,40 return CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath, 41 41 kCFURLPOSIXPathStyle, false); 42 CFRelease(cfTotalPath);43 return url;44 42 } 45 43 -
src/pitch/pitchmcomb.c
r8605361 r34e505f 336 336 uint_t run = 0; 337 337 for (cur = 0; cur < nbins; cur++) { 338 for (run = cur + 1; run < nbins; run++) { 338 run = cur + 1; 339 for (run = cur; run < nbins; run++) { 339 340 if (candidates[run]->ene > candidates[cur]->ene) 340 341 CAND_SWAP (candidates[run], candidates[cur]); … … 351 352 uint_t run = 0; 352 353 for (cur = 0; cur < nbins; cur++) { 353 for (run = cur + 1; run < nbins; run++) { 354 run = cur + 1; 355 for (run = cur; run < nbins; run++) { 354 356 if (candidates[run]->ebin < candidates[cur]->ebin) 355 357 CAND_SWAP (candidates[run], candidates[cur]); -
src/tempo/beattracking.c
r8605361 r34e505f 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_t418 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_t424 412 aubio_beattracking_get_bpm (aubio_beattracking_t * bt) 425 413 { 426 414 if (bt->bp != 0) { 427 return 60. / aubio_beattracking_get_period_s(bt);415 return 60. * bt->samplerate/ bt->bp / bt->hop_size; 428 416 } else { 429 417 return 0.; -
src/tempo/beattracking.h
r8605361 r34e505f 68 68 fvec_t * out); 69 69 70 /** get current beat period in samples71 72 \param bt beat tracking object73 74 Returns the currently observed period, in samples, or 0 if no consistent75 value is found.76 77 */78 smpl_t aubio_beattracking_get_period (aubio_beattracking_t * bt);79 80 /** get current beat period in seconds81 82 \param bt beat tracking object83 84 Returns the currently observed period, in seconds, or 0 if no consistent85 value is found.86 87 */88 smpl_t aubio_beattracking_get_period_s (aubio_beattracking_t * bt);89 90 70 /** get current tempo in bpm 91 71 -
src/tempo/tempo.c
r8605361 r34e505f 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 */75 73 }; 76 74 … … 93 91 aubio_beattracking_do(o->bt,o->dfframe,o->out); 94 92 /* rotate dfframe */ 95 for (i = 0 ; i < winlen - step; i++ ) 93 for (i = 0 ; i < winlen - step; i++ ) 96 94 o->dfframe->data[i] = o->dfframe->data[i+step]; 97 for (i = winlen - step ; i < winlen; i++ ) 95 for (i = winlen - step ; i < winlen; i++ ) 98 96 o->dfframe->data[i] = 0.; 99 97 o->blockpos = -1; … … 106 104 /* end of second level loop */ 107 105 tempo->data[0] = 0; /* reset tactus */ 108 //i=0;106 i=0; 109 107 for (i = 1; i < o->out->data[0]; i++ ) { 110 108 /* if current frame is a predicted tactus */ … … 116 114 } 117 115 o->last_beat = o->total_frames + (uint_t)ROUND(tempo->data[0] * o->hop_size); 118 o->last_tatum = o->last_beat;119 116 } 120 117 } … … 218 215 onset2 = new_fvec(1); 219 216 }*/ 220 o->last_tatum = 0;221 o->tatum_signature = 4;222 217 return o; 223 218 … … 231 226 } 232 227 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 243 228 smpl_t aubio_tempo_get_confidence(aubio_tempo_t *o) { 244 229 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, pass259 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 }278 230 } 279 231 -
src/tempo/tempo.h
r8605361 r34e505f 122 122 smpl_t aubio_tempo_get_threshold(aubio_tempo_t * o); 123 123 124 /** get current beat period in samples125 126 \param bt beat tracking object127 128 Returns the currently observed period, in samples, or 0 if no consistent129 value is found.130 131 */132 smpl_t aubio_tempo_get_period (aubio_tempo_t * bt);133 134 /** get current beat period in seconds135 136 \param bt beat tracking object137 138 Returns the currently observed period, in seconds, or 0 if no consistent139 value is found.140 141 */142 smpl_t aubio_tempo_get_period_s (aubio_tempo_t * bt);143 144 124 /** get current tempo 145 125 … … 161 141 smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o); 162 142 163 /* set number of tatum per beat164 165 \param o beat tracking object166 \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 frame172 173 \param o beat tracking object174 175 \return 2 if a beat was detected, 1 if a tatum was detected, 0 otherwise176 177 */178 uint_t aubio_tempo_was_tatum(aubio_tempo_t *o);179 180 /* get position of last_tatum, in samples181 182 \param o beat tracking object183 184 */185 smpl_t aubio_tempo_get_last_tatum(aubio_tempo_t *o);186 187 143 /** delete tempo detection object 188 144
Note: See TracChangeset
for help on using the changeset viewer.