Changeset 28d8c4a


Ignore:
Timestamp:
Aug 9, 2005, 12:09:36 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:
5e9c68a
Parents:
ea865c9
Message:

prefix mathutils function with aubio_

Files:
11 edited

Legend:

Unmodified
Added
Removed
  • examples/tests/test-fft.c

    rea865c9 r28d8c4a  
    2020                spec[i] = AUBIO_ARRAY(fft_data_t,win_s);
    2121        /* initialize the window (see mathutils.c) */
    22         window(w,win_s,aubio_win_hanningz);
     22        aubio_window(w,win_s,aubio_win_hanningz);
    2323 
    2424        /* fill input with some data */
     
    3535        for (i=0; i < channels; i++) {
    3636                for (j=0; j<win_s/2+1; j++) {
    37                         spec[i][j]  = CEXPC(I*unwrap2pi(fftgrain->phas[i][j]));
     37                        spec[i][j]  = CEXPC(I*aubio_unwrap2pi(fftgrain->phas[i][j]));
    3838                        spec[i][j] *= fftgrain->norm[i][j];
    3939                }
  • examples/utils.c

    rea865c9 r28d8c4a  
    330330void send_noteon(int pitch, int velo)
    331331{
    332     smpl_t mpitch = (FLOOR)(freqtomidi(pitch)+.5);
     332    smpl_t mpitch = (FLOOR)(aubio_freqtomidi(pitch)+.5);
    333333    /* we should check if we use midi here, not jack */
    334334#if ALSA_SUPPORT
  • src/fft.c

    rea865c9 r28d8c4a  
    150150        for (i=0; i < fft->channels; i++) {
    151151                for (j=0; j<fft->winsize/2+1; j++) {
    152                         fft->spec[i][j]  = CEXPC(I*unwrap2pi(fftgrain->phas[i][j]));
     152                        fft->spec[i][j]  = CEXPC(I*aubio_unwrap2pi(fftgrain->phas[i][j]));
    153153                        fft->spec[i][j] *= fftgrain->norm[i][j];
    154154                }
  • src/mathutils.c

    rea865c9 r28d8c4a  
    2424#include "mathutils.h"
    2525
    26 void window(smpl_t *w, uint_t size, aubio_window_type_t wintype) {
     26void aubio_window(smpl_t *w, uint_t size, aubio_window_type wintype) {
    2727  uint_t i;
    2828  switch(wintype) {
     
    7474
    7575
    76 smpl_t unwrap2pi(smpl_t phase) {
     76smpl_t aubio_unwrap2pi(smpl_t phase) {
    7777  /* mod(phase+pi,-2pi)+pi */
    7878  return phase + TWO_PI * (1. + floorf(-(phase+PI)/TWO_PI));
     
    319319    /* increase frac */
    320320    for (frac = 0.; frac < 2.; frac = frac + step) {
    321       res = quadfrac(s0, s1, s2, frac);
     321      res = aubio_quadfrac(s0, s1, s2, frac);
    322322      if (res > resold)
    323323        resold = res;
     
    331331}
    332332
    333 smpl_t quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf) {
     333smpl_t aubio_quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf) {
    334334  smpl_t tmp = s0 + (pf/2.) * (pf * ( s0 - 2.*s1 + s2 ) - 3.*s0 + 4.*s1 - s2);
    335335  return tmp;
     
    345345}
    346346
    347 smpl_t freqtomidi(smpl_t freq) {
     347smpl_t aubio_freqtomidi(smpl_t freq) {
    348348  smpl_t midi = freq/6.875;
    349349  /* log(freq/A-2)/log(2) */
     
    354354}
    355355
    356 smpl_t bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize) {
     356smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize) {
    357357  smpl_t freq = samplerate/fftsize;
    358358  return freq*bin;
     
    360360
    361361
    362 smpl_t bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize) {
    363   smpl_t midi = bintofreq(bin,samplerate,fftsize);
    364   return freqtomidi(midi);
     362smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize) {
     363  smpl_t midi = aubio_bintofreq(bin,samplerate,fftsize);
     364  return aubio_freqtomidi(midi);
    365365}
    366366
  • src/mathutils.h

    rea865c9 r28d8c4a  
    104104        aubio_win_welch,
    105105        aubio_win_parzen
    106 } aubio_window_type_t;
     106} aubio_window_type;
    107107
    108108/** create window */
    109 void window(smpl_t *w, uint_t size, aubio_window_type_t wintype);
     109void aubio_window(smpl_t *w, uint_t size, aubio_window_type wintype);
    110110
    111111/** principal argument
     
    113113 * mod(phase+PI,-TWO_PI)+PI
    114114 */
    115 smpl_t unwrap2pi (smpl_t phase);
     115smpl_t aubio_unwrap2pi (smpl_t phase);
    116116
    117117/** calculates the mean of a vector
     
    225225 *    \param pf is the floating point index [0;2]
    226226 */
    227 smpl_t quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf);
     227smpl_t aubio_quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf);
    228228
    229229/** returns 1 if X1 is a peak and positive */
    230230uint_t vec_peakpick(fvec_t * input, uint_t pos);
    231231
    232 smpl_t bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
    233 smpl_t bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
    234 smpl_t freqtomidi(smpl_t freq);
     232smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
     233smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
     234smpl_t aubio_freqtomidi(smpl_t freq);
    235235
    236236uint_t aubio_silence_detection(fvec_t * ibuf, smpl_t threshold);
  • src/onsetdetection.c

    rea865c9 r28d8c4a  
    7474                onset->data[i][0] = 0.;
    7575                for (j=0;j<nbins; j++)  {
    76                         o->dev1->data[i][j]      = unwrap2pi(
     76                        o->dev1->data[i][j]      = aubio_unwrap2pi(
    7777                                        fftgrain->phas[i][j]
    7878                                        -2.0*o->theta1->data[i][j]+
     
    104104                for ( j=0;j<nbins; j++ )        {
    105105                        o->dev1->data[i][j] =
    106                                 unwrap2pi(
     106                                aubio_unwrap2pi(
    107107                                                fftgrain->phas[i][j]
    108108                                                -2.0*o->theta1->data[i][j]
  • src/phasevoc.c

    rea865c9 r28d8c4a  
    114114        pv->synthold = new_fvec (win_s-hop_s, channels);
    115115        pv->w        = AUBIO_ARRAY(smpl_t,win_s);
    116         window(pv->w,win_s,aubio_win_hanningz);
     116        aubio_window(pv->w,win_s,aubio_win_hanningz);
    117117
    118118        pv->channels = channels;
  • src/pitchdetection.c

    rea865c9 r28d8c4a  
    139139        aubio_pvoc_do(p->pv,ibuf,p->fftgrain);
    140140        pitch = aubio_pitchmcomb_detect(p->mcomb,p->fftgrain);
    141         /** \bug should move the >0 check within bintofreq */
     141        /** \bug should move the >0 check within aubio_bintofreq */
    142142        if (pitch>0.) {
    143                 pitch = bintofreq(pitch,p->srate,p->bufsize);
     143                pitch = aubio_bintofreq(pitch,p->srate,p->bufsize);
    144144        } else {
    145145                pitch = 0.;
  • src/pitchfcomb.c

    rea865c9 r28d8c4a  
    9191
    9292    /* map delta phase into +/- Pi interval */
    93     tmp = unwrap2pi(tmp);
     93    tmp = aubio_unwrap2pi(tmp);
    9494
    9595    /* get deviation from bin frequency from the +/- Pi interval */
  • src/tss.c

    rea865c9 r28d8c4a  
    5656  for (i=0;i<channels; i++){
    5757    for (j=0;j<nbins; j++){
    58       dev[i][j] = unwrap2pi(input->phas[i][j]
     58      dev[i][j] = aubio_unwrap2pi(input->phas[i][j]
    5959          -2.0*theta1[i][j]+theta2[i][j]);
    6060      theta2[i][j] = theta1[i][j];
  • swig/aubio.i

    rea865c9 r28d8c4a  
    9898        aubio_win_welch,
    9999        aubio_win_parzen
    100 } aubio_window_type_t;
    101 
    102 void window(smpl_t *w, uint_t size, aubio_window_type_t wintype);
    103 smpl_t unwrap2pi (smpl_t phase);
     100} aubio_window_type;
     101
     102void aubio_window(smpl_t *w, uint_t size, aubio_window_type wintype);
     103smpl_t aubio_unwrap2pi (smpl_t phase);
    104104smpl_t vec_mean(fvec_t *s);
    105105smpl_t vec_max(fvec_t *s);
     
    119119smpl_t vec_median(fvec_t * input);
    120120smpl_t vec_quadint(fvec_t * x,uint_t pos);
    121 smpl_t quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf);
     121smpl_t aubio_quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf);
    122122uint_t vec_peakpick(fvec_t * input, uint_t pos);
    123 smpl_t bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
    124 smpl_t bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
    125 smpl_t freqtomidi(smpl_t freq);
     123smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
     124smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
     125smpl_t aubio_freqtomidi(smpl_t freq);
    126126uint_t aubio_silence_detection(fvec_t * ibuf, smpl_t threshold);
    127127smpl_t aubio_level_detection(fvec_t * ibuf, smpl_t threshold);
Note: See TracChangeset for help on using the changeset viewer.