Changes in / [bab24a0:714d05e]


Ignore:
Files:
2 added
4 deleted
73 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/aubio.h

    rbab24a0 r714d05e  
    160160#include "fmat.h"
    161161#include "musicutils.h"
    162 #include "vecutils.h"
    163162#include "temporal/resampler.h"
    164163#include "temporal/filter.h"
     
    172171#include "spectral/mfcc.h"
    173172#include "spectral/specdesc.h"
    174 #include "spectral/tss.h"
    175173#include "pitch/pitch.h"
    176174#include "onset/onset.h"
     175#include "onset/peakpicker.h"
    177176#include "tempo/tempo.h"
     177#include "io/sndfileio.h"
    178178#include "io/source.h"
    179 #include "io/sink.h"
    180 
    181 #if AUBIO_UNSTABLE
    182 #include "mathutils.h"
    183179#include "io/source_sndfile.h"
    184180#include "io/source_apple_audio.h"
     181#include "io/sink.h"
    185182#include "io/sink_sndfile.h"
    186183#include "io/sink_apple_audio.h"
    187 #include "io/sndfileio.h"
    188 #include "onset/peakpicker.h"
     184
     185#if AUBIO_UNSTABLE
     186#include "vecutils.h"
     187#include "mathutils.h"
     188#include "utils/scale.h"
     189#include "utils/hist.h"
     190#include "spectral/tss.h"
    189191#include "pitch/pitchmcomb.h"
    190192#include "pitch/pitchyin.h"
     
    193195#include "pitch/pitchfcomb.h"
    194196#include "tempo/beattracking.h"
    195 #include "utils/scale.h"
    196 #include "utils/hist.h"
    197197#endif
    198198
  • TabularUnified src/aubio_priv.h

    rbab24a0 r714d05e  
    123123#define AUBIO_MSG(format, args...)   fprintf(stdout, format , ##args)
    124124#define AUBIO_DBG(format, args...)   fprintf(stderr, format , ##args)
    125 #define AUBIO_WRN(format, args...)   fprintf(stderr, "AUBIO WARNING: " format, ##args)
     125#define AUBIO_WRN(...)               fprintf(stderr, "AUBIO WARNING: " format, ##args)
    126126#endif
    127127
  • TabularUnified src/cvec.h

    rbab24a0 r714d05e  
    2828/** \file
    2929
    30   Vector of complex-valued data
     30  Complex buffers
    3131
    32   This file specifies the ::cvec_t buffer type, which is used throughout aubio
    33   to store complex data. Complex values are stored in terms of ::cvec_t.phas
    34   and norm, within size/2+1 long vectors of ::smpl_t.
    35 
    36   \example test-cvec.c
     32  This file specifies the cvec_t buffer type, which is used throughout aubio to
     33  store complex data. Complex values are stored in terms of phase and
     34  norm, within size/2+1 long vectors.
    3735
    3836*/
    3937
    40 /** Buffer for complex data
    41 
    42   \code
    43 
    44   uint_t buffer_size = 1024;
    45 
    46   // create a complex vector of 512 values
    47   cvec_t * input = new_cvec (buffer_size);
    48 
    49   // set some values of the vector
    50   input->norm[23] = 2.;
    51   input->phas[23] = M_PI;
    52   // ..
    53 
    54   // compute the mean of the vector
    55   mean = cvec_mean(input);
    56 
    57   // destroy the vector
    58   del_cvec (input);
    59 
    60   \endcode
    61 
    62  */
     38/** Buffer for complex data */
    6339typedef struct {
    64   uint_t length;  /**< length of buffer = (requested length)/2 + 1 */
    65   smpl_t *norm;   /**< norm array of size ::cvec_t.length */
    66   smpl_t *phas;   /**< phase array of size ::cvec_t.length */
     40  uint_t length;   /**< length of buffer = (requested length)/2 + 1 */
     41  smpl_t *norm;   /**< norm array of size [length] */
     42  smpl_t *phas;   /**< phase array of size [length] */
    6743} cvec_t;
    6844
     
    7248  [length/2+1], corresponding to the norm and phase values of the
    7349  spectral frame. The length stored in the structure is the actual size of both
    74   arrays, not the length of the complex and symmetrical vector, specified as
     50  arrays, not the length of the complex and symetrical vector, specified as
    7551  creation argument.
    7652
     
    9167  is to access these values from wrappers, as created by swig.
    9268
    93   \param s vector to write to
     69  \param s vector to write to 
    9470  \param data norm value to write in s->norm[position]
    9571  \param position sample position to write to
     
    152128smpl_t * cvec_get_phas(cvec_t *s);
    153129
    154 /** print out cvec data
     130/** print out cvec data 
    155131
    156   \param s vector to print out
     132  \param s vector to print out 
    157133
    158134*/
     
    167143void cvec_set(cvec_t *s, smpl_t val);
    168144
    169 /** set all elements to zero
     145/** set all elements to zero 
    170146
    171147  \param s vector to modify
     
    174150void cvec_zeros(cvec_t *s);
    175151
    176 /** set all elements to ones
     152/** set all elements to ones 
    177153
    178154  \param s vector to modify
  • TabularUnified src/fmat.h

    rbab24a0 r714d05e  
    2828/** \file
    2929
    30   Matrix of real valued data
     30  Real buffers
    3131
    32   This file specifies the fmat_t type, which is used in aubio to store arrays
    33   of floating point values.
    34 
    35   \example test-fmat.c
     32  This file specifies the fmat_t type, which is used in aubio to store real
     33  valued arrays.
    3634
    3735*/
     
    3937/** Buffer for real data */
    4038typedef struct {
    41   uint_t length; /**< length of matrix */
    42   uint_t height; /**< height of matrix */
    43   smpl_t **data; /**< data array of size [length] * [height] */
     39  uint_t length;   /**< length of buffer */
     40  uint_t height; /**< number of channels */
     41  smpl_t **data;   /**< data array of size [length] * [channels] */
    4442} fmat_t;
    4543
  • TabularUnified src/fvec.h

    rbab24a0 r714d05e  
    2828/** \file
    2929
    30   Vector of real-valued data
     30  Real buffers
    3131
    32   This file specifies the ::fvec_t buffer type, which is used throughout aubio
    33   to store vector of real-valued ::smpl_t.
    34 
    35   \example test-fvec.c
     32  This file specifies the fvec_t buffer type, which is used throughout aubio to
     33  store real data.
    3634
    3735*/
    3836
    39 /** Buffer for real data
    40 
    41   Vector of real-valued data
    42 
    43   ::fvec_t is is the structure used to store vector of real-valued data, ::smpl_t .
    44 
    45   \code
    46 
    47   uint_t buffer_size = 1024;
    48 
    49   // create a vector of 512 values
    50   fvec_t * input = new_fvec (buffer_size);
    51 
    52   // set some values of the vector
    53   input->data[23] = 2.;
    54   // ..
    55 
    56   // compute the mean of the vector
    57   mean = fvec_mean(a_vector);
    58 
    59   // destroy the vector
    60   del_fvec(a_vector);
    61 
    62   \endcode
    63 
    64   See `examples/` and `tests/src` directories for more examples.
    65 
    66  */
     37/** Buffer for real data */
    6738typedef struct {
    68   uint_t length;  /**< length of buffer */
    69   smpl_t *data;   /**< data vector of length ::fvec_t.length */
     39  uint_t length;   /**< length of buffer */
     40  smpl_t *data;   /**< data array of size [length] */
    7041} fvec_t;
    7142
  • TabularUnified src/io/sink.h

    rbab24a0 r714d05e  
    3030  Media sink
    3131
    32   \example io/test-sink.c
    33 
    3432*/
    3533
  • TabularUnified src/io/sndfileio.h

    rbab24a0 r714d05e  
    7070 */
    7171uint_t aubio_sndfile_channels(aubio_sndfile_t * file);
    72 /**
    73  * Return samplerate of a file (Hz)
    74  */
    7572uint_t aubio_sndfile_samplerate(aubio_sndfile_t * file);
    7673
  • TabularUnified src/lvec.h

    rbab24a0 r714d05e  
    2828/** \file
    2929
    30   Vector of real-valued data in double precision
     30  Real buffers
    3131
    32   This file specifies the ::lvec_t buffer type, which is used in some places in
    33   aubio to store a vector of ::lsmp_t.
    34 
    35   Note: the lvec_t data type is required in some algorithms such as IIR filters
    36   (see temporal/filter.h).
    37 
    38   \example test-lvec.c
     32  This file specifies the lvec_t buffer type, which is used in aubio to store
     33  double precision real data. Note that the lvec_t data type is mostly used for
     34  IIR filters (see temporal/filter.h).
    3935
    4036*/
     
    4238/** Buffer for real data in double precision */
    4339typedef struct {
    44   uint_t length; /**< length of buffer */
    45   lsmp_t *data;  /**< data array of size [length] */
     40  uint_t length;   /**< length of buffer */
     41  lsmp_t *data;   /**< data array of size [length] */
    4642} lvec_t;
    4743
  • TabularUnified src/mathutils.c

    rbab24a0 r714d05e  
    4444
    4545fvec_t *
    46 new_aubio_window (char_t * window_type, uint_t length)
    47 {
    48   fvec_t * win = new_fvec (length);
    49   fvec_set_window (win, window_type);
    50   return win;
    51 }
    52 
    53 uint_t fvec_set_window (fvec_t *win, char_t *window_type) {
     46new_aubio_window (char_t * window_type, uint_t size)
     47{
     48  fvec_t * win = new_fvec (size);
    5449  smpl_t * w = win->data;
    55   uint_t i, size = win->length;
     50  uint_t i;
    5651  aubio_window_type wintype;
    57   if (window_type == NULL) {
    58       AUBIO_ERR ("window type can not be null.\n");
    59       return 1;
    60   } else if (strcmp (window_type, "rectangle") == 0)
     52  if (strcmp (window_type, "rectangle") == 0)
    6153      wintype = aubio_win_rectangle;
    6254  else if (strcmp (window_type, "hamming") == 0)
     
    7971      wintype = aubio_win_default;
    8072  else {
    81       AUBIO_ERR ("unknown window type `%s`.\n", window_type);
    82       return 1;
     73      AUBIO_ERR ("unknown window type %s, using default.\n", window_type);
     74      wintype = aubio_win_default;
    8375  }
    8476  switch(wintype) {
     
    113105      break;
    114106    case aubio_win_gaussian:
    115       {
    116         lsmp_t a, b, c = 0.5;
    117         uint_t n;
    118         for (n = 0; n < size; n++)
    119         {
    120           a = (n-c*(size-1))/(SQR(c)*(size-1));
    121           b = -c*SQR(a);
    122           w[n] = EXP(b);
    123         }
    124       }
     107      for (i=0;i<size;i++)
     108        w[i] = EXP(- 1.0 / SQR(size) * SQR(2.0*i-size));
    125109      break;
    126110    case aubio_win_welch:
    127111      for (i=0;i<size;i++)
    128         w[i] = 1.0 - SQR((2.*i-size)/(size+1.0));
     112        w[i] = 1.0 - SQR((2*i-size)/(size+1.0));
    129113      break;
    130114    case aubio_win_parzen:
    131115      for (i=0;i<size;i++)
    132         w[i] = 1.0 - ABS((2.*i-size)/(size+1.0));
     116        w[i] = 1.0 - ABS((2*i-size)/(size+1.0));
    133117      break;
    134118    default:
    135119      break;
    136120  }
    137   return 0;
     121  return win;
    138122}
    139123
  • TabularUnified src/mathutils.h

    rbab24a0 r714d05e  
    1919*/
    2020
    21 /** \file
    22 
    23   Various math functions
    24 
    25   \example test-mathutils.c
    26   \example test-mathutils-window.c
    27 
     21/** @file
     22 *  various math functions
    2823 */
    2924
     
    185180void fvec_min_removal (fvec_t * v);
    186181
    187 /** compute moving median threshold of a vector
     182/** compute moving median theshold of a vector
    188183
    189184  This function computes the moving median threshold value of at the given
    190 position of a vector, taking the median among post elements before and up to
     185position of a vector, taking the median amongs post elements before and up to
    191186pre elements after pos.
    192187 
  • TabularUnified src/musicutils.h

    rbab24a0 r714d05e  
    4545*/
    4646fvec_t *new_aubio_window (char_t * window_type, uint_t size);
    47 
    48 /** set elements of a vector to window coefficients
    49 
    50  */
    51 uint_t fvec_set_window (fvec_t * window, char_t * window_type);
    5247
    5348/** compute the principal argument
  • TabularUnified src/onset/onset.h

    rbab24a0 r714d05e  
    2121/** \file
    2222 
    23   Onset detection object
     23  Onset detection driver
    2424
    2525  The following routines compute the onset detection function and detect peaks
    2626  in these functions. When onsets are found above a given silence threshold,
    2727  and after a minimum inter-onset interval, the output vector returned by
    28   ::aubio_onset_do is filled with `1`. Otherwise, the output vector remains
    29   `0`.
     28  aubio_onset_do is filled with 1. Otherwise, the output vector remains 0.
    3029
    3130  The peak-picking threshold, the silence threshold, and the minimum
    3231  inter-onset interval can be adjusted during the execution of the
    3332  aubio_onset_do routine using the corresponding functions.
    34 
    35   \example onset/test-onset.c
    3633
    3734*/
  • TabularUnified src/onset/peakpicker.h

    rbab24a0 r714d05e  
    2222 
    2323  Peak picking utilities function
    24 
    25   \example onset/test-peakpicker.c
    2624 
    2725*/
  • TabularUnified src/pitch/pitch.c

    rbab24a0 r714d05e  
    3535#include "pitch/pitch.h"
    3636
    37 /** pitch detection algorithms */
     37/** pitch detection algorithm */
    3838typedef enum
    3939{
    40   aubio_pitcht_yin,        /**< `yin`, YIN algorithm */
    41   aubio_pitcht_mcomb,      /**< `mcomb`, Multi-comb filter */
    42   aubio_pitcht_schmitt,    /**< `schmitt`, Schmitt trigger */
    43   aubio_pitcht_fcomb,      /**< `fcomb`, Fast comb filter */
    44   aubio_pitcht_yinfft,     /**< `yinfft`, Spectral YIN */
    45   aubio_pitcht_default
    46     = aubio_pitcht_yinfft, /**< `default` */
     40  aubio_pitcht_yin,     /**< YIN algorithm */
     41  aubio_pitcht_mcomb,   /**< Multi-comb filter */
     42  aubio_pitcht_schmitt, /**< Schmitt trigger */
     43  aubio_pitcht_fcomb,   /**< Fast comb filter */
     44  aubio_pitcht_yinfft,   /**< Spectral YIN */
     45  aubio_pitcht_default = aubio_pitcht_yinfft, /**< the one used when "default" is asked */
    4746} aubio_pitch_type;
    4847
    49 /** pitch detection output modes */
     48/** pitch detection output mode */
    5049typedef enum
    5150{
  • TabularUnified src/pitch/pitch.h

    rbab24a0 r714d05e  
    3232  This file creates the objects required for the computation of the selected
    3333  pitch detection algorithm and output the results, in midi note or Hz.
    34 
    35   \example pitch/test-pitch.c
    3634
    3735*/
  • TabularUnified src/pitch/pitchfcomb.h

    rbab24a0 r714d05e  
    2828   This file was derived from the tuneit project, written by Mario Lang to
    2929   detect the fundamental frequency of a sound.
    30 
    31    See http://delysid.org/tuneit.html
    32 
    33    \example pitch/test-pitchfcomb.c
     30   
     31   see http://delysid.org/tuneit.html
    3432
    3533*/
     
    4543typedef struct _aubio_pitchfcomb_t aubio_pitchfcomb_t;
    4644
    47 /** execute pitch detection on an input buffer
    48 
     45/** execute pitch detection on an input buffer 
     46 
    4947  \param p pitch detection object as returned by new_aubio_pitchfcomb
    50   \param input input signal window (length as specified at creation time)
     48  \param input input signal window (length as specified at creation time) 
    5149  \param output pitch candidates in bins
    52 
     50 
    5351*/
    5452void aubio_pitchfcomb_do (aubio_pitchfcomb_t * p, fvec_t * input,
     
    5654
    5755/** creation of the pitch detection object
    58 
    59   \param buf_size size of the input buffer to analyse
    60   \param hop_size step size between two consecutive analysis instant
    61 
     56 
     57  \param buf_size size of the input buffer to analyse 
     58  \param hop_size step size between two consecutive analysis instant 
     59 
    6260*/
    6361aubio_pitchfcomb_t *new_aubio_pitchfcomb (uint_t buf_size, uint_t hop_size);
    6462
    6563/** deletion of the pitch detection object
    66 
     64 
    6765  \param p pitch detection object as returned by new_aubio_pitchfcomb
    68 
     66 
    6967*/
    7068void del_aubio_pitchfcomb (aubio_pitchfcomb_t * p);
  • TabularUnified src/pitch/pitchmcomb.h

    rbab24a0 r714d05e  
    2424
    2525  This fundamental frequency estimation algorithm implements spectral
    26   flattening, multi-comb filtering and peak histogramming.
     26  flattening, multi-comb filtering and peak histogramming. 
    2727
    2828  This method was designed by Juan P. Bello and described in:
     
    3131  Music''.  PhD thesis, Centre for Digital Music, Queen Mary University of
    3232  London, London, UK, 2003.
    33 
    34   \example pitch/test-pitchmcomb.c
    3533
    3634*/
     
    4745
    4846/** execute pitch detection on an input spectral frame
    49 
     47 
    5048  \param p pitch detection object as returned by new_aubio_pitchmcomb
    51   \param in_fftgrain input signal spectrum as computed by aubio_pvoc_do
    52   \param out_cands pitch candidate frequenciess, in bins
    53 
     49  \param fftgrain input signal spectrum as computed by aubio_pvoc_do
     50 
    5451*/
    55 void aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * in_fftgrain,
    56     fvec_t * out_cands);
     52void aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * fftgrain,
     53    fvec_t * output);
    5754
    5855/** creation of the pitch detection object
    59 
    60   \param buf_size size of the input buffer to analyse
    61   \param hop_size step size between two consecutive analysis instant
    62 
     56 
     57  \param buf_size size of the input buffer to analyse
     58  \param hop_size step size between two consecutive analysis instant
     59  \param samplerate sampling rate of the signal
     60 
    6361*/
    6462aubio_pitchmcomb_t *new_aubio_pitchmcomb (uint_t buf_size, uint_t hop_size);
    6563
    6664/** deletion of the pitch detection object
    67 
     65 
    6866  \param p pitch detection object as returned by new_aubio_pitchfcomb
    69 
     67 
    7068*/
    7169void del_aubio_pitchmcomb (aubio_pitchmcomb_t * p);
     
    7573#endif
    7674
    77 #endif /* PITCHMCOMB_H */
     75#endif/*PITCHMCOMB_H*/
  • TabularUnified src/pitch/pitchschmitt.h

    rbab24a0 r714d05e  
    1919*/
    2020
    21 /** \file
     21/** \file 
    2222
    23    Pitch detection using a Schmitt trigger
    24 
     23   Pitch detection using a Schmitt trigger 
     24 
    2525   This pitch extraction method implements a Schmitt trigger to estimate the
    2626   period of a signal.
     
    2828   This file was derived from the tuneit project, written by Mario Lang to
    2929   detect the fundamental frequency of a sound.
    30 
    31    See http://delysid.org/tuneit.html
    32 
    33    \example pitch/test-pitchschmitt.c
     30   
     31   see http://delysid.org/tuneit.html
    3432
    3533*/
     
    4543typedef struct _aubio_pitchschmitt_t aubio_pitchschmitt_t;
    4644
    47 /** execute pitch detection on an input buffer
    48 
    49   \param p pitch detection object as returned by new_aubio_pitchschmitt
    50   \param samples_in input signal vector (length as specified at creation time)
    51   \param cands_out pitch period estimates, in samples
    52 
     45/** execute pitch detection on an input buffer 
     46 
     47  \param p pitch detection object as returned by new_aubio_pitchschmitt 
     48  \param input input signal window (length as specified at creation time)
     49  \param output pitch period estimates, in samples
     50 
    5351*/
    54 void aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, fvec_t * samples_in,
    55     fvec_t * cands_out);
     52void aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, fvec_t * in,
     53    fvec_t * out);
    5654
    5755/** creation of the pitch detection object
    58 
    59   \param buf_size size of the input buffer to analyse
    60 
     56 
     57  \param buf_size size of the input buffer to analyse 
     58 
    6159*/
    6260aubio_pitchschmitt_t *new_aubio_pitchschmitt (uint_t buf_size);
    6361
    6462/** deletion of the pitch detection object
    65 
    66   \param p pitch detection object as returned by new_aubio_pitchschmitt
    67 
     63 
     64  \param p pitch detection object as returned by new_aubio_pitchschmitt 
     65 
    6866*/
    6967void del_aubio_pitchschmitt (aubio_pitchschmitt_t * p);
  • TabularUnified src/pitch/pitchyin.h

    rbab24a0 r714d05e  
    1919*/
    2020
    21 /** \file
    22 
     21/** \file 
     22 
    2323  Pitch detection using the YIN algorithm
    24 
     24 
    2525  This algorithm was developped by A. de Cheveigne and H. Kawahara and
    2626  published in:
    27 
     27 
    2828  De Cheveigné, A., Kawahara, H. (2002) "YIN, a fundamental frequency
    29   estimator for speech and music", J. Acoust. Soc. Am. 111, 1917-1930.
    30 
     29  estimator for speech and music", J. Acoust. Soc. Am. 111, 1917-1930. 
     30 
    3131  see http://recherche.ircam.fr/equipes/pcm/pub/people/cheveign.html
    32 
    33   \example pitch/test-pitchyin.c
    3432
    3533*/
     
    4644
    4745/** creation of the pitch detection object
    48 
    49   \param buf_size size of the input buffer to analyse
    50 
     46 
     47  \param buf_size size of the input buffer to analyse 
     48 
    5149*/
    5250aubio_pitchyin_t *new_aubio_pitchyin (uint_t buf_size);
    5351
    5452/** deletion of the pitch detection object
    55 
    56   \param o pitch detection object as returned by new_aubio_pitchyin()
    57 
     53 
     54  \param p pitch detection object as returned by new_aubio_pitchyin()
     55 
    5856*/
    5957void del_aubio_pitchyin (aubio_pitchyin_t * o);
    6058
    61 /** execute pitch detection an input buffer
    62 
    63   \param o pitch detection object as returned by new_aubio_pitchyin()
    64   \param samples_in input signal vector (length as specified at creation time)
    65   \param cands_out pitch period candidates, in samples
    66 
     59/** execute pitch detection on an input buffer
     60 
     61  \param p pitch detection object as returned by new_aubio_pitchyin()
     62  \param input input signal window (length as specified at creation time)
     63  \param tol tolerance parameter for minima selection [default 0.85]
     64 
    6765*/
    68 void aubio_pitchyin_do (aubio_pitchyin_t * o, fvec_t * samples_in, fvec_t * cands_out);
     66void aubio_pitchyin_do (aubio_pitchyin_t * o, fvec_t * in, fvec_t * out);
    6967
    7068
    71 /** set tolerance parameter for YIN algorithm
    72 
    73   \param o YIN pitch detection object
     69/** set tolerance parameter for YIN algorithm 
     70 
     71  \param o YIN pitch detection object 
    7472  \param tol tolerance parameter for minima selection [default 0.15]
    7573
     
    7775uint_t aubio_pitchyin_set_tolerance (aubio_pitchyin_t * o, smpl_t tol);
    7876
    79 /** get tolerance parameter for YIN algorithm
    80 
    81   \param o YIN pitch detection object
     77/** get tolerance parameter for YIN algorithm 
     78 
     79  \param o YIN pitch detection object 
    8280  \return tolerance parameter for minima selection [default 0.15]
    8381
     
    8987#endif
    9088
    91 #endif /*PITCHYIN_H*/
     89#endif /*PITCHYIN_H*/ 
  • TabularUnified src/pitch/pitchyinfft.h

    rbab24a0 r714d05e  
    3232  Queen Mary University of London, London, UK, 2006.
    3333
    34   \example pitch/test-pitchyinfft.c
    35 
    3634*/
    3735
     
    4846/** execute pitch detection on an input buffer
    4947 
    50   \param o pitch detection object as returned by new_aubio_pitchyinfft
    51   \param samples_in input signal vector (length as specified at creation time)
    52   \param cands_out pitch period candidates, in samples
     48  \param p pitch detection object as returned by new_aubio_pitchyinfft
     49  \param input input signal window (length as specified at creation time)
     50  \param output pitch period candidates, in samples
    5351 
    5452*/
    55 void aubio_pitchyinfft_do (aubio_pitchyinfft_t * o, fvec_t * samples_in, fvec_t * cands_out);
     53void aubio_pitchyinfft_do (aubio_pitchyinfft_t * p, fvec_t * in, fvec_t * out);
    5654/** creation of the pitch detection object
    5755 
     
    6260/** deletion of the pitch detection object
    6361 
    64   \param o pitch detection object as returned by new_aubio_pitchyinfft()
     62  \param p pitch detection object as returned by new_aubio_pitchyinfft()
    6563 
    6664*/
    67 void del_aubio_pitchyinfft (aubio_pitchyinfft_t * o);
     65void del_aubio_pitchyinfft (aubio_pitchyinfft_t * p);
    6866
    6967/** get tolerance parameter for YIN algorithm
     
    7472
    7573*/
    76 smpl_t aubio_pitchyinfft_get_tolerance (aubio_pitchyinfft_t * o);
     74smpl_t aubio_pitchyinfft_get_tolerance (aubio_pitchyinfft_t * p);
    7775
    7876/** set tolerance parameter for YIN algorithm
     
    8280
    8381*/
    84 uint_t aubio_pitchyinfft_set_tolerance (aubio_pitchyinfft_t * o, smpl_t tol);
     82uint_t aubio_pitchyinfft_set_tolerance (aubio_pitchyinfft_t * p, smpl_t tol);
    8583
    8684#ifdef __cplusplus
  • TabularUnified src/spectral/fft.h

    rbab24a0 r714d05e  
    2222
    2323  Fast Fourier Transform object
    24 
    25   \example src/spectral/test-fft.c
    2624
    2725*/
  • TabularUnified src/spectral/filterbank.c

    rbab24a0 r714d05e  
    7070  /* for each filter */
    7171  for (fn = 0; fn < max_filters; fn++) {
     72
    7273    /* for each sample */
    7374    for (j = 0; j < max_length; j++) {
  • TabularUnified src/spectral/filterbank.h

    rbab24a0 r714d05e  
    2626  General-purpose spectral filterbank object.
    2727
    28   \example spectral/test-filterbank.c
    29 
    3028*/
    3129
     
    3836#endif
    3937
    40 /** filterbank object
    41 
    42   This object stores a matrix of spectral filter coefficients.
    43 
    44  */
     38/** filterbank object */
    4539typedef struct _aubio_filterbank_t aubio_filterbank_t;
    4640
  • TabularUnified src/spectral/filterbank_mel.h

    rbab24a0 r714d05e  
    2222/** \file
    2323
    24   Filterbank object coefficients initialization
     24  Mel frequency filter bankd coefficients
    2525
    26   Functions to create set the ::aubio_filterbank_t coefficients to
    27     - ::aubio_filterbank_set_triangle_bands: overlapping triangular bands,
    28     - ::aubio_filterbank_set_mel_coeffs_slaney: Mel frequency bands.
     26  Set filter bank coefficients to Mel frequency bands.
    2927
    30   \example spectral/test-filterbank_mel.c
     28  The filter coefficients are built according to Malcolm Slaney's Auditory
     29  Toolbox available at http://cobweb.ecn.purdue.edu/~malcolm/interval/1998-010/
     30  (see the file mfcc.m).
    3131
    3232*/
     
    5858  \param samplerate audio sampling rate
    5959
    60   The filter coefficients are built according to Malcolm Slaney's Auditory
    61   Toolbox, available at http://cobweb.ecn.purdue.edu/~malcolm/interval/1998-010/
    62   (see file mfcc.m).
     60  This function fills the filterbank coefficients according to Malcolm Slaney.
    6361
    6462*/
     
    7068#endif
    7169
    72 #endif // FILTERBANK_MEL_H
     70#endif                          // FILTERBANK_MEL_H
  • TabularUnified src/spectral/mfcc.h

    rbab24a0 r714d05e  
    2323
    2424  Mel-frequency cepstrum coefficients object
    25 
    26   \example spectral/test-mfcc.c
    2725
    2826*/
  • TabularUnified src/spectral/phasevoc.h

    rbab24a0 r714d05e  
    2727  phase relationships across frames. The window sizes and overlap are specified
    2828  at creation time.
    29 
    30   \example spectral/test-phasevoc.c
    3129
    3230*/
  • TabularUnified src/spectral/specdesc.h

    rbab24a0 r714d05e  
    2727  buffer (stored in a vector of size [1]).
    2828 
    29   \section specdesc Spectral description functions
    30 
    3129  A list of the spectral description methods currently available follows.
    3230
    33   \subsection onsetdesc Onset detection functions
     31  \section onsetdesc Onset detection functions
    3432
    3533  These functions are designed to raise at notes attacks in music signals.
     
    8482  Canada, 2006.
    8583
    86   \subsection shapedesc Spectral shape descriptors
     84  \section shapedesc Spectral shape descriptors
    8785
    8886  The following descriptors are described in:
     
    141139  is found.
    142140
    143   \example spectral/test-specdesc.c
    144 
    145141*/
    146142
     
    173169  \param buf_size length of the input spectrum frame
    174170
    175   The parameter \p method is a string that can be any of:
    176 
    177     - `energy`, `hfc`, `complex`, `phase`, `specdiff`, `kl`, `mkl`, `specflux`
    178     - `centroid`, `spread`, `skewness`, `kurtosis`, `slope`, `decrease`, `rolloff`
    179 
    180171*/
    181172aubio_specdesc_t *new_aubio_specdesc (char_t * method, uint_t buf_size);
  • TabularUnified src/spectral/tss.h

    rbab24a0 r714d05e  
    3232
    3333  Available at http://www.csis.ul.ie/dafx01/proceedings/papers/duxbury.pdf
    34 
    35   \example spectral/test-tss.c
    3634
    3735*/
  • TabularUnified src/tempo/beattracking.h

    rbab24a0 r714d05e  
    3333  towards automatic musical accompaniment. In Proceedings of the Audio
    3434  Engeeniring Society 118th Convention, Barcelona, Spain, May 2005.
    35 
    36   \example tempo/test-beattracking.c
    3735 
    3836*/
  • TabularUnified src/tempo/tempo.h

    rbab24a0 r714d05e  
    2525  This object stores all the memory required for tempo detection algorithm
    2626  and returns the estimated beat locations.
    27 
    28   \example tempo/test-tempo.c
    2927
    3028*/
  • TabularUnified src/temporal/a_weighting.h

    rbab24a0 r714d05e  
    5353  file sampling rates have been included for completeness.
    5454
    55   \example temporal/test-a_weighting.c
    56 
    5755*/
    5856
  • TabularUnified src/temporal/biquad.h

    rbab24a0 r714d05e  
    3636  biquad filter</a> on wikipedia.
    3737
    38   \example temporal/test-biquad.c
    39 
    4038*/
    4139
     
    5755    lsmp_t b2, lsmp_t a1, lsmp_t a2);
    5856
    59 /** create biquad filter with `b0`, `b1`, `b2`, `a1`, `a2` coeffs
     57/** create new biquad filter
    6058
    6159  \param b0 forward filter coefficient
  • TabularUnified src/temporal/c_weighting.h

    rbab24a0 r714d05e  
    5353  file sampling rates have been included for completeness.
    5454
    55   \example temporal/test-c_weighting.c
    56 
    5755*/
    5856
  • TabularUnified src/temporal/filter.h

    rbab24a0 r714d05e  
    5858    - new_aubio_filter_c_weighting() and aubio_filter_set_c_weighting().
    5959    - new_aubio_filter_biquad() and aubio_filter_set_biquad().
    60 
    61   \example temporal/test-filter.c
    6260 
    6361*/
  • TabularUnified src/vecutils.h

    rbab24a0 r714d05e  
    1919*/
    2020
    21 /** \file
    22 
    23   Utility functions for ::fvec_t and ::cvec_t objects
    24 
     21/** @file
     22 *  various utilities functions for fvec and cvec objects
     23 *
    2524 */
    2625
  • TabularUnified tests/src/io/test-sink.c

    rbab24a0 r714d05e  
     1#include <stdio.h>
    12#include <aubio.h>
    2 #include "utils_tests.h"
     3#include "config.h"
    34
    4 int main (int argc, char **argv)
    5 {
    6   sint_t err = 0;
     5char_t *path = "/home/piem/archives/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
     6char_t *outpath = "/var/tmp/test.wav";
    77
    8   if (argc < 3) {
    9     err = 2;
    10     PRINT_ERR("not enough arguments\n");
    11     PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]);
    12     return err;
    13   }
    14 
     8int main(){
     9  int err = 0;
    1510  uint_t samplerate = 44100;
    1611  uint_t hop_size = 512;
    17   uint_t n_frames = 0, read = 0;
     12  uint_t read = hop_size;
     13  fvec_t *vec = new_fvec(hop_size);
     14  aubio_source_t * i = new_aubio_source(path, samplerate, hop_size);
     15  aubio_sink_t *   o = new_aubio_sink(outpath, samplerate);
    1816
    19   char_t *source_path = argv[1];
    20   char_t *sink_path = argv[2];
    21   if ( argc == 4 ) samplerate = atoi(argv[3]);
     17  if (!i || !o) { err = -1; goto beach; }
    2218
    23   fvec_t *vec = new_fvec(hop_size);
    24   aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size);
    25   if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i);
    26   aubio_sink_t *o = new_aubio_sink(sink_path, samplerate);
    27 
    28   if (!i || !o) { err = 1; goto beach; }
    29 
    30   do {
     19  while ( read == hop_size ) {
    3120    aubio_source_do(i, vec, &read);
    3221    aubio_sink_do(o, vec, read);
    33     n_frames += read;
    34   } while ( read == hop_size );
    35 
    36   PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n",
    37       n_frames, source_path, sink_path, samplerate);
     22  }
    3823
    3924beach:
     
    4328  return err;
    4429}
     30
  • TabularUnified tests/src/io/test-sink_apple_audio_file.c

    rbab24a0 r714d05e  
    1 #define AUBIO_UNSTABLE 1
     1#include <stdio.h>
    22#include <aubio.h>
    3 #include "utils_tests.h"
     3#include "config.h"
    44
    5 int main (int argc, char **argv)
    6 {
    7   sint_t err = 0;
     5char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
     6char_t *outpath = "/var/tmp/test.wav";
    87
    9   if (argc < 3) {
    10     err = 2;
    11     PRINT_ERR("not enough arguments\n");
    12     PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]);
    13     return err;
    14   }
    15 
     8int main(){
     9  int err = 0;
    1610#ifdef __APPLE__
    1711  uint_t samplerate = 44100;
    1812  uint_t hop_size = 512;
    19   uint_t n_frames = 0, read = 0;
     13  uint_t read = hop_size;
     14  fvec_t *vec = new_fvec(hop_size);
     15  aubio_source_apple_audio_t * i = new_aubio_source_apple_audio(path, samplerate, hop_size);
     16  aubio_sink_apple_audio_t *   o = new_aubio_sink_apple_audio(outpath, samplerate);
    2017
    21   char_t *source_path = argv[1];
    22   char_t *sink_path = argv[2];
    23   if ( argc == 4 ) samplerate = atoi(argv[3]);
     18  if (!i || !o) { err = -1; goto beach; }
    2419
    25   fvec_t *vec = new_fvec(hop_size);
    26   aubio_source_apple_audio_t *i = new_aubio_source_apple_audio(source_path, samplerate, hop_size);
    27   if (samplerate == 0 ) samplerate = aubio_source_apple_audio_get_samplerate(i);
    28   aubio_sink_apple_audio_t *o = new_aubio_sink_apple_audio(sink_path, samplerate);
    29 
    30   if (!i || !o) { err = 1; goto beach; }
    31 
    32   do {
     20  while ( read == hop_size ) {
    3321    aubio_source_apple_audio_do(i, vec, &read);
    3422    aubio_sink_apple_audio_do(o, vec, read);
    35     n_frames += read;
    36   } while ( read == hop_size );
    37 
    38   PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n",
    39       n_frames, source_path, sink_path, samplerate);
     23  }
    4024
    4125beach:
     
    4428  del_fvec(vec);
    4529#else
    46   PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n");
    47   err = 3;
     30  fprintf(stderr, "ERR: aubio was not compiled with aubio_source_apple_audio\n");
    4831#endif /* __APPLE__ */
    4932  return err;
    5033}
     34
  • TabularUnified tests/src/io/test-sink_sndfile.c

    rbab24a0 r714d05e  
     1#include <stdio.h>
    12#include <aubio.h>
    2 #include "utils_tests.h"
     3#include "config.h"
    34
    4 int main (int argc, char **argv)
    5 {
    6   sint_t err = 0;
     5char_t *path = "/home/piem/archives/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
     6char_t *outpath = "/var/tmp/test.wav";
    77
    8   if (argc < 3) {
    9     err = 2;
    10     PRINT_ERR("not enough arguments\n");
    11     PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]);
    12     return err;
    13   }
    14 
     8int main(){
     9  int err = 0;
    1510#ifdef HAVE_SNDFILE
    1611  uint_t samplerate = 44100;
    1712  uint_t hop_size = 512;
    18   uint_t n_frames = 0, read = 0;
    19 
    20   char_t *source_path = argv[1];
    21   char_t *sink_path = argv[2];
    22   if ( argc == 4 ) samplerate = atoi(argv[3]);
    23 
     13  uint_t read = hop_size;
    2414  fvec_t *vec = new_fvec(hop_size);
    2515  aubio_source_sndfile_t * i = new_aubio_source_sndfile(path, samplerate, hop_size);
    26   if (samplerate == 0 ) samplerate = aubio_source_sndfile_get_samplerate(i);
    2716  aubio_sink_sndfile_t *   o = new_aubio_sink_sndfile(outpath, samplerate);
    2817
    29   if (!i || !o) { err = 1; goto beach; }
     18  if (!i || !o) { err = -1; goto beach; }
    3019
    31   do {
     20  while ( read == hop_size ) {
    3221    aubio_source_sndfile_do(i, vec, &read);
    3322    aubio_sink_sndfile_do(o, vec, read);
    34     n_frames += read;
    35   } while ( read == hop_size );
    36 
    37   PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n",
    38       n_frames, source_path, sink_path, samplerate);
     23  }
    3924
    4025beach:
     
    4328  del_fvec(vec);
    4429#else
    45   PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n");
    46   err = 3;
     30  fprintf(stderr, "ERR: aubio was not compiled with aubio_source_sndfile\n");
    4731#endif /* HAVE_SNDFILE */
    4832  return err;
    4933}
     34
  • TabularUnified tests/src/io/test-source.c

    rbab24a0 r714d05e  
     1#include <stdio.h>
    12#include <aubio.h>
    2 #include "utils_tests.h"
    33
    4 int main (int argc, char **argv)
    5 {
    6   uint_t err = 0;
    7   if (argc < 2) {
    8     err = 2;
    9     PRINT_ERR("not enough arguments\n");
    10     PRINT_MSG("usage: %s <source_path> [samplerate]\n", argv[0]);
    11     return err;
     4char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
     5//char_t *path = "/Users/piem/Downloads/Keziah Jones - Where's Life.mp3";
     6
     7int main(){
     8  uint_t samplerate = 32000;
     9  uint_t hop_size = 1024;
     10  uint_t read = hop_size;
     11  fvec_t *vec = new_fvec(hop_size);
     12  aubio_source_t* s = new_aubio_source(path, samplerate, hop_size);
     13
     14  if (!s) return -1;
     15
     16  while ( read == hop_size ) {
     17    aubio_source_do(s, vec, &read);
     18    fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]);
    1219  }
    1320
    14   uint_t samplerate = 32000;
    15   uint_t hop_size = 256;
    16   uint_t n_frames = 0, read = 0;
    17   if ( argc == 3 ) samplerate = atoi(argv[2]);
     21  del_aubio_source(s);
    1822
    19   char_t *source_path = argv[1];
     23  return 0;
     24}
    2025
    21   fvec_t *vec = new_fvec(hop_size);
    22   aubio_source_t* s = new_aubio_source(source_path, samplerate, hop_size);
    23   if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(s);
    24 
    25   if (!s) { err = 1; goto beach; }
    26 
    27   do {
    28     aubio_source_do(s, vec, &read);
    29     // fvec_print (vec);
    30     n_frames += read;
    31   } while ( read == hop_size );
    32 
    33 beach:
    34   del_aubio_source (s);
    35   del_fvec (vec);
    36 
    37   return err;
    38 }
  • TabularUnified tests/src/io/test-source_apple_audio_file.c

    rbab24a0 r714d05e  
    1 #define AUBIO_UNSTABLE 1
     1#include <stdio.h>
    22#include <aubio.h>
    3 #include "utils_tests.h"
    43
    5 int main (int argc, char **argv)
    6 {
    7   uint_t err = 0;
    8   if (argc < 2) {
    9     err = 2;
    10     PRINT_ERR("not enough arguments\n");
    11     PRINT_MSG("usage: %s <source_path> [samplerate]\n", argv[0]);
    12     return err;
     4char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
     5//char_t *path = "/Volumes/moving/moving/photos/gopro2/100GOPRO/GOPR4515.MP4";
     6
     7int main(){
     8#ifdef __APPLE__
     9  uint_t samplerate = 32000;
     10  uint_t hop_size = 1024;
     11  uint_t read = hop_size;
     12  fvec_t *vec = new_fvec(hop_size);
     13  aubio_source_apple_audio_t * s = new_aubio_source_apple_audio(path, samplerate, hop_size);
     14
     15  if (!s) return -1;
     16
     17  while ( read == hop_size ) {
     18    aubio_source_apple_audio_do(s, vec, &read);
     19    fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]);
    1320  }
    1421
    15 #if __APPLE__
    16   uint_t samplerate = 32000;
    17   uint_t hop_size = 256;
    18   uint_t n_frames = 0, read = 0;
    19   if ( argc == 3 ) samplerate = atoi(argv[2]);
    20 
    21   char_t *source_path = argv[1];
    22 
    23   fvec_t *vec = new_fvec(hop_size);
    24   aubio_source_apple_audio_t * s = new_aubio_source_apple_audio(source_path, samplerate, hop_size);
    25   if (samplerate == 0 ) samplerate = aubio_source_apple_audio_get_samplerate(s);
    26 
    27   if (!s) { err = 1; goto beach; }
    28 
    29   do {
    30     aubio_source_apple_audio_do(s, vec, &read);
    31     // fvec_print (vec);
    32     n_frames += read;
    33   } while ( read == hop_size );
    34 
    35 beach:
    36   del_aubio_source_apple_audio (s);
    37   del_fvec (vec);
     22  del_aubio_source_apple_audio(s);
    3823#else
    39   err = 3;
    40   PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n");
     24  fprintf(stderr, "ERR: aubio was not compiled with aubio_source_apple_audio\n");
    4125#endif /* __APPLE__ */
    4226  return 0;
    4327}
     28
  • TabularUnified tests/src/io/test-source_sndfile.c

    rbab24a0 r714d05e  
     1#include <stdio.h>
    12#include <aubio.h>
    2 #include "utils_tests.h"
     3#include "config.h"
    34
    4 int main (int argc, char **argv)
    5 {
    6   uint_t err = 0;
    7   if (argc < 2) {
    8     err = 2;
    9     PRINT_ERR("not enough arguments\n");
    10     PRINT_MSG("usage: %s <source_path> [samplerate]\n", argv[0]);
    11     return err;
    12   }
     5char_t *path = "/home/piem/archives/samples/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
    136
     7int main(){
     8  int err = 0;
    149#ifdef HAVE_SNDFILE
    15   uint_t samplerate = 32000;
    16   uint_t hop_size = 256;
    17   uint_t n_frames = 0, read = 0;
    18   if ( argc == 3 ) samplerate = atoi(argv[2]);
    19 
    20   char_t *source_path = argv[1];
    21 
     10  uint_t samplerate = 8000;
     11  uint_t hop_size = 512;
     12  uint_t read = hop_size;
    2213  fvec_t *vec = new_fvec(hop_size);
    23   aubio_source_sndfile_t * s = new_aubio_source_sndfile(source_path, samplerate, hop_size);
    24   if (samplerate == 0 ) samplerate = aubio_source_sndfile_get_samplerate(s);
     14  aubio_source_sndfile_t * s = new_aubio_source_sndfile(path, samplerate, hop_size);
    2515
    2616  if (!s) { err = 1; goto beach; }
    2717
    28   do {
     18  while ( read == hop_size ) {
    2919    aubio_source_sndfile_do(s, vec, &read);
    30     // fvec_print (vec);
    31     n_frames += read;
    32   } while ( read == hop_size );
     20    if (read == 0) break;
     21    fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]);
     22  }
    3323
    3424beach:
    35   del_aubio_source_sndfile (s);
    36   del_fvec (vec);
     25  del_aubio_source_sndfile(s);
     26  del_fvec(vec);
    3727#else
    38   PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n");
     28  fprintf(stderr, "ERR: aubio was not compiled with aubio_source_sndfile\n");
    3929  err = 2;
    4030#endif /* HAVE_SNDFILE */
    4131  return err;
    4232}
     33
  • TabularUnified tests/src/onset/test-onset.c

    rbab24a0 r714d05e  
    11#include <aubio.h>
    22
    3 int main ()
    4 {
    5   // 1. allocate some memory
    6   uint_t n = 0; // frame counter
    7   uint_t win_s = 1024; // window size
    8   uint_t hop_s = win_s / 4; // hop size
    9   uint_t samplerate = 44100; // samplerate
    10   // create some vectors
    11   fvec_t * input = new_fvec (win_s/4); // input buffer
    12   fvec_t * out = new_fvec (2); // input buffer
    13   // create onset object
    14   aubio_onset_t * onset = new_aubio_onset("complex", win_s, hop_s, samplerate);
     3int main(){
     4        /* allocate some memory */
     5        uint_t win_s      = 1024;                       /* window size */
     6        fvec_t * in       = new_fvec (win_s/4); /* input buffer */
     7        fvec_t * out      = new_fvec (2);     /* input buffer */
     8        aubio_onset_t * onset  = new_aubio_onset("complex", win_s, win_s/4, 44100.);
     9        uint_t i = 0;
    1510
    16   // 2. do something with it
    17   while (n < 10) {
    18     // get `hop_s` new samples into `input`
    19     // ...
    20     // exectute onset detection
    21     aubio_onset_do (onset, input, out);
    22     // do something with output candidates
    23     // ...
    24     n++;
    25   };
     11        while (i < 10) {
     12          aubio_onset_do (onset,in,out);
     13          i++;
     14        };
    2615
    27   // 3. clean up memory
    28   del_aubio_onset(onset);
    29   del_fvec(input);
    30   del_fvec(out);
    31   aubio_cleanup();
     16        del_aubio_onset(onset);
     17        del_fvec(in);
     18        del_fvec(out);
     19        aubio_cleanup();
    3220
    33   return 0;
     21        return 0;
    3422}
  • TabularUnified tests/src/onset/test-peakpicker.c

    rbab24a0 r714d05e  
    33#include <aubio.h>
    44
    5 int main ()
    6 {
    7   uint_t win_s = 1024; // window size
    8   fvec_t * in = new_fvec (win_s); // input buffer
    9   fvec_t * out = new_fvec (1); // input buffer
    10   aubio_peakpicker_t * o = new_aubio_peakpicker();
    11   aubio_peakpicker_set_threshold (o, 0.3);
     5int main(){
     6        /* allocate some memory */
     7        uint_t win_s      = 1024;                       /* window size */
     8        fvec_t * in       = new_fvec (win_s); /* input buffer */
     9        fvec_t * out      = new_fvec (1); /* input buffer */
     10        aubio_peakpicker_t * o = new_aubio_peakpicker();
     11        aubio_peakpicker_set_threshold (o, 0.3);
    1212
    13   aubio_peakpicker_do(o, in, out);
    14   aubio_peakpicker_do(o, in, out);
    15   aubio_peakpicker_do(o, in, out);
    16   aubio_peakpicker_do(o, in, out);
     13        aubio_peakpicker_do(o, in, out);
     14        aubio_peakpicker_do(o, in, out);
     15        aubio_peakpicker_do(o, in, out);
     16        aubio_peakpicker_do(o, in, out);
    1717
    18   del_aubio_peakpicker(o);
    19   del_fvec(out);
    20   del_fvec(in);
    21   return 0;
     18        del_aubio_peakpicker(o);
     19        del_fvec(out);
     20        del_fvec(in);
     21        return 0;
    2222}
    2323
  • TabularUnified tests/src/pitch/test-pitch.c

    rbab24a0 r714d05e  
    11#include <aubio.h>
    22
    3 int main ()
     3int
     4main ()
    45{
    5   // 1. allocate some memory
    6   uint_t n = 0; // frame counter
    7   uint_t win_s = 1024; // window size
    8   uint_t hop_s = win_s / 4; // hop size
    9   uint_t samplerate = 44100; // samplerate
    10   // create some vectors
    11   fvec_t *input = new_fvec (hop_s); // input buffer
    12   fvec_t *out = new_fvec (1); // output candidates
    13   // create pitch object
    14   aubio_pitch_t *o = new_aubio_pitch ("default", win_s, hop_s, samplerate);
     6  /* allocate some memory */
     7  uint_t win_s = 1024;          /* window size */
     8  uint_t hop_s = win_s / 4;     /* hop size */
     9  uint_t samplerate = 44100;    /* samplerate */
     10  fvec_t *in = new_fvec (hop_s);      /* input buffer */
     11  fvec_t *out = new_fvec (1); /* input buffer */
     12  aubio_pitch_t *o =
     13      new_aubio_pitch ("default", win_s, hop_s, samplerate);
     14  uint_t i = 0;
    1515
    16   // 2. do something with it
    17   while (n < 100) {
    18     // get `hop_s` new samples into `input`
    19     // ...
    20     // exectute pitch
    21     aubio_pitch_do (o, input, out);
    22     // do something with output candidates
    23     // ...
    24     n++;
     16  while (i < 100) {
     17    aubio_pitch_do (o, in, out);
     18    i++;
    2519  };
    2620
    27   // 3. clean up memory
    2821  del_aubio_pitch (o);
    2922  del_fvec (out);
    30   del_fvec (input);
     23  del_fvec (in);
    3124  aubio_cleanup ();
    3225
  • TabularUnified tests/src/pitch/test-pitchfcomb.c

    rbab24a0 r714d05e  
    11#define AUBIO_UNSTABLE 1
    2 
    3 // this file uses the unstable aubio api, please use aubio_pitch instead
    4 // see src/pitch/pitch.h and tests/src/pitch/test-pitch.c
    52
    63#include <aubio.h>
    74
    8 int main ()
    9 {
    10   uint_t i = 0;
    11   uint_t win_s = 1024; // window size
    12   uint_t hop_s = win_s/4; // hop size
    13   // create some vectors
    14   fvec_t * in = new_fvec (hop_s); // input buffer
    15   fvec_t * out = new_fvec (1); // output candidates
    16   // create pitch object
    17   aubio_pitchfcomb_t * o  = new_aubio_pitchfcomb ( win_s, hop_s);
     5int main(){
     6        /* allocate some memory */
     7        uint_t win_s      = 1024;                       /* window size */
     8        uint_t hop_s      = win_s/4;                    /* hop size */
     9        fvec_t * in       = new_fvec (hop_s); /* input buffer */
     10        fvec_t * out      = new_fvec (1);
     11        aubio_pitchfcomb_t * o  = new_aubio_pitchfcomb (
     12          win_s, hop_s);
     13        uint_t i = 0;
    1814
    19   while (i < 10) {
    20     aubio_pitchfcomb_do (o,in, out);
    21     i++;
    22   };
     15        while (i < 2) {
     16          aubio_pitchfcomb_do (o,in, out);
     17          i++;
     18        };
    2319
    24   del_aubio_pitchfcomb(o);
    25   del_fvec(out);
    26   del_fvec(in);
    27   aubio_cleanup();
    28   return 0;
     20        del_aubio_pitchfcomb(o);
     21        del_fvec(out);
     22        del_fvec(in);
     23        aubio_cleanup();
     24
     25        return 0;
    2926}
  • TabularUnified tests/src/pitch/test-pitchmcomb.c

    rbab24a0 r714d05e  
    11#define AUBIO_UNSTABLE 1
    2 
    3 // this file uses the unstable aubio api, please use aubio_pitch instead
    4 // see src/pitch/pitch.h and tests/src/pitch/test-pitch.c
    52
    63#include <aubio.h>
    74
    8 int main ()
    9 {
    10   uint_t n = 10; // compute n times
    11   uint_t win_s = 1024; // window size
    12   uint_t hop_s = win_s/4; // hop size
    13   // create some vectors
    14   cvec_t * in_cvec = new_cvec (win_s); // input fftgrain
    15   fvec_t * out_cands = new_fvec (1); // pitch candidate
    16   // create pitch object
    17   aubio_pitchmcomb_t * mcomb = new_aubio_pitchmcomb(win_s, hop_s);
     5int main(){
     6        /* allocate some memory */
     7        uint_t win_s      = 1024;                       /* window size */
     8        uint_t hop_s      = win_s/4;                    /* hop size */
     9        cvec_t * in       = new_cvec (win_s); /* input buffer */
     10        fvec_t * out      = new_fvec (1); /* input buffer */
    1811
    19   while ( n-- ) {
    20     aubio_pitchmcomb_do (mcomb, in_cvec, out_cands);
    21     // fvec_print(out_cands);
    22   };
     12        aubio_pitchmcomb_t * o  = new_aubio_pitchmcomb(win_s, hop_s);
     13        uint_t i = 0;
    2314
    24   // clean up before exiting
    25   del_aubio_pitchmcomb(mcomb);
    26   del_cvec(in_cvec);
    27   del_fvec(out_cands);
     15        while (i < 1000) {
     16          aubio_pitchmcomb_do (o,in, out);
     17          i++;
     18        };
    2819
    29   aubio_cleanup();
     20        del_aubio_pitchmcomb(o);
     21        del_cvec(in);
     22        del_fvec(out);
     23        aubio_cleanup();
    3024
    31   return 0;
     25        return 0;
    3226}
  • TabularUnified tests/src/pitch/test-pitchschmitt.c

    rbab24a0 r714d05e  
    11#define AUBIO_UNSTABLE 1
    2 
    3 // this file uses the unstable aubio api, please use aubio_pitch instead
    4 // see src/pitch/pitch.h and tests/src/pitch/test-pitch.c
    52
    63#include <aubio.h>
    74
    8 int main ()
    9 {
    10   uint_t n = 10; // compute n times
    11   uint_t win_s = 1024; // window size
    12   // create some vectors
    13   fvec_t * in = new_fvec (win_s); // input buffer
    14   fvec_t * out = new_fvec (1); // input buffer
    15   // create pitch object
    16   aubio_pitchschmitt_t * o = new_aubio_pitchschmitt(win_s);
     5int main(){
     6        /* allocate some memory */
     7        uint_t win_s      = 1024;                       /* window size */
     8        fvec_t * in       = new_fvec (win_s); /* input buffer */
     9        fvec_t * out = new_fvec (1); /* input buffer */
     10        aubio_pitchschmitt_t * o  = new_aubio_pitchschmitt(win_s);
     11        uint_t i = 0;
    1712
    18   while ( n-- ) {
    19     aubio_pitchschmitt_do (o,in, out);
    20   };
     13        while (i < 1000) {
     14          aubio_pitchschmitt_do (o,in, out);
     15          i++;
     16        };
    2117
    22   del_aubio_pitchschmitt(o);
    23   del_fvec(in);
    24   del_fvec(out);
    25   aubio_cleanup();
     18        del_aubio_pitchschmitt(o);
     19        del_fvec(in);
     20        del_fvec(out);
     21        aubio_cleanup();
    2622
    27   return 0;
     23        return 0;
    2824}
    2925
  • TabularUnified tests/src/pitch/test-pitchyin.c

    rbab24a0 r714d05e  
    11#define AUBIO_UNSTABLE 1
    2 
    3 // this file uses the unstable aubio api, please use aubio_pitch instead
    4 // see src/pitch/pitch.h and tests/src/pitch/test-pitch.c
    52
    63#include <aubio.h>
    74
    8 int main ()
    9 {
    10   uint_t n = 10; // compute n times
    11   uint_t win_s = 1024; // window size
    12   // create some vectors
    13   fvec_t * input_signal = new_fvec (win_s); // input signal
    14   fvec_t * output_cands = new_fvec (1); // output candidates
    15   // create pitch object
    16   aubio_pitchyin_t *p = new_aubio_pitchyin (win_s);
     5int main(){
     6        /* allocate some memory */
     7        uint_t win_s      = 1024;                       /* window size */
     8        fvec_t * in       = new_fvec (win_s); /* input buffer */
     9        fvec_t * out      = new_fvec (win_s/2); /* input buffer */
     10        aubio_pitchyin_t *p = new_aubio_pitchyin (win_s);
     11        uint_t i = 0;
    1712
    18   while ( n-- ) {
    19     aubio_pitchyin_do (p, input_signal, output_cands);
    20   };
     13        while (i < 10) {
     14          aubio_pitchyin_do (p, in,out);
     15          i++;
     16        };
    2117
    22   fvec_print(output_cands);
     18        del_fvec(in);
     19        del_fvec(out);
     20        del_aubio_pitchyin(p);
     21        aubio_cleanup();
    2322
    24   del_fvec(input_signal);
    25   del_fvec(output_cands);
    26   del_aubio_pitchyin(p);
    27   aubio_cleanup();
    28 
    29   return 0;
     23        return 0;
    3024}
  • TabularUnified tests/src/pitch/test-pitchyinfft.c

    rbab24a0 r714d05e  
    11#define AUBIO_UNSTABLE 1
    2 
    3 // this file uses the unstable aubio api, please use aubio_pitch instead
    4 // see src/pitch/pitch.h and tests/src/pitch/test-pitch.c
    52
    63#include <aubio.h>
    74
    8 int main ()
    9 {
    10   uint_t n = 10; // compute n times
    11   uint_t win_s = 1024; // window size
    12   // create some vectors
    13   fvec_t * in = new_fvec (win_s); // input buffer
    14   fvec_t * out = new_fvec (1); // output candidates
    15   // create pitch object
    16   aubio_pitchyinfft_t *p  = new_aubio_pitchyinfft(win_s);
    17   aubio_pitchyinfft_set_tolerance (p, 0.2);
     5int main(){
     6        /* allocate some memory */
     7        uint_t win_s      = 1024;                       /* window size */
     8        fvec_t * in       = new_fvec (win_s); /* input buffer */
     9        fvec_t * out      = new_fvec (1); /* output pitch periods */
     10        aubio_pitchyinfft_t * o  = new_aubio_pitchyinfft(win_s);
     11        aubio_pitchyinfft_set_tolerance (o, 0.2);
     12        uint_t i = 0;
    1813
    19   while ( n-- ) {
    20     aubio_pitchyinfft_do (p, in,out);
    21   };
     14        while (i < 10) {
     15          aubio_pitchyinfft_do (o,in,out);
     16          i++;
     17        };
    2218
    23   fvec_print(out);
     19        del_aubio_pitchyinfft(o);
     20        del_fvec(in);
     21        del_fvec(out);
     22        aubio_cleanup();
    2423
    25   del_fvec(in);
    26   del_fvec(out);
    27   del_aubio_pitchyinfft(p);
    28   aubio_cleanup();
     24        return 0;
     25}
    2926
    30   return 0;
    31 }
  • TabularUnified tests/src/spectral/test-fft.c

    rbab24a0 r714d05e  
     1
    12#include <aubio.h>
    23
    3 int main ()
    4 {
    5   uint_t win_s = 8; // window size
    6   fvec_t * in = new_fvec (win_s); // input buffer
    7   cvec_t * fftgrain = new_cvec (win_s); // fft norm and phase
    8   fvec_t * out = new_fvec (win_s); // output buffer
    9   // create fft object
    10   aubio_fft_t * fft = new_aubio_fft(win_s);
    11 
    12   // fill input with some data
    13   in->data[0] = 1;
    14   in->data[1] = 2;
    15   in->data[2] = 3;
    16   in->data[3] = 4;
    17   in->data[4] = 5;
    18   in->data[5] = 6;
    19   in->data[6] = 5;
    20   in->data[7] = 6;
    21   fvec_print(in);
    22 
    23   // execute stft
    24   aubio_fft_do (fft,in,fftgrain);
    25   cvec_print(fftgrain);
    26 
    27   // execute inverse fourier transform
    28   aubio_fft_rdo(fft,fftgrain,out);
    29 
    30   // cleam up
    31   fvec_print(out);
    32   del_aubio_fft(fft);
    33   del_fvec(in);
    34   del_cvec(fftgrain);
    35   del_fvec(out);
    36   aubio_cleanup();
    37   return 0;
     4int main(){
     5        /* allocate some memory */
     6        uint_t win_s      = 8;                       /* window size        */
     7        fvec_t * in       = new_fvec (win_s); /* input buffer       */
     8        cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */
     9        fvec_t * out      = new_fvec (win_s); /* output buffer      */
     10        in->data[0] = 1;
     11        in->data[1] = 2;
     12        in->data[2] = 3;
     13        in->data[3] = 4;
     14        in->data[4] = 5;
     15        in->data[5] = 6;
     16        in->data[6] = 5;
     17        in->data[7] = 6;
     18        /* allocate fft and other memory space */
     19        aubio_fft_t * fft = new_aubio_fft(win_s);
     20        /* fill input with some data */
     21        fvec_print(in);
     22        /* execute stft */
     23        aubio_fft_do (fft,in,fftgrain);
     24        cvec_print(fftgrain);
     25        /* execute inverse fourier transform */
     26        aubio_fft_rdo(fft,fftgrain,out);
     27        fvec_print(out);
     28        del_aubio_fft(fft);
     29        del_fvec(in);
     30        del_cvec(fftgrain);
     31        del_fvec(out);
     32        aubio_cleanup();
     33        return 0;
    3834}
  • TabularUnified tests/src/spectral/test-filterbank.c

    rbab24a0 r714d05e  
     1#define AUBIO_UNSTABLE 1
     2
     3#include <stdio.h>
    14#include <aubio.h>
    25
    3 int main ()
     6int
     7main (void)
    48{
    5   uint_t win_s = 1024; // window size
    6   uint_t n_filters = 13; // number of filters
     9  /* allocate some memory */
     10  uint_t win_s = 1024;          /* window size */
     11  uint_t n_filters = 13;        /* number of filters */
     12  cvec_t *in = new_cvec (win_s);      /* input buffer */
     13  fvec_t *out = new_fvec (win_s);     /* input buffer */
     14  fmat_t *coeffs = NULL;
    715
    8   cvec_t *in_spec = new_cvec (win_s); // input vector of samples
    9   fvec_t *out_filters = new_fvec (n_filters); // per-band outputs
    10   fmat_t *coeffs; // pointer to the coefficients
    11 
    12   // create filterbank object
     16  /* allocate fft and other memory space */
    1317  aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);
    1418
    1519  coeffs = aubio_filterbank_get_coeffs (o);
     20  if (coeffs == NULL) {
     21    return -1;
     22  }
    1623
    17   aubio_filterbank_do (o, in_spec, out_filters);
     24  /*
     25  if (fvec_max (coeffs) != 0.) {
     26    return -1;
     27  }
    1828
    19   // fmat_print (coeffs);
    20   // cvec_print(in_spec);
    21   // fvec_print(out_filters);
     29  if (fvec_min (coeffs) != 0.) {
     30    return -1;
     31  }
     32  */
     33
     34  fmat_print (coeffs);
     35
     36  aubio_filterbank_do (o, in, out);
    2237
    2338  del_aubio_filterbank (o);
    24   del_cvec (in_spec);
    25   del_fvec (out_filters);
     39  del_cvec (in);
     40  del_fvec (out);
    2641  aubio_cleanup ();
    2742
  • TabularUnified tests/src/spectral/test-filterbank_mel.c

    rbab24a0 r714d05e  
     1#define AUBIO_UNSTABLE 1
     2
     3#include <stdio.h>
    14#include <aubio.h>
    25
    3 int main ()
     6int
     7main (void)
    48{
    5   uint_t samplerate = 16000; // samplerate of signal to filter
    6   uint_t win_s = 512; // fft size
    7   uint_t n_filters = 40; // number of filters
     9  /* allocate some memory */
     10  uint_t win_s = 512;           /* fft size */
     11  uint_t n_filters = 40;        /* number of filters */
     12  cvec_t *in = new_cvec (win_s);      /* input buffer */
     13  fvec_t *out = new_fvec (win_s);     /* input buffer */
     14  fmat_t *coeffs = NULL;
     15  smpl_t samplerate = 16000.;
    816
    9   cvec_t *in_spec = new_cvec (win_s); // input vector of samples
    10   fvec_t *out_filters = new_fvec (n_filters); // per-band outputs
    11   fmat_t *coeffs; // pointer to the coefficients
    12 
    13   // create filterbank object
     17  /* allocate fft and other memory space */
    1418  aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);
    1519
    16   // assign Mel-frequency coefficients
     20  /* assign Mel-frequency coefficients */
    1721  aubio_filterbank_set_mel_coeffs_slaney (o, samplerate);
    1822
    1923  coeffs = aubio_filterbank_get_coeffs (o);
     24  if (coeffs == NULL) {
     25    return -1;
     26  }
    2027
    21   aubio_filterbank_do (o, in_spec, out_filters);
     28  //fmat_print (coeffs);
    2229
    23   // fmat_print (coeffs);
    24   // cvec_print(in_spec);
    25   // fvec_print(out_filters);
     30  //fprintf(stderr, "%f\n", fvec_sum(coeffs));
     31
     32  aubio_filterbank_do (o, in, out);
    2633
    2734  del_aubio_filterbank (o);
    28   del_cvec (in_spec);
    29   del_fvec (out_filters);
     35  del_cvec (in);
     36  del_fvec (out);
    3037  aubio_cleanup ();
    3138
  • TabularUnified tests/src/spectral/test-mfcc.c

    rbab24a0 r714d05e  
    11#include <aubio.h>
    22
    3 int main ()
     3int
     4main (void)
    45{
    5   uint_t win_s = 512; // fft size
    6   uint_t n_filters = 40; // number of filters
    7   uint_t n_coefs = 13; // number of coefficients
    8   smpl_t samplerate = 16000.; // samplerate
    9   cvec_t *in = new_cvec (win_s); // input buffer
    10   fvec_t *out = new_fvec (n_coefs); // output coefficients
     6  /* allocate some memory */
     7  uint_t win_s = 512;           /* fft size */
     8  uint_t n_filters = 40;        /* number of filters */
     9  uint_t n_coefs = 13;          /* number of coefficients */
     10  cvec_t *in = new_cvec (win_s);      /* input buffer */
     11  fvec_t *out = new_fvec (n_coefs);     /* input buffer */
     12  smpl_t samplerate = 16000.;
    1113
    12   // create mfcc object
     14  /* allocate fft and other memory space */
    1315  aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coefs, samplerate);
    1416
    1517  cvec_set (in, 1.);
     18
     19  aubio_mfcc_do (o, in, out);
     20  fvec_print (out);
    1621  aubio_mfcc_do (o, in, out);
    1722  fvec_print (out);
    1823
    19   cvec_set (in, .5);
    20   aubio_mfcc_do (o, in, out);
    21   fvec_print (out);
    22 
    23   // clean up
    2424  del_aubio_mfcc (o);
    2525  del_cvec (in);
  • TabularUnified tests/src/spectral/test-phasevoc-jack.c

    rbab24a0 r714d05e  
    1515#endif /* HAVE_JACK */
    1616
    17 uint_t testing  = 0;  // change this to 1 to listen
     17uint_t testing  = 0;  /* change this to 1 to listen        */
    1818
    19 uint_t win_s    = 512; // window size
    20 uint_t hop_s    = 128; // hop size
    21 uint_t channels = 2; // number of audio channels
    22 uint_t midiin   = 4; // number of midi input channels
    23 uint_t midiout  = 2; // number of midi output channels
    24 uint_t pos      = 0; // frames%dspblocksize for jack loop
     19uint_t win_s    = 512;/* window size                       */
     20uint_t hop_s    = 128;/* hop size                          */
     21uint_t channels = 2;  /* number of audio channels          */
     22uint_t midiin   = 4;  /* number of midi input channels     */
     23uint_t midiout  = 2;  /* number of midi output channels    */
     24uint_t pos      = 0;  /* frames%dspblocksize for jack loop */
    2525
    2626fvec_t * in[2];
     
    3232int aubio_process(float **input, float **output, int nframes);
    3333
    34 int main ()
    35 {
    36   /* allocate some memory */
     34int main(){
     35        /* allocate some memory */
    3736  uint_t i;
    38   for (i=0;i<channels;i++) {
    39     in[i]       = new_fvec (hop_s); /* input buffer       */
    40     fftgrain[i] = new_cvec (win_s); /* fft norm and phase */
    41     out[i]      = new_fvec (hop_s); /* output buffer      */
    42     /* allocate fft and other memory space */
    43     pv[i] = new_aubio_pvoc(win_s,hop_s);
    44   }
     37    for (i=0;i<channels;i++) {
     38        in[i]       = new_fvec (hop_s); /* input buffer       */
     39        fftgrain[i] = new_cvec (win_s); /* fft norm and phase */
     40        out[i]      = new_fvec (hop_s); /* output buffer      */
     41        /* allocate fft and other memory space */
     42        pv[i] = new_aubio_pvoc(win_s,hop_s);
     43    }
    4544
    4645#ifdef HAVE_JACK
    47   aubio_jack_t * jack_setup;
    48   jack_setup  = new_aubio_jack(channels, channels,
    49       midiin, midiout,
    50       (aubio_process_func_t)aubio_process);
    51   aubio_jack_activate(jack_setup);
    52   /* stay in main jack loop for 1 seconds only */
    53   do {
    54     sleep(1);
    55   } while(testing);
    56   aubio_jack_close(jack_setup);
     46        aubio_jack_t * jack_setup;
     47        jack_setup  = new_aubio_jack(channels, channels,
     48            midiin, midiout,
     49            (aubio_process_func_t)aubio_process);
     50        aubio_jack_activate(jack_setup);
     51        /* stay in main jack loop for 1 seconds only */
     52        do {
     53          sleep(1);
     54        } while(testing);
     55        aubio_jack_close(jack_setup);
    5756#else
    58   fprintf(stderr, "WARNING: no jack support\n");
     57        fprintf(stderr, "WARNING: no jack support\n");
    5958#endif
    60 
    61   for (i=0;i<channels;i++) {
    62     del_aubio_pvoc(pv[i]);
    63     del_cvec(fftgrain[i]);
    64     del_fvec(in[i]);
    65     del_fvec(out[i]);
    66   }
    67   aubio_cleanup();
    68   return 0;
     59       
     60    for (i=0;i<channels;i++) {
     61        del_aubio_pvoc(pv[i]);
     62        del_cvec(fftgrain[i]);
     63        del_fvec(in[i]);
     64        del_fvec(out[i]);
     65    }
     66        aubio_cleanup();
     67        return 0;
    6968}
    7069
     
    8281    if (pos == hop_s-1) {
    8382      /* block loop */
    84       for (i=0;i<channels;i++) {
    85         aubio_pvoc_do (pv[i], in[i], fftgrain[i]);
    86         // zero phases of first channel
    87         for (i=0;i<fftgrain[i]->length;i++) fftgrain[0]->phas[i] = 0.;
    88         // double phases of second channel
    89         for (i=0;i<fftgrain[i]->length;i++) {
    90           fftgrain[1]->phas[i] =
    91             aubio_unwrap2pi (fftgrain[1]->phas[i] * 2.);
    92         }
    93         // copy second channel to third one
    94         aubio_pvoc_rdo(pv[i], fftgrain[i], out[i]);
    95         pos = -1;
     83    for (i=0;i<channels;i++) {
     84      aubio_pvoc_do (pv[i], in[i], fftgrain[i]);
     85      // zero phases of first channel
     86      for (i=0;i<fftgrain[i]->length;i++) fftgrain[0]->phas[i] = 0.;
     87      // double phases of second channel
     88      for (i=0;i<fftgrain[i]->length;i++) {
     89        fftgrain[1]->phas[i] =
     90          aubio_unwrap2pi (fftgrain[1]->phas[i] * 2.);
    9691      }
     92      // copy second channel to third one
     93      aubio_pvoc_rdo(pv[i], fftgrain[i], out[i]);
     94      pos = -1;
     95    }
    9796    }
    9897    pos++;
  • TabularUnified tests/src/spectral/test-phasevoc.c

    rbab24a0 r714d05e  
     1/* test sample for phase vocoder */
     2
     3#include <stdio.h>
    14#include <aubio.h>
    25
    3 int main ()
    4 {
    5   uint_t n = 6; // compute n times
    6   uint_t win_s = 32; // window size
    7   uint_t hop_s = win_s / 4; // hop size
    8 
    9   fvec_t * in = new_fvec (hop_s); // input buffer
    10   cvec_t * fftgrain = new_cvec (win_s); // fft norm and phase
    11   fvec_t * out = new_fvec (hop_s); // output buffer
    12 
    13   // allocate fft and other memory space
    14   aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s);
    15 
    16   // fill input with some data
    17   fvec_set (in, 1.);
    18   fvec_print (in);
    19 
    20   while ( n-- ) {
    21     // get some fresh input data
    22     // ..
    23 
    24     // execute phase vocoder
    25     aubio_pvoc_do (pv,in,fftgrain);
    26 
    27     // do something with fftgrain
    28     // ...
    29     cvec_print (fftgrain);
    30 
    31     // optionnaly rebuild the signa
    32     aubio_pvoc_rdo(pv,fftgrain,out);
    33 
    34     // and do something with the result
    35     // ...
    36     fvec_print (out);
    37   }
    38 
    39   // clean up
    40   del_fvec(in);
    41   del_cvec(fftgrain);
    42   del_fvec(out);
    43   del_aubio_pvoc(pv);
    44   aubio_cleanup();
    45 
    46   return 0;
     6int main(){
     7        uint_t win_s    = 1024; /* window size                       */
     8        uint_t hop_s    = 256;  /* hop size                          */
     9        /* allocate some memory */
     10        fvec_t * in       = new_fvec (hop_s); /* input buffer       */
     11        cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */
     12        fvec_t * out      = new_fvec (hop_s); /* output buffer      */
     13        /* allocate fft and other memory space */
     14        aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s);
     15        /* fill input with some data */
     16        printf("initialised\n");
     17        /* execute stft */
     18        aubio_pvoc_do (pv,in,fftgrain);
     19        printf("computed forward\n");
     20        /* execute inverse fourier transform */
     21        aubio_pvoc_rdo(pv,fftgrain,out);
     22        printf("computed backard\n");
     23        del_aubio_pvoc(pv);
     24        del_fvec(in);
     25        del_cvec(fftgrain);
     26        del_fvec(out);
     27        aubio_cleanup();
     28        printf("memory freed\n");
     29        return 0;
    4730}
  • TabularUnified tests/src/spectral/test-specdesc.c

    rbab24a0 r714d05e  
     1
     2#define AUBIO_UNSTABLE 1
     3
    14#include <aubio.h>
    25
    3 int main ()
     6int
     7main ()
    48{
    5   uint_t win_s = 1024; // window size
    6   cvec_t *in = new_cvec (win_s); // input buffer
    7   fvec_t *out = new_fvec (1); // output spectral descriptor
     9  uint_t win_s = 1024;          /* window size */
     10  cvec_t *in = new_cvec (win_s);      /* input buffer */
     11  fvec_t *out = new_fvec (1); /* input buffer */
    812
    913  aubio_specdesc_t *o;
    10 
     14 
    1115  o = new_aubio_specdesc ("energy", win_s);
    1216  aubio_specdesc_do (o, in, out);
  • TabularUnified tests/src/spectral/test-tss.c

    rbab24a0 r714d05e  
     1/* test sample for phase vocoder
     2 *
     3 * this program should start correctly using JACK_START_SERVER=true and
     4 * reconstruct each audio input frame perfectly on the corresponding input with
     5 * a delay equal to the window size, hop_s.
     6 */
     7
     8#include <stdio.h>
     9#define AUBIO_UNSTABLE 1
    110#include <aubio.h>
    211
    3 int main ()
    4 {
    5   uint_t n = 10; // compute n times
    6   uint_t win_s = 1024; // window size
    7   uint_t hop_s = 256;  // hop size
     12int main(){
     13  int i;
     14  uint_t win_s    = 1024; /* window size                       */
     15  uint_t hop_s    = 256;  /* hop size                          */
    816
    9   // create some vectors
    10   fvec_t * in       = new_fvec (hop_s); // input buffer
    11   cvec_t * fftgrain = new_cvec (win_s); // fft norm and phase
    12   cvec_t * cstead   = new_cvec (win_s); // fft norm and phase
    13   cvec_t * ctrans   = new_cvec (win_s); // fft norm and phase
    14   fvec_t * stead    = new_fvec (hop_s); // output buffer
    15   fvec_t * trans    = new_fvec (hop_s); // output buffer
    16 
    17   // create phase vocoder for analysis of input signal
     17  /* allocate some memory */
     18  fvec_t * in       = new_fvec (hop_s); /* input buffer       */
     19  cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */
     20  cvec_t * cstead   = new_cvec (win_s); /* fft norm and phase */
     21  cvec_t * ctrans   = new_cvec (win_s); /* fft norm and phase */
     22  fvec_t * stead    = new_fvec (hop_s); /* output buffer      */
     23  fvec_t * trans    = new_fvec (hop_s); /* output buffer      */
     24  /* allocate phase vocoders and transient steady-state separation */
    1825  aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s);
    19   // create transient/steady-state separation object
    20   aubio_tss_t *  tss = new_aubio_tss(win_s,hop_s);
    21   // create phase vocoder objects for synthesis of output signals
    2226  aubio_pvoc_t * pvt = new_aubio_pvoc(win_s,hop_s);
    2327  aubio_pvoc_t * pvs = new_aubio_pvoc(win_s,hop_s);
     28  aubio_tss_t *  tss = new_aubio_tss(win_s,hop_s);
     29
     30  /* fill input with some data */
     31  printf("initialised\n");
    2432
    2533  /* execute stft */
    26   while ( n-- ) {
    27     // fftgrain = pv(in)
    28     aubio_pvoc_do (pv, in, fftgrain);
    29     // ctrans, cstead = tss (fftgrain)
    30     aubio_tss_do (tss, fftgrain, ctrans, cstead);
    31     // stead = pvt_inverse (cstead)
    32     // trans = pvt_inverse (ctrans)
    33     aubio_pvoc_rdo (pvt, cstead, stead);
    34     aubio_pvoc_rdo (pvs, ctrans, trans);
     34  for (i = 0; i < 10; i++) {
     35    aubio_pvoc_do (pv,in,fftgrain);
     36    aubio_tss_do  (tss,fftgrain,ctrans,cstead);
     37    aubio_pvoc_rdo(pvt,cstead,stead);
     38    aubio_pvoc_rdo(pvs,ctrans,trans);
    3539  }
    3640
     
    4650  del_fvec(stead);
    4751  del_fvec(trans);
    48 
    4952  aubio_cleanup();
    50 
     53  printf("memory freed\n");
    5154  return 0;
    5255}
  • TabularUnified tests/src/tempo/test-beattracking.c

    rbab24a0 r714d05e  
    11#define AUBIO_UNSTABLE 1
    22
     3#include <stdio.h>
    34#include <aubio.h>
    45
    5 int main ()
    6 {
    7   uint_t i = 0;
    8   uint_t win_s = 1024; // window size
    9   fvec_t * in = new_fvec (win_s); // input buffer
    10   fvec_t * out = new_fvec (2); // output beat position
     6int main(){
     7        /* allocate some memory */
     8        uint_t win_s      = 1024;                       /* window size */
     9        fvec_t * in       = new_fvec (win_s); /* input buffer */
     10        fvec_t * out      = new_fvec (win_s/4);     /* input buffer */
     11 
     12        /* allocate fft and other memory space */
     13        aubio_beattracking_t * tempo  = new_aubio_beattracking(win_s);
    1114
    12   // create beattracking object
    13   aubio_beattracking_t * tempo  = new_aubio_beattracking(win_s);
     15        uint_t i = 0;
    1416
    15   smpl_t bpm, confidence;
     17        smpl_t curtempo, curtempoconf;
    1618
    17   while (i < 10) {
    18     // put some fresh data in feature vector
    19     // ...
     19        while (i < 10) {
     20          aubio_beattracking_do(tempo,in,out);
     21          curtempo = aubio_beattracking_get_bpm(tempo);
     22          if (curtempo != 0.) {
     23            fprintf(stdout,"%f\n",curtempo);
     24            return 1;
     25          }
     26          curtempoconf = aubio_beattracking_get_confidence(tempo);
     27          if (curtempoconf != 0.) {
     28            fprintf(stdout,"%f\n",curtempo);
     29            return 1;
     30          }
     31          i++;
     32        };
    2033
    21     aubio_beattracking_do(tempo,in,out);
    22     // do something  with the beats
    23     // ...
     34        del_aubio_beattracking(tempo);
     35        del_fvec(in);
     36        del_fvec(out);
     37        aubio_cleanup();
    2438
    25     // get bpm and confidence
    26     bpm = aubio_beattracking_get_bpm(tempo);
    27     confidence = aubio_beattracking_get_confidence(tempo);
    28     i++;
    29   };
    30 
    31   del_aubio_beattracking(tempo);
    32   del_fvec(in);
    33   del_fvec(out);
    34   aubio_cleanup();
    35 
    36   return 0;
     39        return 0;
    3740}
    3841
  • TabularUnified tests/src/tempo/test-tempo.c

    rbab24a0 r714d05e  
     1#include <stdio.h>
    12#include <aubio.h>
    23
    3 int main ()
    4 {
    5   uint_t i = 0;
    6   uint_t win_s = 1024; // window size
    7   fvec_t * in = new_fvec (win_s); // input vector
    8   fvec_t * out = new_fvec (2); // output beat position
     4int main(){
     5        /* allocate some memory */
     6        uint_t win_s      = 1024;                       /* window size */
     7        fvec_t * in       = new_fvec (win_s); /* input buffer */
     8        fvec_t * out      = new_fvec (2);     /* input buffer */
     9        aubio_tempo_t * o  = new_aubio_tempo("complex", win_s, win_s/4, 44100.);
     10        uint_t i = 0;
    911
    10   // create tempo object
    11   aubio_tempo_t * o = new_aubio_tempo("complex", win_s, win_s/4, 44100.);
     12        smpl_t curtempo, curtempoconf;
    1213
    13   smpl_t bpm, confidence;
     14        while (i < 1000) {
     15          aubio_tempo_do(o,in,out);
     16          curtempo = aubio_tempo_get_bpm(o);
     17          if (curtempo != 0.) {
     18            fprintf(stdout,"%f\n",curtempo);
     19            return 1;
     20          }
     21          curtempoconf = aubio_tempo_get_confidence(o);
     22          if (curtempoconf != 0.) {
     23            fprintf(stdout,"%f\n",curtempo);
     24            return 1;
     25          }
     26          i++;
     27        };
    1428
    15   while (i < 1000) {
    16     // put some fresh data in input vector
    17     // ...
     29        del_aubio_tempo(o);
     30        del_fvec(in);
     31        del_fvec(out);
     32        aubio_cleanup();
    1833
    19     // execute tempo
    20     aubio_tempo_do(o,in,out);
    21     // do something with the beats
    22     // ...
    23 
    24     // get bpm and confidence
    25     bpm = aubio_tempo_get_bpm(o);
    26     confidence = aubio_tempo_get_confidence(o);
    27 
    28     i++;
    29   };
    30 
    31   del_aubio_tempo(o);
    32   del_fvec(in);
    33   del_fvec(out);
    34   aubio_cleanup();
    35 
    36   return 0;
     34        return 0;
    3735}
  • TabularUnified tests/src/temporal/test-a_weighting.c

    rbab24a0 r714d05e  
    11#include <aubio.h>
    22
    3 int main ()
    4 {
     3int main(){
    54 
    65  aubio_filter_t * f;
  • TabularUnified tests/src/temporal/test-biquad.c

    rbab24a0 r714d05e  
    11#include <aubio.h>
    22
    3 int main ()
    4 {
    5   uint_t win_s = 64; // window size
     3int main(){
     4        /* allocate some memory */
     5        uint_t win_s      = 1024;                       /* window size */
     6        fvec_t * in       = new_fvec (win_s); /* input buffer */
     7        aubio_filter_t * o = new_aubio_filter_biquad(0.3,0.2,0.1,0.2,0.3);
    68
    7   // create biquad filter with `b0`, `b1`, `b2`, `a1`, `a2`
    8   aubio_filter_t * o = new_aubio_filter_biquad(0.3,0.2,0.1,0.2,0.3);
     9        aubio_filter_do_filtfilt(o,in,in);
     10        aubio_filter_do(o,in);
    911
    10   fvec_t * in_vec  = new_fvec (win_s); // input buffer
    11   fvec_t * tmp_vec = new_fvec (win_s); // temporary buffer
    12   fvec_t * out_vec = new_fvec (win_s); // output buffer
    13 
    14   uint_t times = 100;
    15   while ( times-- ) {
    16     // copy to out, then filter out
    17     aubio_filter_do_outplace(o, in_vec, out_vec);
    18     // in-place filtering
    19     aubio_filter_do(o, in_vec);
    20     // in-place filtering
    21     aubio_filter_do_filtfilt(o, in_vec, out_vec);
    22     fvec_print(in_vec);
    23   }
    24 
    25   // memory clean-up, one for each new
    26   del_aubio_filter(o);
    27   del_fvec(in_vec);
    28   del_fvec(tmp_vec);
    29   del_fvec(out_vec);
    30 
    31   return 0;
     12        del_aubio_filter(o);
     13        del_fvec(in);
     14        return 0;
    3215}
  • TabularUnified tests/src/temporal/test-c_weighting.c

    rbab24a0 r714d05e  
    11#include <aubio.h>
    22
    3 int main ()
    4 {
     3int main(){
     4 
    55  aubio_filter_t * f;
    66
  • TabularUnified tests/src/temporal/test-filter.c

    rbab24a0 r714d05e  
    11#include <aubio.h>
    22
    3 int main ()
     3int
     4main (void)
    45{
    5   uint_t win_s = 32; // window size
    6   fvec_t *in = new_fvec (win_s); // input buffer
    7   fvec_t *out = new_fvec (win_s); // input buffer
     6  /* allocate some memory */
     7  uint_t win_s = 32;            /* window size */
     8  fvec_t *in = new_fvec (win_s);      /* input buffer */
     9  fvec_t *out = new_fvec (win_s);     /* input buffer */
     10
    811
    912  aubio_filter_t *o = new_aubio_filter_c_weighting (44100);
     
    1417  del_aubio_filter (o);
    1518
    16   o = new_aubio_filter_a_weighting (32000);
     19  o = new_aubio_filter_c_weighting (44100);
    1720  in->data[12] = 0.5;
    1821  fvec_print (in);
    1922  aubio_filter_do_outplace (o, in, out);
    2023  fvec_print (out);
     24  del_aubio_filter (o);
    2125
    22   aubio_filter_set_a_weighting (o, 32000);
     26  o = new_aubio_filter_c_weighting (44100);
    2327  in->data[12] = 0.5;
    2428  fvec_print (in);
    2529  aubio_filter_do_filtfilt (o, in, out);
    2630  fvec_print (out);
     31  del_aubio_filter (o);
    2732
    2833  del_fvec (in);
    2934  del_fvec (out);
    30   del_aubio_filter (o);
    3135  aubio_cleanup ();
    3236
  • TabularUnified tests/src/temporal/test-resampler.c

    rbab24a0 r714d05e  
     1#include <stdio.h>
    12#include <aubio.h>
    23
    3 int main ()
     4int
     5main ()
    46{
    5   uint_t win_s = 1024; // window size
     7  /* allocate some memory */
     8  uint_t win_s = 1024;          /* window size */
    69  smpl_t ratio = 0.5;
    7   fvec_t *in = new_fvec (win_s); // input buffer
    8   fvec_t *out = new_fvec ((uint_t) (win_s * ratio)); // output buffer
     10  fvec_t *in = new_fvec (win_s);      /* input buffer */
     11  fvec_t *out = new_fvec ((uint_t) (win_s * ratio));  /* input buffer */
    912  aubio_resampler_t *o = new_aubio_resampler (0.5, 0);
    1013  uint_t i = 0;
  • TabularUnified tests/src/test-cvec.c

    rbab24a0 r714d05e  
    11#include <aubio.h>
    2 #include "utils_tests.h"
    32
    4 int main ()
    5 {
    6   uint_t i, window_size = 16; // window size
    7   utils_init_random();
    8   cvec_t * complex_vector = new_cvec (window_size); // input buffer
    9   uint_t rand_times = 4;
     3int main(){
     4        /* allocate some memory */
     5        uint_t win_s      = 1024;                       /* window size */
     6        cvec_t * sp       = new_cvec (win_s); /* input buffer */
     7        del_cvec(sp);
    108
    11   while (rand_times -- ) {
    12     // fill with random phas and norm
    13     for ( i = 0; i < complex_vector->length; i++ ) {
    14       complex_vector->norm[i] = ( 2. / RAND_MAX * random() - 1. );
    15       complex_vector->phas[i] = ( 2. / RAND_MAX * random() - 1. ) * M_PI;
    16     }
    17     // print the vector
    18     cvec_print(complex_vector);
    19   }
     9        return 0;
     10}
    2011
    21   // set all vector elements to `0`
    22   cvec_zeros(complex_vector);
    23   for ( i = 0; i < complex_vector->length; i++ ) {
    24     assert( complex_vector->norm[i] == 0. );
    25     // assert( complex_vector->phas[i] == 0 );
    26   }
    27   cvec_print(complex_vector);
    28 
    29   // set all vector elements to `1`
    30   cvec_ones(complex_vector);
    31   for ( i = 0; i < complex_vector->length; i++ ) {
    32     assert( complex_vector->norm[i] == 1. );
    33     // assert( complex_vector->phas[i] == 0 );
    34   }
    35   cvec_print(complex_vector);
    36   // destroy it
    37   del_cvec(complex_vector);
    38   return 0;
    39 }
  • TabularUnified tests/src/test-fmat.c

    rbab24a0 r714d05e  
    11#include <aubio.h>
    2 #include <assert.h>
    32
    4 // create a new matrix and fill it with i * 1. + j * .1, where i is the row,
    5 // and j the column.
    6 
    7 int main ()
    8 {
    9   uint_t height = 3, length = 9, i, j;
    10   // create fmat_t object
    11   fmat_t * mat = new_fmat (length, height);
    12   for ( i = 0; i < mat->height; i++ ) {
    13     for ( j = 0; j < mat->length; j++ ) {
    14       // all elements are already initialized to 0.
    15       assert(mat->data[i][j] == 0);
    16       // setting element of row i, column j
    17       mat->data[i][j] = i * 1. + j *.1;
    18     }
    19   }
    20   // print out matrix
    21   fmat_print(mat);
    22   // destroy it
    23   del_fmat(mat);
    24   return 0;
     3int main(){
     4        uint_t length = 1024;                     /* length */
     5        uint_t height = 1024;                     /* height */
     6        fmat_t * mat = new_fmat (length, height); /* input buffer */
     7        fmat_print(mat);
     8        del_fmat(mat);
     9        return 0;
    2510}
    2611
  • TabularUnified tests/src/test-fvec.c

    rbab24a0 r714d05e  
    22#include <assert.h>
    33
    4 int main ()
    5 {
    6   uint_t vec_size = 10, i;
    7   fvec_t * vec = new_fvec (vec_size);
     4int main(){
     5  uint_t buffer_size = 1024;
     6  fvec_t * in = new_fvec (buffer_size);
    87
    9   // vec->length matches requested size
    10   assert(vec->length == vec_size);
     8  assert( in->length                == buffer_size);
    119
    12   // all elements are initialized to `0.`
    13   for ( i = 0; i < vec->length; i++ ) {
    14     assert(vec->data[i] == 0.);
    15   }
     10  assert( in->data[0]               == 0);
     11  assert( in->data[buffer_size / 2] == 0);
     12  assert( in->data[buffer_size - 1] == 0);
    1613
    17   // all elements can be set to `0.`
    18   fvec_zeros(vec);
    19   for ( i = 0; i < vec->length; i++ ) {
    20     assert(vec->data[i] == 0.);
    21   }
    22   fvec_print(vec);
     14  in->data[buffer_size -1 ] = 1;
     15  assert( in->data[buffer_size - 1] == 1);
    2316
    24   // all elements can be set to `1.`
    25   fvec_ones(vec);
    26   for ( i = 0; i < vec->length; i++ ) {
    27     assert(vec->data[i] == 1.);
    28   }
    29   fvec_print(vec);
    30 
    31   // each element can be accessed directly
    32   for ( i = 0; i < vec->length; i++ ) {
    33     vec->data[i] = i;
    34     assert(vec->data[i] == i);
    35   }
    36   fvec_print(vec);
    37 
    38   // now destroys the vector
    39   del_fvec(vec);
     17  del_fvec(in);
    4018
    4119  return 0;
  • TabularUnified tests/src/test-lvec.c

    rbab24a0 r714d05e  
    11#include <aubio.h>
    22
    3 int main()
    4 {
    5   uint_t win_s = 1024; // window size
    6   lvec_t * sp = new_lvec (win_s); // input buffer
    7   del_lvec(sp);
    8   return 0;
     3int main(){
     4        /* allocate some memory */
     5        uint_t win_s      = 1024;                       /* window size */
     6        lvec_t * sp       = new_lvec (win_s); /* input buffer */
     7        del_lvec(sp);
     8
     9        return 0;
    910}
    1011
  • TabularUnified tests/src/test-mathutils-window.c

    rbab24a0 r714d05e  
    11#include <aubio.h>
    2 #include <math.h>
    3 #include <stdio.h>
     2#include <stdlib.h>
    43
    5 int main ()
     4int main( )
    65{
    7   uint_t length = 0;
    8   uint_t n_length = 4, n_types = 10, i, t;
    9   uint_t lengths[4] = { 8, 10, 15, 16 };
    10   char *method = "default";
    11   char *window_types[10] = { "default",
    12     "rectangle", "hamming", "hanning", "hanningz",
    13     "blackman", "blackman_harris", "gaussian", "welch", "parzen"};
    14 
    15   for ( t = 0; t < n_types; t ++ ) {
    16     for ( i = 0; i < n_length; i++)
    17     {
    18       length = lengths[i];
    19       method = window_types[t];
    20 
    21       fvec_t * window = new_aubio_window(method, length);
    22 
    23       fvec_set_window(window, method);
    24       fprintf(stdout, "length: %d, method: %s, window:, ", length, method);
    25       fvec_print(window);
    26 
    27       del_fvec(window);
    28     }
     6  uint_t length;
     7  for (length = 2; length <= 5; length++)
     8  {
     9    fvec_t *t = new_aubio_window("rectangle", length);
     10    del_fvec(t);
     11    t = new_aubio_window("hamming", length);
     12    fvec_print(t);
     13    del_fvec(t);
     14    t = new_aubio_window("hanning", length);
     15    fvec_print(t);
     16    del_fvec(t);
     17    t = new_aubio_window("hanningz", length);
     18    fvec_print(t);
     19    del_fvec(t);
     20    t = new_aubio_window("blackman", length);
     21    fvec_print(t);
     22    del_fvec(t);
     23    t = new_aubio_window("blackman_harris", length);
     24    fvec_print(t);
     25    del_fvec(t);
     26    t = new_aubio_window("gaussian", length);
     27    fvec_print(t);
     28    del_fvec(t);
     29    t = new_aubio_window("welch", length);
     30    fvec_print(t);
     31    del_fvec(t);
     32    t = new_aubio_window("parzen", length);
     33    fvec_print(t);
     34    del_fvec(t);
     35    t = new_aubio_window("default", length);
     36    fvec_print(t);
     37    del_fvec(t);
    2938  }
    3039  return 0;
  • TabularUnified tests/src/test-mathutils.c

    rbab24a0 r714d05e  
    44#include <aubio.h>
    55
    6 int test_next_power_of_two()
    7 {
     6int main(){
    87  uint_t a, b;
    9   a = 15; b = aubio_next_power_of_two(a); assert(b == 16);
    10   fprintf(stdout, "aubio_next_power_of_two(%d) = %d\n", a, b);
    118
    12   a = 17; b = aubio_next_power_of_two(a); assert(b == 32);
    13   fprintf(stdout, "aubio_next_power_of_two(%d) = %d\n", a, b);
     9  a = 31; b = aubio_next_power_of_two(a);
     10  fprintf(stdout, "next_power_of_two of %d is %d\n", a, b);
     11  assert(b == 32);
    1412
    15   a = 31; b = aubio_next_power_of_two(a); assert(b == 32);
    16   fprintf(stdout, "aubio_next_power_of_two(%d) = %d\n", a, b);
     13  a = 32; b = aubio_next_power_of_two(a);
     14  fprintf(stdout, "next_power_of_two of %d is %d\n", a, b);
     15  assert(b == 32);
    1716
    18   a = 32; b = aubio_next_power_of_two(a); assert(b == 32);
    19   fprintf(stdout, "aubio_next_power_of_two(%d) = %d\n", a, b);
    20 
    21   a = 33; b = aubio_next_power_of_two(a); assert(b == 64);
    22   fprintf(stdout, "aubio_next_power_of_two(%d) = %d\n", a, b);
     17  a = 33; b = aubio_next_power_of_two(a);
     18  fprintf(stdout, "next_power_of_two of %d is %d\n", a, b);
     19  assert(b == 64);
    2320
    2421  return 0;
    2522}
    2623
    27 int test_miditofreq()
    28 {
    29   smpl_t midi, freq;
    30   for ( midi = 0; midi < 128; midi += 3 ) {
    31     freq = aubio_miditofreq(midi);
    32     fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
    33   }
    34   midi = 69.5;
    35   freq = aubio_miditofreq(midi);
    36   fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
    37   midi = -69.5;
    38   freq = aubio_miditofreq(midi);
    39   fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
    40   midi = -169.5;
    41   freq = aubio_miditofreq(midi);
    42   fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
    43   midi = 140.;
    44   freq = aubio_miditofreq(midi);
    45   fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
    46   midi = 0;
    47   freq = aubio_miditofreq(midi);
    48   fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
    49   midi = 8.2e10;
    50   freq = aubio_miditofreq(midi);
    51   fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
    52   midi = -5.e10;
    53   freq = aubio_miditofreq(midi);
    54   fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
    55   return 0;
    56 }
    57 
    58 int test_freqtomidi()
    59 {
    60   smpl_t midi, freq;
    61   for ( freq = 0.; freq < 30000.; freq += 440. ) {
    62     midi = aubio_freqtomidi(freq);
    63     fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
    64   }
    65   freq = 69.5;
    66   midi = aubio_freqtomidi(freq);
    67   fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
    68   freq = -69.5;
    69   midi = aubio_freqtomidi(freq);
    70   fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
    71   freq = -169.5;
    72   midi = aubio_freqtomidi(freq);
    73   fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
    74   freq = 140.;
    75   midi = aubio_freqtomidi(freq);
    76   fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
    77   freq = 0;
    78   midi = aubio_freqtomidi(freq);
    79   fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
    80   freq = 8.2e10;
    81   midi = aubio_freqtomidi(freq);
    82   fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
    83   freq = -5.;
    84   midi = aubio_freqtomidi(freq);
    85   fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
    86   return 0;
    87 }
    88 
    89 int test_aubio_window()
    90 {
    91   uint_t window_size = 16;
    92   fvec_t * window = new_aubio_window("default", window_size);
    93   del_fvec(window);
    94 
    95   window = new_fvec(window_size);
    96   fvec_set_window(window, "rectangle");
    97   fvec_print(window);
    98 
    99   window_size /= 2.;
    100   window = new_aubio_window("triangle", window_size);
    101   fvec_print(window);
    102   del_fvec(window);
    103 
    104   window = new_aubio_window("rectangle", 16);
    105   del_fvec (window);
    106   return 0;
    107 }
    108 
    109 int main ()
    110 {
    111   test_next_power_of_two();
    112   test_miditofreq();
    113   test_freqtomidi();
    114   return 0;
    115 }
  • TabularUnified tests/src/utils/test-hist.c

    rbab24a0 r714d05e  
    22
    33#include <aubio.h>
     4#include <stdlib.h>
    45
    5 int main ()
     6int main( )
    67{
    78  uint_t length;
  • TabularUnified tests/src/utils/test-scale.c

    rbab24a0 r714d05e  
    33#include <aubio.h>
    44
    5 int main ()
    6 {
    7   uint_t n = 0;
    8   uint_t win_s = 1024; // window size
    9   fvec_t * in = new_fvec (win_s); // input buffer
    10   aubio_scale_t * o = new_aubio_scale(0,1,2,3);
    11   aubio_scale_set_limits (o,0,1,2,3);
     5int main(){
     6        /* allocate some memory */
     7        uint_t win_s      = 1024;                       /* window size */
     8        fvec_t * in       = new_fvec (win_s); /* input buffer */
     9        aubio_scale_t * o = new_aubio_scale(0,1,2,3);
     10        aubio_scale_set_limits (o,0,1,2,3);
     11        uint_t i = 0;
    1212
    13   while (n < 1000) {
    14     aubio_scale_do(o,in);
    15     n++;
    16   };
     13        while (i < 1000) {
     14          aubio_scale_do(o,in);
     15          i++;
     16        };
    1717
    18   del_aubio_scale(o);
    19   del_fvec(in);
     18        del_aubio_scale(o);
     19        del_fvec(in);
    2020
    21   return 0;
     21        return 0;
    2222}
  • TabularUnified tests/wscript_build

    rbab24a0 r714d05e  
    33for target_name in ctx.path.ant_glob('src/**/*.c'):
    44  uselib = []
    5   includes = ['../src', '.']
     5  includes = ['../src']
    66  extra_source = []
    77  if str(target_name).endswith('-jack.c') and ctx.env['JACK']:
Note: See TracChangeset for help on using the changeset viewer.