Changeset 8605361


Ignore:
Timestamp:
Nov 2, 2015, 11:16:24 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler
Children:
e9eaaf4
Parents:
34e505f (diff), 95748a6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'develop' into awhitening

Location:
src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/io/sink_apple_audio.c

    r34e505f r8605361  
    3737extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int segmentSize);
    3838extern void freeAudioBufferList(AudioBufferList *bufferList);
    39 extern CFURLRef getURLFromPath(const char * path);
     39extern CFURLRef createURLFromPath(const char * path);
    4040char_t *getPrintableOSStatusError(char_t *str, OSStatus error);
    4141
     
    138138
    139139  AudioFileTypeID fileType = kAudioFileWAVEType;
    140   CFURLRef fileURL = getURLFromPath(s->path);
     140  CFURLRef fileURL = createURLFromPath(s->path);
    141141  bool overwrite = true;
    142142  OSStatus err = noErr;
    143143  err = ExtAudioFileCreateWithURL(fileURL, fileType, &clientFormat, NULL,
    144144     overwrite ? kAudioFileFlags_EraseFile : 0, &s->audioFile);
     145  CFRelease(fileURL);
    145146  if (err) {
    146147    char_t errorstr[20];
  • src/io/source_apple_audio.c

    r34e505f r8605361  
    5252extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int max_source_samples);
    5353extern void freeAudioBufferList(AudioBufferList *bufferList);
    54 extern CFURLRef getURLFromPath(const char * path);
     54extern CFURLRef createURLFromPath(const char * path);
    5555char_t *getPrintableOSStatusError(char_t *str, OSStatus error);
    5656
     
    9999
    100100  // open the resource url
    101   CFURLRef fileURL = getURLFromPath(path);
     101  CFURLRef fileURL = createURLFromPath(path);
    102102  err = ExtAudioFileOpenURL(fileURL, &s->audioFile);
     103  CFRelease(fileURL);
    103104  if (err == -43) {
    104105    AUBIO_ERR("source_apple_audio: Failed opening %s, "
  • src/io/utils_apple_audio.c

    r34e505f r8605361  
    3434}
    3535
    36 CFURLRef getURLFromPath(const char * path) {
     36CFURLRef createURLFromPath(const char * path) {
    3737  CFStringRef cfTotalPath = CFStringCreateWithCString (kCFAllocatorDefault,
    3838      path, kCFStringEncodingUTF8);
    3939
    40   return CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath,
     40  CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath,
    4141      kCFURLPOSIXPathStyle, false);
     42  CFRelease(cfTotalPath);
     43  return url;
    4244}
    4345
  • src/pitch/pitchmcomb.c

    r34e505f r8605361  
    336336  uint_t run = 0;
    337337  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++) {
    340339      if (candidates[run]->ene > candidates[cur]->ene)
    341340        CAND_SWAP (candidates[run], candidates[cur]);
     
    352351  uint_t run = 0;
    353352  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++) {
    356354      if (candidates[run]->ebin < candidates[cur]->ebin)
    357355        CAND_SWAP (candidates[run], candidates[cur]);
  • src/tempo/beattracking.c

    r34e505f r8605361  
    410410
    411411smpl_t
     412aubio_beattracking_get_period (aubio_beattracking_t * bt)
     413{
     414  return bt->hop_size * bt->bp;
     415}
     416
     417smpl_t
     418aubio_beattracking_get_period_s (aubio_beattracking_t * bt)
     419{
     420  return aubio_beattracking_get_period(bt) / (smpl_t) bt->samplerate;
     421}
     422
     423smpl_t
    412424aubio_beattracking_get_bpm (aubio_beattracking_t * bt)
    413425{
    414426  if (bt->bp != 0) {
    415     return 60. * bt->samplerate/ bt->bp / bt->hop_size;
     427    return 60. / aubio_beattracking_get_period_s(bt);
    416428  } else {
    417429    return 0.;
  • src/tempo/beattracking.h

    r34e505f r8605361  
    6868    fvec_t * out);
    6969
     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*/
     78smpl_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*/
     88smpl_t aubio_beattracking_get_period_s (aubio_beattracking_t * bt);
     89
    7090/** get current tempo in bpm
    7191
  • src/tempo/tempo.c

    r34e505f r8605361  
    6565  sint_t blockpos;               /** current position in dfframe */
    6666  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 */
    6969  uint_t hop_size;               /** get hop_size */
    7070  uint_t total_frames;           /** total frames since beginning */
    7171  uint_t last_beat;              /** time of latest detected beat, in samples */
    7272  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 */
    7375};
    7476
     
    9193    aubio_beattracking_do(o->bt,o->dfframe,o->out);
    9294    /* rotate dfframe */
    93     for (i = 0 ; i < winlen - step; i++ ) 
     95    for (i = 0 ; i < winlen - step; i++ )
    9496      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++ )
    9698      o->dfframe->data[i] = 0.;
    9799    o->blockpos = -1;
     
    104106  /* end of second level loop */
    105107  tempo->data[0] = 0; /* reset tactus */
    106   i=0;
     108  //i=0;
    107109  for (i = 1; i < o->out->data[0]; i++ ) {
    108110    /* if current frame is a predicted tactus */
     
    114116      }
    115117      o->last_beat = o->total_frames + (uint_t)ROUND(tempo->data[0] * o->hop_size);
     118      o->last_tatum = o->last_beat;
    116119    }
    117120  }
     
    215218    onset2 = new_fvec(1);
    216219  }*/
     220  o->last_tatum = 0;
     221  o->tatum_signature = 4;
    217222  return o;
    218223
     
    226231}
    227232
     233smpl_t aubio_tempo_get_period (aubio_tempo_t *o)
     234{
     235  return aubio_beattracking_get_period (o->bt);
     236}
     237
     238smpl_t aubio_tempo_get_period_s (aubio_tempo_t *o)
     239{
     240  return aubio_beattracking_get_period_s (o->bt);
     241}
     242
    228243smpl_t aubio_tempo_get_confidence(aubio_tempo_t *o) {
    229244  return aubio_beattracking_get_confidence(o->bt);
     245}
     246
     247uint_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
     267smpl_t aubio_tempo_get_last_tatum (aubio_tempo_t *o) {
     268  return (smpl_t)o->last_tatum - o->delay;
     269}
     270
     271uint_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  }
    230278}
    231279
  • src/tempo/tempo.h

    r34e505f r8605361  
    122122smpl_t aubio_tempo_get_threshold(aubio_tempo_t * o);
    123123
     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*/
     132smpl_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*/
     142smpl_t aubio_tempo_get_period_s (aubio_tempo_t * bt);
     143
    124144/** get current tempo
    125145
     
    141161smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o);
    142162
     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*/
     169uint_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*/
     178uint_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*/
     185smpl_t aubio_tempo_get_last_tatum(aubio_tempo_t *o);
     186
    143187/** delete tempo detection object
    144188
Note: See TracChangeset for help on using the changeset viewer.