Changeset 6efdc83


Ignore:
Timestamp:
Sep 27, 2005, 9:10:49 PM (19 years ago)
Author:
Paul Brossier <piem@altern.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, pitchshift, sampler, timestretch, yinfft+
Children:
26d9f8f
Parents:
bfe76d4
Message:

added {set,get}_threshold{,fn} to peakpick
added {set,get}_threshold{,fn} to peakpick

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/peakpick.c

    rbfe76d4 r6efdc83  
    3838        uint_t  win_pre;                               
    3939        /**     threshfn: name or handle of fn for computing adaptive threshold [@median]  */
    40         //aubio_thresholdfn_t thresholdfn;
     40        aubio_thresholdfn_t thresholdfn;
    4141        /**     picker:   name or handle of fn for picking event times [@peakpick] */
    4242        aubio_pickerfn_t pickerfn;
     
    4848        /** modified onsets */
    4949        fvec_t * onset_proc;
    50         /* peak picked window [3] */
     50        /** peak picked window [3] */
    5151        fvec_t * onset_peek;
    5252        /** scratch pad for biquad and median */
     
    9898        for (j = 0; j < length; j++)
    9999                scratch->data[i][j] = onset_proc->data[i][j];
    100         median = vec_median(scratch);
     100        median = p->thresholdfn(scratch);
    101101        /* } */
    102102
     
    165165}
    166166
    167 
     167void aubio_peakpicker_set_threshold(aubio_pickpeak_t * p, smpl_t threshold) {
     168        p->threshold = threshold;
     169        return;
     170}
     171
     172smpl_t aubio_peakpicker_get_threshold(aubio_pickpeak_t * p) {
     173        return p->threshold;
     174}
     175
     176void aubio_peakpicker_set_thresholdfn(aubio_pickpeak_t * p, aubio_thresholdfn_t thresholdfn) {
     177        p->thresholdfn = thresholdfn;
     178        return;
     179}
     180
     181aubio_thresholdfn_t aubio_peakpicker_get_thresholdfn(aubio_pickpeak_t * p) {
     182        return (aubio_thresholdfn_t) (p->thresholdfn);
     183}
    168184
    169185aubio_pickpeak_t * new_aubio_peakpicker(smpl_t threshold) {
     
    175191        t->win_pre   = 1;
    176192
    177         //t->thresholdfn = (aubio_thresholdfn_t)(vec_median); /* (vec_mean); */
     193        t->thresholdfn = (aubio_thresholdfn_t)(vec_median); /* (vec_mean); */
    178194        t->pickerfn = (aubio_pickerfn_t)(vec_peakpick);
    179195
  • src/peakpick.h

    rbfe76d4 r6efdc83  
    4141void del_aubio_peakpicker(aubio_pickpeak_t * p);
    4242
     43void aubio_peakpicker_set_threshold(aubio_pickpeak_t * p, smpl_t threshold);
     44smpl_t aubio_peakpicker_get_threshold(aubio_pickpeak_t * p);
     45void aubio_peakpicker_set_thresholdfn(aubio_pickpeak_t * p, aubio_thresholdfn_t thresholdfn);
     46aubio_thresholdfn_t aubio_peakpicker_get_thresholdfn(aubio_pickpeak_t * p);
     47
    4348#ifdef __cplusplus
    4449}
Note: See TracChangeset for help on using the changeset viewer.