Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/onset/onset.c

    r763a7f1 r9f060d1  
    2424#include "spectral/specdesc.h"
    2525#include "spectral/phasevoc.h"
     26#include "spectral/awhitening.h"
    2627#include "onset/peakpicker.h"
    2728#include "mathutils.h"
     
    4344  uint_t total_frames;          /**< total number of frames processed since the beginning */
    4445  uint_t last_onset;            /**< last detected onset location, in frames */
     46
     47  uint_t apply_adaptive_whitening;
     48  aubio_spectral_whitening_t *spectral_whitening;
    4549};
    4650
     
    5054  smpl_t isonset = 0;
    5155  aubio_pvoc_do (o->pv,input, o->fftgrain);
     56  /*
     57  if (apply_filtering) {
     58  }
     59  if (apply_compression) {
     60  }
     61  */
     62  if (o->apply_adaptive_whitening) {
     63    aubio_spectral_whitening_do(o->spectral_whitening, o->fftgrain);
     64  }
    5265  aubio_specdesc_do (o->od, o->fftgrain, o->desc);
    5366  aubio_peakpicker_do(o->pp, o->desc, onset);
     
    6881    }
    6982  } else {
    70     // we are at the beginning of the file
    71     if (o->total_frames <= o->delay) {
    72       // and we don't find silence
    73       if (aubio_silence_detection(input, o->silence) == 0) {
    74         uint_t new_onset = o->total_frames;
    75         if (o->total_frames == 0 || o->last_onset + o->minioi < new_onset) {
    76           isonset = o->delay / o->hop_size;
    77           o->last_onset = o->total_frames + o->delay;
    78         }
    79       }
     83    // we are at the beginning of the file, and we don't find silence
     84    if (o->total_frames <= o->delay && o->last_onset < o ->minioi && aubio_silence_detection(input, o->silence) == 0) {
     85      //AUBIO_DBG ("beginning of file is not silent, marking as onset\n");
     86      isonset = o->delay / o->hop_size;
     87      o->last_onset = o->delay;
    8088    }
    8189  }
     
    215223  aubio_onset_set_silence(o, -70.);
    216224
     225  o->spectral_whitening = new_aubio_spectral_whitening(buf_size, hop_size, samplerate);
     226  o->apply_adaptive_whitening = 1;
     227
    217228  /* initialize internal variables */
    218229  o->last_onset = 0;
     
    227238void del_aubio_onset (aubio_onset_t *o)
    228239{
     240  del_aubio_spectral_whitening(o->spectral_whitening);
    229241  del_aubio_specdesc(o->od);
    230242  del_aubio_peakpicker(o->pp);
Note: See TracChangeset for help on using the changeset viewer.