Changeset 8f14c6e


Ignore:
Timestamp:
Feb 21, 2014, 5:06:27 PM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
10b11d6
Parents:
098925a5
Message:

src/onset/onset.c: clean up set_threshold function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/onset/onset.c

    r098925a5 r8f14c6e  
    3535  cvec_t * fftgrain;            /**< phase vocoder output */
    3636  fvec_t * desc;                /**< spectral description */
    37   smpl_t threshold;             /**< onset peak picking threshold */
    3837  smpl_t silence;               /**< silence threhsold */
    3938  uint_t minioi;                /**< minimum inter onset interval */
     
    102101
    103102uint_t aubio_onset_set_threshold(aubio_onset_t * o, smpl_t threshold) {
    104   o->threshold = threshold;
    105   aubio_peakpicker_set_threshold(o->pp, o->threshold);
     103  aubio_peakpicker_set_threshold(o->pp, threshold);
    106104  return AUBIO_OK;
    107105}
     
    171169{
    172170  aubio_onset_t * o = AUBIO_NEW(aubio_onset_t);
    173   /** set some default parameter */
     171  /* store creation parameters */
    174172  o->samplerate = samplerate;
    175173  o->hop_size = hop_size;
    176   o->last_onset = 0;
    177   o->threshold = 0.3;
    178   o->delay     = 4.3 * hop_size;
    179   o->minioi    = 5 * hop_size;
    180   o->silence   = -70;
    181   o->total_frames = 0;
     174
     175  /* allocate memory */
    182176  o->pv = new_aubio_pvoc(buf_size, o->hop_size);
    183177  o->pp = new_aubio_peakpicker();
    184   aubio_peakpicker_set_threshold (o->pp, o->threshold);
    185178  o->od = new_aubio_specdesc(onset_mode,buf_size);
    186179  o->fftgrain = new_cvec(buf_size);
    187180  o->desc = new_fvec(1);
     181
     182  /* set some default parameter */
     183  aubio_onset_set_threshold (o, 0.3);
     184  aubio_onset_set_delay_ms(o, 50.);
     185  aubio_onset_set_minioi_ms(o, 20.);
     186  aubio_onset_set_silence(o, -70.);
     187
     188  /* initialize internal variables */
     189  o->last_onset = 0;
     190  o->total_frames = 0;
    188191  return o;
    189192}
Note: See TracChangeset for help on using the changeset viewer.