Changes in / [bab24a0:714d05e]
- Files:
-
- 2 added
- 4 deleted
- 73 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/aubio.h ¶
rbab24a0 r714d05e 160 160 #include "fmat.h" 161 161 #include "musicutils.h" 162 #include "vecutils.h"163 162 #include "temporal/resampler.h" 164 163 #include "temporal/filter.h" … … 172 171 #include "spectral/mfcc.h" 173 172 #include "spectral/specdesc.h" 174 #include "spectral/tss.h"175 173 #include "pitch/pitch.h" 176 174 #include "onset/onset.h" 175 #include "onset/peakpicker.h" 177 176 #include "tempo/tempo.h" 177 #include "io/sndfileio.h" 178 178 #include "io/source.h" 179 #include "io/sink.h"180 181 #if AUBIO_UNSTABLE182 #include "mathutils.h"183 179 #include "io/source_sndfile.h" 184 180 #include "io/source_apple_audio.h" 181 #include "io/sink.h" 185 182 #include "io/sink_sndfile.h" 186 183 #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" 189 191 #include "pitch/pitchmcomb.h" 190 192 #include "pitch/pitchyin.h" … … 193 195 #include "pitch/pitchfcomb.h" 194 196 #include "tempo/beattracking.h" 195 #include "utils/scale.h"196 #include "utils/hist.h"197 197 #endif 198 198 -
TabularUnified src/aubio_priv.h ¶
rbab24a0 r714d05e 123 123 #define AUBIO_MSG(format, args...) fprintf(stdout, format , ##args) 124 124 #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) 126 126 #endif 127 127 -
TabularUnified src/cvec.h ¶
rbab24a0 r714d05e 28 28 /** \file 29 29 30 Vector of complex-valued data30 Complex buffers 31 31 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. 37 35 38 36 */ 39 37 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 */ 63 39 typedef 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] */ 67 43 } cvec_t; 68 44 … … 72 48 [length/2+1], corresponding to the norm and phase values of the 73 49 spectral frame. The length stored in the structure is the actual size of both 74 arrays, not the length of the complex and sym metrical vector, specified as50 arrays, not the length of the complex and symetrical vector, specified as 75 51 creation argument. 76 52 … … 91 67 is to access these values from wrappers, as created by swig. 92 68 93 \param s vector to write to 69 \param s vector to write to 94 70 \param data norm value to write in s->norm[position] 95 71 \param position sample position to write to … … 152 128 smpl_t * cvec_get_phas(cvec_t *s); 153 129 154 /** print out cvec data 130 /** print out cvec data 155 131 156 \param s vector to print out 132 \param s vector to print out 157 133 158 134 */ … … 167 143 void cvec_set(cvec_t *s, smpl_t val); 168 144 169 /** set all elements to zero 145 /** set all elements to zero 170 146 171 147 \param s vector to modify … … 174 150 void cvec_zeros(cvec_t *s); 175 151 176 /** set all elements to ones 152 /** set all elements to ones 177 153 178 154 \param s vector to modify -
TabularUnified src/fmat.h ¶
rbab24a0 r714d05e 28 28 /** \file 29 29 30 Matrix of real valued data30 Real buffers 31 31 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. 36 34 37 35 */ … … 39 37 /** Buffer for real data */ 40 38 typedef 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] */ 44 42 } fmat_t; 45 43 -
TabularUnified src/fvec.h ¶
rbab24a0 r714d05e 28 28 /** \file 29 29 30 Vector of real-valued data30 Real buffers 31 31 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. 36 34 37 35 */ 38 36 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 */ 67 38 typedef 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] */ 70 41 } fvec_t; 71 42 -
TabularUnified src/io/sink.h ¶
rbab24a0 r714d05e 30 30 Media sink 31 31 32 \example io/test-sink.c33 34 32 */ 35 33 -
TabularUnified src/io/sndfileio.h ¶
rbab24a0 r714d05e 70 70 */ 71 71 uint_t aubio_sndfile_channels(aubio_sndfile_t * file); 72 /**73 * Return samplerate of a file (Hz)74 */75 72 uint_t aubio_sndfile_samplerate(aubio_sndfile_t * file); 76 73 -
TabularUnified src/lvec.h ¶
rbab24a0 r714d05e 28 28 /** \file 29 29 30 Vector of real-valued data in double precision30 Real buffers 31 31 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). 39 35 40 36 */ … … 42 38 /** Buffer for real data in double precision */ 43 39 typedef 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] */ 46 42 } lvec_t; 47 43 -
TabularUnified src/mathutils.c ¶
rbab24a0 r714d05e 44 44 45 45 fvec_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) { 46 new_aubio_window (char_t * window_type, uint_t size) 47 { 48 fvec_t * win = new_fvec (size); 54 49 smpl_t * w = win->data; 55 uint_t i , size = win->length;50 uint_t i; 56 51 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) 61 53 wintype = aubio_win_rectangle; 62 54 else if (strcmp (window_type, "hamming") == 0) … … 79 71 wintype = aubio_win_default; 80 72 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; 83 75 } 84 76 switch(wintype) { … … 113 105 break; 114 106 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)); 125 109 break; 126 110 case aubio_win_welch: 127 111 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)); 129 113 break; 130 114 case aubio_win_parzen: 131 115 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)); 133 117 break; 134 118 default: 135 119 break; 136 120 } 137 return 0;121 return win; 138 122 } 139 123 -
TabularUnified src/mathutils.h ¶
rbab24a0 r714d05e 19 19 */ 20 20 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 28 23 */ 29 24 … … 185 180 void fvec_min_removal (fvec_t * v); 186 181 187 /** compute moving median th reshold of a vector182 /** compute moving median theshold of a vector 188 183 189 184 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 to185 position of a vector, taking the median amongs post elements before and up to 191 186 pre elements after pos. 192 187 -
TabularUnified src/musicutils.h ¶
rbab24a0 r714d05e 45 45 */ 46 46 fvec_t *new_aubio_window (char_t * window_type, uint_t size); 47 48 /** set elements of a vector to window coefficients49 50 */51 uint_t fvec_set_window (fvec_t * window, char_t * window_type);52 47 53 48 /** compute the principal argument -
TabularUnified src/onset/onset.h ¶
rbab24a0 r714d05e 21 21 /** \file 22 22 23 Onset detection object23 Onset detection driver 24 24 25 25 The following routines compute the onset detection function and detect peaks 26 26 in these functions. When onsets are found above a given silence threshold, 27 27 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. 30 29 31 30 The peak-picking threshold, the silence threshold, and the minimum 32 31 inter-onset interval can be adjusted during the execution of the 33 32 aubio_onset_do routine using the corresponding functions. 34 35 \example onset/test-onset.c36 33 37 34 */ -
TabularUnified src/onset/peakpicker.h ¶
rbab24a0 r714d05e 22 22 23 23 Peak picking utilities function 24 25 \example onset/test-peakpicker.c26 24 27 25 */ -
TabularUnified src/pitch/pitch.c ¶
rbab24a0 r714d05e 35 35 #include "pitch/pitch.h" 36 36 37 /** pitch detection algorithm s*/37 /** pitch detection algorithm */ 38 38 typedef enum 39 39 { 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 */ 47 46 } aubio_pitch_type; 48 47 49 /** pitch detection output mode s*/48 /** pitch detection output mode */ 50 49 typedef enum 51 50 { -
TabularUnified src/pitch/pitch.h ¶
rbab24a0 r714d05e 32 32 This file creates the objects required for the computation of the selected 33 33 pitch detection algorithm and output the results, in midi note or Hz. 34 35 \example pitch/test-pitch.c36 34 37 35 */ -
TabularUnified src/pitch/pitchfcomb.h ¶
rbab24a0 r714d05e 28 28 This file was derived from the tuneit project, written by Mario Lang to 29 29 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 34 32 35 33 */ … … 45 43 typedef struct _aubio_pitchfcomb_t aubio_pitchfcomb_t; 46 44 47 /** execute pitch detection on an input buffer 48 45 /** execute pitch detection on an input buffer 46 49 47 \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) 51 49 \param output pitch candidates in bins 52 50 53 51 */ 54 52 void aubio_pitchfcomb_do (aubio_pitchfcomb_t * p, fvec_t * input, … … 56 54 57 55 /** 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 62 60 */ 63 61 aubio_pitchfcomb_t *new_aubio_pitchfcomb (uint_t buf_size, uint_t hop_size); 64 62 65 63 /** deletion of the pitch detection object 66 64 67 65 \param p pitch detection object as returned by new_aubio_pitchfcomb 68 66 69 67 */ 70 68 void del_aubio_pitchfcomb (aubio_pitchfcomb_t * p); -
TabularUnified src/pitch/pitchmcomb.h ¶
rbab24a0 r714d05e 24 24 25 25 This fundamental frequency estimation algorithm implements spectral 26 flattening, multi-comb filtering and peak histogramming. 26 flattening, multi-comb filtering and peak histogramming. 27 27 28 28 This method was designed by Juan P. Bello and described in: … … 31 31 Music''. PhD thesis, Centre for Digital Music, Queen Mary University of 32 32 London, London, UK, 2003. 33 34 \example pitch/test-pitchmcomb.c35 33 36 34 */ … … 47 45 48 46 /** execute pitch detection on an input spectral frame 49 47 50 48 \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 54 51 */ 55 void aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * in_fftgrain,56 fvec_t * out _cands);52 void aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * fftgrain, 53 fvec_t * output); 57 54 58 55 /** 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 63 61 */ 64 62 aubio_pitchmcomb_t *new_aubio_pitchmcomb (uint_t buf_size, uint_t hop_size); 65 63 66 64 /** deletion of the pitch detection object 67 65 68 66 \param p pitch detection object as returned by new_aubio_pitchfcomb 69 67 70 68 */ 71 69 void del_aubio_pitchmcomb (aubio_pitchmcomb_t * p); … … 75 73 #endif 76 74 77 #endif /* PITCHMCOMB_H */75 #endif/*PITCHMCOMB_H*/ -
TabularUnified src/pitch/pitchschmitt.h ¶
rbab24a0 r714d05e 19 19 */ 20 20 21 /** \file 21 /** \file 22 22 23 Pitch detection using a Schmitt trigger 24 23 Pitch detection using a Schmitt trigger 24 25 25 This pitch extraction method implements a Schmitt trigger to estimate the 26 26 period of a signal. … … 28 28 This file was derived from the tuneit project, written by Mario Lang to 29 29 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 34 32 35 33 */ … … 45 43 typedef struct _aubio_pitchschmitt_t aubio_pitchschmitt_t; 46 44 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 samples52 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 53 51 */ 54 void aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, fvec_t * samples_in,55 fvec_t * cands_out);52 void aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, fvec_t * in, 53 fvec_t * out); 56 54 57 55 /** 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 61 59 */ 62 60 aubio_pitchschmitt_t *new_aubio_pitchschmitt (uint_t buf_size); 63 61 64 62 /** 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 68 66 */ 69 67 void del_aubio_pitchschmitt (aubio_pitchschmitt_t * p); -
TabularUnified src/pitch/pitchyin.h ¶
rbab24a0 r714d05e 19 19 */ 20 20 21 /** \file 22 21 /** \file 22 23 23 Pitch detection using the YIN algorithm 24 24 25 25 This algorithm was developped by A. de Cheveigne and H. Kawahara and 26 26 published in: 27 27 28 28 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 31 31 see http://recherche.ircam.fr/equipes/pcm/pub/people/cheveign.html 32 33 \example pitch/test-pitchyin.c34 32 35 33 */ … … 46 44 47 45 /** 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 51 49 */ 52 50 aubio_pitchyin_t *new_aubio_pitchyin (uint_t buf_size); 53 51 54 52 /** deletion of the pitch detection object 55 56 \param opitch detection object as returned by new_aubio_pitchyin()57 53 54 \param p pitch detection object as returned by new_aubio_pitchyin() 55 58 56 */ 59 57 void del_aubio_pitchyin (aubio_pitchyin_t * o); 60 58 61 /** execute pitch detection an input buffer62 63 \param opitch 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 samples66 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 67 65 */ 68 void aubio_pitchyin_do (aubio_pitchyin_t * o, fvec_t * samples_in, fvec_t * cands_out);66 void aubio_pitchyin_do (aubio_pitchyin_t * o, fvec_t * in, fvec_t * out); 69 67 70 68 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 74 72 \param tol tolerance parameter for minima selection [default 0.15] 75 73 … … 77 75 uint_t aubio_pitchyin_set_tolerance (aubio_pitchyin_t * o, smpl_t tol); 78 76 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 82 80 \return tolerance parameter for minima selection [default 0.15] 83 81 … … 89 87 #endif 90 88 91 #endif /*PITCHYIN_H*/ 89 #endif /*PITCHYIN_H*/ -
TabularUnified src/pitch/pitchyinfft.h ¶
rbab24a0 r714d05e 32 32 Queen Mary University of London, London, UK, 2006. 33 33 34 \example pitch/test-pitchyinfft.c35 36 34 */ 37 35 … … 48 46 /** execute pitch detection on an input buffer 49 47 50 \param opitch detection object as returned by new_aubio_pitchyinfft51 \param samples_in input signal vector (length as specified at creation time)52 \param cands_out pitch period candidates, in samples48 \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 53 51 54 52 */ 55 void aubio_pitchyinfft_do (aubio_pitchyinfft_t * o, fvec_t * samples_in, fvec_t * cands_out);53 void aubio_pitchyinfft_do (aubio_pitchyinfft_t * p, fvec_t * in, fvec_t * out); 56 54 /** creation of the pitch detection object 57 55 … … 62 60 /** deletion of the pitch detection object 63 61 64 \param opitch detection object as returned by new_aubio_pitchyinfft()62 \param p pitch detection object as returned by new_aubio_pitchyinfft() 65 63 66 64 */ 67 void del_aubio_pitchyinfft (aubio_pitchyinfft_t * o);65 void del_aubio_pitchyinfft (aubio_pitchyinfft_t * p); 68 66 69 67 /** get tolerance parameter for YIN algorithm … … 74 72 75 73 */ 76 smpl_t aubio_pitchyinfft_get_tolerance (aubio_pitchyinfft_t * o);74 smpl_t aubio_pitchyinfft_get_tolerance (aubio_pitchyinfft_t * p); 77 75 78 76 /** set tolerance parameter for YIN algorithm … … 82 80 83 81 */ 84 uint_t aubio_pitchyinfft_set_tolerance (aubio_pitchyinfft_t * o, smpl_t tol);82 uint_t aubio_pitchyinfft_set_tolerance (aubio_pitchyinfft_t * p, smpl_t tol); 85 83 86 84 #ifdef __cplusplus -
TabularUnified src/spectral/fft.h ¶
rbab24a0 r714d05e 22 22 23 23 Fast Fourier Transform object 24 25 \example src/spectral/test-fft.c26 24 27 25 */ -
TabularUnified src/spectral/filterbank.c ¶
rbab24a0 r714d05e 70 70 /* for each filter */ 71 71 for (fn = 0; fn < max_filters; fn++) { 72 72 73 /* for each sample */ 73 74 for (j = 0; j < max_length; j++) { -
TabularUnified src/spectral/filterbank.h ¶
rbab24a0 r714d05e 26 26 General-purpose spectral filterbank object. 27 27 28 \example spectral/test-filterbank.c29 30 28 */ 31 29 … … 38 36 #endif 39 37 40 /** filterbank object 41 42 This object stores a matrix of spectral filter coefficients. 43 44 */ 38 /** filterbank object */ 45 39 typedef struct _aubio_filterbank_t aubio_filterbank_t; 46 40 -
TabularUnified src/spectral/filterbank_mel.h ¶
rbab24a0 r714d05e 22 22 /** \file 23 23 24 Filterbank object coefficients initialization24 Mel frequency filter bankd coefficients 25 25 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. 29 27 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). 31 31 32 32 */ … … 58 58 \param samplerate audio sampling rate 59 59 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. 63 61 64 62 */ … … 70 68 #endif 71 69 72 #endif // FILTERBANK_MEL_H70 #endif // FILTERBANK_MEL_H -
TabularUnified src/spectral/mfcc.h ¶
rbab24a0 r714d05e 23 23 24 24 Mel-frequency cepstrum coefficients object 25 26 \example spectral/test-mfcc.c27 25 28 26 */ -
TabularUnified src/spectral/phasevoc.h ¶
rbab24a0 r714d05e 27 27 phase relationships across frames. The window sizes and overlap are specified 28 28 at creation time. 29 30 \example spectral/test-phasevoc.c31 29 32 30 */ -
TabularUnified src/spectral/specdesc.h ¶
rbab24a0 r714d05e 27 27 buffer (stored in a vector of size [1]). 28 28 29 \section specdesc Spectral description functions30 31 29 A list of the spectral description methods currently available follows. 32 30 33 \s ubsection onsetdesc Onset detection functions31 \section onsetdesc Onset detection functions 34 32 35 33 These functions are designed to raise at notes attacks in music signals. … … 84 82 Canada, 2006. 85 83 86 \s ubsection shapedesc Spectral shape descriptors84 \section shapedesc Spectral shape descriptors 87 85 88 86 The following descriptors are described in: … … 141 139 is found. 142 140 143 \example spectral/test-specdesc.c144 145 141 */ 146 142 … … 173 169 \param buf_size length of the input spectrum frame 174 170 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 180 171 */ 181 172 aubio_specdesc_t *new_aubio_specdesc (char_t * method, uint_t buf_size); -
TabularUnified src/spectral/tss.h ¶
rbab24a0 r714d05e 32 32 33 33 Available at http://www.csis.ul.ie/dafx01/proceedings/papers/duxbury.pdf 34 35 \example spectral/test-tss.c36 34 37 35 */ -
TabularUnified src/tempo/beattracking.h ¶
rbab24a0 r714d05e 33 33 towards automatic musical accompaniment. In Proceedings of the Audio 34 34 Engeeniring Society 118th Convention, Barcelona, Spain, May 2005. 35 36 \example tempo/test-beattracking.c37 35 38 36 */ -
TabularUnified src/tempo/tempo.h ¶
rbab24a0 r714d05e 25 25 This object stores all the memory required for tempo detection algorithm 26 26 and returns the estimated beat locations. 27 28 \example tempo/test-tempo.c29 27 30 28 */ -
TabularUnified src/temporal/a_weighting.h ¶
rbab24a0 r714d05e 53 53 file sampling rates have been included for completeness. 54 54 55 \example temporal/test-a_weighting.c56 57 55 */ 58 56 -
TabularUnified src/temporal/biquad.h ¶
rbab24a0 r714d05e 36 36 biquad filter</a> on wikipedia. 37 37 38 \example temporal/test-biquad.c39 40 38 */ 41 39 … … 57 55 lsmp_t b2, lsmp_t a1, lsmp_t a2); 58 56 59 /** create biquad filter with `b0`, `b1`, `b2`, `a1`, `a2` coeffs57 /** create new biquad filter 60 58 61 59 \param b0 forward filter coefficient -
TabularUnified src/temporal/c_weighting.h ¶
rbab24a0 r714d05e 53 53 file sampling rates have been included for completeness. 54 54 55 \example temporal/test-c_weighting.c56 57 55 */ 58 56 -
TabularUnified src/temporal/filter.h ¶
rbab24a0 r714d05e 58 58 - new_aubio_filter_c_weighting() and aubio_filter_set_c_weighting(). 59 59 - new_aubio_filter_biquad() and aubio_filter_set_biquad(). 60 61 \example temporal/test-filter.c62 60 63 61 */ -
TabularUnified src/vecutils.h ¶
rbab24a0 r714d05e 19 19 */ 20 20 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 * 25 24 */ 26 25 -
TabularUnified tests/src/io/test-sink.c ¶
rbab24a0 r714d05e 1 #include <stdio.h> 1 2 #include <aubio.h> 2 #include " utils_tests.h"3 #include "config.h" 3 4 4 int main (int argc, char **argv) 5 { 6 sint_t err = 0; 5 char_t *path = "/home/piem/archives/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"; 6 char_t *outpath = "/var/tmp/test.wav"; 7 7 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 8 int main(){ 9 int err = 0; 15 10 uint_t samplerate = 44100; 16 11 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); 18 16 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; } 22 18 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 ) { 31 20 aubio_source_do(i, vec, &read); 32 21 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 } 38 23 39 24 beach: … … 43 28 return err; 44 29 } 30 -
TabularUnified tests/src/io/test-sink_apple_audio_file.c ¶
rbab24a0 r714d05e 1 # define AUBIO_UNSTABLE 11 #include <stdio.h> 2 2 #include <aubio.h> 3 #include " utils_tests.h"3 #include "config.h" 4 4 5 int main (int argc, char **argv) 6 { 7 sint_t err = 0; 5 char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"; 6 char_t *outpath = "/var/tmp/test.wav"; 8 7 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 8 int main(){ 9 int err = 0; 16 10 #ifdef __APPLE__ 17 11 uint_t samplerate = 44100; 18 12 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); 20 17 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; } 24 19 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 ) { 33 21 aubio_source_apple_audio_do(i, vec, &read); 34 22 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 } 40 24 41 25 beach: … … 44 28 del_fvec(vec); 45 29 #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"); 48 31 #endif /* __APPLE__ */ 49 32 return err; 50 33 } 34 -
TabularUnified tests/src/io/test-sink_sndfile.c ¶
rbab24a0 r714d05e 1 #include <stdio.h> 1 2 #include <aubio.h> 2 #include " utils_tests.h"3 #include "config.h" 3 4 4 int main (int argc, char **argv) 5 { 6 sint_t err = 0; 5 char_t *path = "/home/piem/archives/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"; 6 char_t *outpath = "/var/tmp/test.wav"; 7 7 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 8 int main(){ 9 int err = 0; 15 10 #ifdef HAVE_SNDFILE 16 11 uint_t samplerate = 44100; 17 12 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; 24 14 fvec_t *vec = new_fvec(hop_size); 25 15 aubio_source_sndfile_t * i = new_aubio_source_sndfile(path, samplerate, hop_size); 26 if (samplerate == 0 ) samplerate = aubio_source_sndfile_get_samplerate(i);27 16 aubio_sink_sndfile_t * o = new_aubio_sink_sndfile(outpath, samplerate); 28 17 29 if (!i || !o) { err = 1; goto beach; }18 if (!i || !o) { err = -1; goto beach; } 30 19 31 do{20 while ( read == hop_size ) { 32 21 aubio_source_sndfile_do(i, vec, &read); 33 22 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 } 39 24 40 25 beach: … … 43 28 del_fvec(vec); 44 29 #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"); 47 31 #endif /* HAVE_SNDFILE */ 48 32 return err; 49 33 } 34 -
TabularUnified tests/src/io/test-source.c ¶
rbab24a0 r714d05e 1 #include <stdio.h> 1 2 #include <aubio.h> 2 #include "utils_tests.h"3 3 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; 4 char_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 7 int 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]); 12 19 } 13 20 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); 18 22 19 char_t *source_path = argv[1]; 23 return 0; 24 } 20 25 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 11 #include <stdio.h> 2 2 #include <aubio.h> 3 #include "utils_tests.h"4 3 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; 4 char_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 7 int 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]); 13 20 } 14 21 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); 38 23 #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"); 41 25 #endif /* __APPLE__ */ 42 26 return 0; 43 27 } 28 -
TabularUnified tests/src/io/test-source_sndfile.c ¶
rbab24a0 r714d05e 1 #include <stdio.h> 1 2 #include <aubio.h> 2 #include " utils_tests.h"3 #include "config.h" 3 4 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 } 5 char_t *path = "/home/piem/archives/samples/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"; 13 6 7 int main(){ 8 int err = 0; 14 9 #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; 22 13 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); 25 15 26 16 if (!s) { err = 1; goto beach; } 27 17 28 do{18 while ( read == hop_size ) { 29 19 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 } 33 23 34 24 beach: 35 del_aubio_source_sndfile 36 del_fvec 25 del_aubio_source_sndfile(s); 26 del_fvec(vec); 37 27 #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"); 39 29 err = 2; 40 30 #endif /* HAVE_SNDFILE */ 41 31 return err; 42 32 } 33 -
TabularUnified tests/src/onset/test-onset.c ¶
rbab24a0 r714d05e 1 1 #include <aubio.h> 2 2 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); 3 int 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; 15 10 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 }; 26 15 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(); 32 20 33 return 0;21 return 0; 34 22 } -
TabularUnified tests/src/onset/test-peakpicker.c ¶
rbab24a0 r714d05e 3 3 #include <aubio.h> 4 4 5 int main ()6 { 7 uint_t win_s = 1024; // window size8 fvec_t * in = new_fvec (win_s); // input buffer9 fvec_t * out = new_fvec (1); // input buffer10 aubio_peakpicker_t * o = new_aubio_peakpicker();11 aubio_peakpicker_set_threshold (o, 0.3);5 int 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); 12 12 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); 17 17 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; 22 22 } 23 23 -
TabularUnified tests/src/pitch/test-pitch.c ¶
rbab24a0 r714d05e 1 1 #include <aubio.h> 2 2 3 int main () 3 int 4 main () 4 5 { 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; 15 15 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++; 25 19 }; 26 20 27 // 3. clean up memory28 21 del_aubio_pitch (o); 29 22 del_fvec (out); 30 del_fvec (in put);23 del_fvec (in); 31 24 aubio_cleanup (); 32 25 -
TabularUnified tests/src/pitch/test-pitchfcomb.c ¶
rbab24a0 r714d05e 1 1 #define AUBIO_UNSTABLE 1 2 3 // this file uses the unstable aubio api, please use aubio_pitch instead4 // see src/pitch/pitch.h and tests/src/pitch/test-pitch.c5 2 6 3 #include <aubio.h> 7 4 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); 5 int 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; 18 14 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 }; 23 19 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; 29 26 } -
TabularUnified tests/src/pitch/test-pitchmcomb.c ¶
rbab24a0 r714d05e 1 1 #define AUBIO_UNSTABLE 1 2 3 // this file uses the unstable aubio api, please use aubio_pitch instead4 // see src/pitch/pitch.h and tests/src/pitch/test-pitch.c5 2 6 3 #include <aubio.h> 7 4 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); 5 int 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 */ 18 11 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; 23 14 24 // clean up before exiting25 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 }; 28 19 29 aubio_cleanup(); 20 del_aubio_pitchmcomb(o); 21 del_cvec(in); 22 del_fvec(out); 23 aubio_cleanup(); 30 24 31 return 0;25 return 0; 32 26 } -
TabularUnified tests/src/pitch/test-pitchschmitt.c ¶
rbab24a0 r714d05e 1 1 #define AUBIO_UNSTABLE 1 2 3 // this file uses the unstable aubio api, please use aubio_pitch instead4 // see src/pitch/pitch.h and tests/src/pitch/test-pitch.c5 2 6 3 #include <aubio.h> 7 4 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); 5 int 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; 17 12 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 }; 21 17 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(); 26 22 27 return 0;23 return 0; 28 24 } 29 25 -
TabularUnified tests/src/pitch/test-pitchyin.c ¶
rbab24a0 r714d05e 1 1 #define AUBIO_UNSTABLE 1 2 3 // this file uses the unstable aubio api, please use aubio_pitch instead4 // see src/pitch/pitch.h and tests/src/pitch/test-pitch.c5 2 6 3 #include <aubio.h> 7 4 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); 5 int 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; 17 12 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 }; 21 17 22 fvec_print(output_cands); 18 del_fvec(in); 19 del_fvec(out); 20 del_aubio_pitchyin(p); 21 aubio_cleanup(); 23 22 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; 30 24 } -
TabularUnified tests/src/pitch/test-pitchyinfft.c ¶
rbab24a0 r714d05e 1 1 #define AUBIO_UNSTABLE 1 2 3 // this file uses the unstable aubio api, please use aubio_pitch instead4 // see src/pitch/pitch.h and tests/src/pitch/test-pitch.c5 2 6 3 #include <aubio.h> 7 4 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); 5 int 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; 18 13 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 }; 22 18 23 fvec_print(out); 19 del_aubio_pitchyinfft(o); 20 del_fvec(in); 21 del_fvec(out); 22 aubio_cleanup(); 24 23 25 del_fvec(in); 26 del_fvec(out); 27 del_aubio_pitchyinfft(p); 28 aubio_cleanup(); 24 return 0; 25 } 29 26 30 return 0;31 } -
TabularUnified tests/src/spectral/test-fft.c ¶
rbab24a0 r714d05e 1 1 2 #include <aubio.h> 2 3 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; 4 int 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; 38 34 } -
TabularUnified tests/src/spectral/test-filterbank.c ¶
rbab24a0 r714d05e 1 #define AUBIO_UNSTABLE 1 2 3 #include <stdio.h> 1 4 #include <aubio.h> 2 5 3 int main () 6 int 7 main (void) 4 8 { 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; 7 15 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 */ 13 17 aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s); 14 18 15 19 coeffs = aubio_filterbank_get_coeffs (o); 20 if (coeffs == NULL) { 21 return -1; 22 } 16 23 17 aubio_filterbank_do (o, in_spec, out_filters); 24 /* 25 if (fvec_max (coeffs) != 0.) { 26 return -1; 27 } 18 28 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); 22 37 23 38 del_aubio_filterbank (o); 24 del_cvec (in _spec);25 del_fvec (out _filters);39 del_cvec (in); 40 del_fvec (out); 26 41 aubio_cleanup (); 27 42 -
TabularUnified tests/src/spectral/test-filterbank_mel.c ¶
rbab24a0 r714d05e 1 #define AUBIO_UNSTABLE 1 2 3 #include <stdio.h> 1 4 #include <aubio.h> 2 5 3 int main () 6 int 7 main (void) 4 8 { 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.; 8 16 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 */ 14 18 aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s); 15 19 16 / / assign Mel-frequency coefficients20 /* assign Mel-frequency coefficients */ 17 21 aubio_filterbank_set_mel_coeffs_slaney (o, samplerate); 18 22 19 23 coeffs = aubio_filterbank_get_coeffs (o); 24 if (coeffs == NULL) { 25 return -1; 26 } 20 27 21 aubio_filterbank_do (o, in_spec, out_filters);28 //fmat_print (coeffs); 22 29 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); 26 33 27 34 del_aubio_filterbank (o); 28 del_cvec (in _spec);29 del_fvec (out _filters);35 del_cvec (in); 36 del_fvec (out); 30 37 aubio_cleanup (); 31 38 -
TabularUnified tests/src/spectral/test-mfcc.c ¶
rbab24a0 r714d05e 1 1 #include <aubio.h> 2 2 3 int main () 3 int 4 main (void) 4 5 { 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.; 11 13 12 / / create mfcc object14 /* allocate fft and other memory space */ 13 15 aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coefs, samplerate); 14 16 15 17 cvec_set (in, 1.); 18 19 aubio_mfcc_do (o, in, out); 20 fvec_print (out); 16 21 aubio_mfcc_do (o, in, out); 17 22 fvec_print (out); 18 23 19 cvec_set (in, .5);20 aubio_mfcc_do (o, in, out);21 fvec_print (out);22 23 // clean up24 24 del_aubio_mfcc (o); 25 25 del_cvec (in); -
TabularUnified tests/src/spectral/test-phasevoc-jack.c ¶
rbab24a0 r714d05e 15 15 #endif /* HAVE_JACK */ 16 16 17 uint_t testing = 0; / / change this to 1 to listen17 uint_t testing = 0; /* change this to 1 to listen */ 18 18 19 uint_t win_s = 512; // window size20 uint_t hop_s = 128; // hop size21 uint_t channels = 2; // number of audio channels22 uint_t midiin = 4; // number of midi input channels23 uint_t midiout = 2; // number of midi output channels24 uint_t pos = 0; // frames%dspblocksize for jack loop19 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 */ 25 25 26 26 fvec_t * in[2]; … … 32 32 int aubio_process(float **input, float **output, int nframes); 33 33 34 int main () 35 { 36 /* allocate some memory */ 34 int main(){ 35 /* allocate some memory */ 37 36 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 } 45 44 46 45 #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); 57 56 #else 58 fprintf(stderr, "WARNING: no jack support\n");57 fprintf(stderr, "WARNING: no jack support\n"); 59 58 #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; 69 68 } 70 69 … … 82 81 if (pos == hop_s-1) { 83 82 /* 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.); 96 91 } 92 // copy second channel to third one 93 aubio_pvoc_rdo(pv[i], fftgrain[i], out[i]); 94 pos = -1; 95 } 97 96 } 98 97 pos++; -
TabularUnified tests/src/spectral/test-phasevoc.c ¶
rbab24a0 r714d05e 1 /* test sample for phase vocoder */ 2 3 #include <stdio.h> 1 4 #include <aubio.h> 2 5 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; 6 int 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; 47 30 } -
TabularUnified tests/src/spectral/test-specdesc.c ¶
rbab24a0 r714d05e 1 2 #define AUBIO_UNSTABLE 1 3 1 4 #include <aubio.h> 2 5 3 int main () 6 int 7 main () 4 8 { 5 uint_t win_s = 1024; // window size6 cvec_t *in = new_cvec (win_s); // input buffer7 fvec_t *out = new_fvec (1); / / output spectral descriptor9 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 */ 8 12 9 13 aubio_specdesc_t *o; 10 14 11 15 o = new_aubio_specdesc ("energy", win_s); 12 16 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 1 10 #include <aubio.h> 2 11 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 12 int main(){ 13 int i; 14 uint_t win_s = 1024; /* window size */ 15 uint_t hop_s = 256; /* hop size */ 8 16 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 */ 18 25 aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s); 19 // create transient/steady-state separation object20 aubio_tss_t * tss = new_aubio_tss(win_s,hop_s);21 // create phase vocoder objects for synthesis of output signals22 26 aubio_pvoc_t * pvt = new_aubio_pvoc(win_s,hop_s); 23 27 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"); 24 32 25 33 /* 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); 35 39 } 36 40 … … 46 50 del_fvec(stead); 47 51 del_fvec(trans); 48 49 52 aubio_cleanup(); 50 53 printf("memory freed\n"); 51 54 return 0; 52 55 } -
TabularUnified tests/src/tempo/test-beattracking.c ¶
rbab24a0 r714d05e 1 1 #define AUBIO_UNSTABLE 1 2 2 3 #include <stdio.h> 3 4 #include <aubio.h> 4 5 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 6 int 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); 11 14 12 // create beattracking object 13 aubio_beattracking_t * tempo = new_aubio_beattracking(win_s); 15 uint_t i = 0; 14 16 15 smpl_t bpm, confidence;17 smpl_t curtempo, curtempoconf; 16 18 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 }; 20 33 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(); 24 38 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; 37 40 } 38 41 -
TabularUnified tests/src/tempo/test-tempo.c ¶
rbab24a0 r714d05e 1 #include <stdio.h> 1 2 #include <aubio.h> 2 3 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 4 int 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; 9 11 10 // create tempo object 11 aubio_tempo_t * o = new_aubio_tempo("complex", win_s, win_s/4, 44100.); 12 smpl_t curtempo, curtempoconf; 12 13 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 }; 14 28 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(); 18 33 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; 37 35 } -
TabularUnified tests/src/temporal/test-a_weighting.c ¶
rbab24a0 r714d05e 1 1 #include <aubio.h> 2 2 3 int main () 4 { 3 int main(){ 5 4 6 5 aubio_filter_t * f; -
TabularUnified tests/src/temporal/test-biquad.c ¶
rbab24a0 r714d05e 1 1 #include <aubio.h> 2 2 3 int main () 4 { 5 uint_t win_s = 64; // window size 3 int 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); 6 8 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); 9 11 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; 32 15 } -
TabularUnified tests/src/temporal/test-c_weighting.c ¶
rbab24a0 r714d05e 1 1 #include <aubio.h> 2 2 3 int main ()4 { 3 int main(){ 4 5 5 aubio_filter_t * f; 6 6 -
TabularUnified tests/src/temporal/test-filter.c ¶
rbab24a0 r714d05e 1 1 #include <aubio.h> 2 2 3 int main () 3 int 4 main (void) 4 5 { 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 8 11 9 12 aubio_filter_t *o = new_aubio_filter_c_weighting (44100); … … 14 17 del_aubio_filter (o); 15 18 16 o = new_aubio_filter_ a_weighting (32000);19 o = new_aubio_filter_c_weighting (44100); 17 20 in->data[12] = 0.5; 18 21 fvec_print (in); 19 22 aubio_filter_do_outplace (o, in, out); 20 23 fvec_print (out); 24 del_aubio_filter (o); 21 25 22 aubio_filter_set_a_weighting (o, 32000);26 o = new_aubio_filter_c_weighting (44100); 23 27 in->data[12] = 0.5; 24 28 fvec_print (in); 25 29 aubio_filter_do_filtfilt (o, in, out); 26 30 fvec_print (out); 31 del_aubio_filter (o); 27 32 28 33 del_fvec (in); 29 34 del_fvec (out); 30 del_aubio_filter (o);31 35 aubio_cleanup (); 32 36 -
TabularUnified tests/src/temporal/test-resampler.c ¶
rbab24a0 r714d05e 1 #include <stdio.h> 1 2 #include <aubio.h> 2 3 3 int main () 4 int 5 main () 4 6 { 5 uint_t win_s = 1024; // window size 7 /* allocate some memory */ 8 uint_t win_s = 1024; /* window size */ 6 9 smpl_t ratio = 0.5; 7 fvec_t *in = new_fvec (win_s); // input buffer8 fvec_t *out = new_fvec ((uint_t) (win_s * ratio)); // output buffer10 fvec_t *in = new_fvec (win_s); /* input buffer */ 11 fvec_t *out = new_fvec ((uint_t) (win_s * ratio)); /* input buffer */ 9 12 aubio_resampler_t *o = new_aubio_resampler (0.5, 0); 10 13 uint_t i = 0; -
TabularUnified tests/src/test-cvec.c ¶
rbab24a0 r714d05e 1 1 #include <aubio.h> 2 #include "utils_tests.h"3 2 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; 3 int 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); 10 8 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 } 20 11 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 it37 del_cvec(complex_vector);38 return 0;39 } -
TabularUnified tests/src/test-fmat.c ¶
rbab24a0 r714d05e 1 1 #include <aubio.h> 2 #include <assert.h>3 2 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; 3 int 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; 25 10 } 26 11 -
TabularUnified tests/src/test-fvec.c ¶
rbab24a0 r714d05e 2 2 #include <assert.h> 3 3 4 int main () 5 { 6 uint_t vec_size = 10, i; 7 fvec_t * vec = new_fvec (vec_size); 4 int main(){ 5 uint_t buffer_size = 1024; 6 fvec_t * in = new_fvec (buffer_size); 8 7 9 // vec->length matches requested size 10 assert(vec->length == vec_size); 8 assert( in->length == buffer_size); 11 9 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); 16 13 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); 23 16 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); 40 18 41 19 return 0; -
TabularUnified tests/src/test-lvec.c ¶
rbab24a0 r714d05e 1 1 #include <aubio.h> 2 2 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; 3 int 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; 9 10 } 10 11 -
TabularUnified tests/src/test-mathutils-window.c ¶
rbab24a0 r714d05e 1 1 #include <aubio.h> 2 #include <math.h> 3 #include <stdio.h> 2 #include <stdlib.h> 4 3 5 int main ()4 int main( ) 6 5 { 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); 29 38 } 30 39 return 0; -
TabularUnified tests/src/test-mathutils.c ¶
rbab24a0 r714d05e 4 4 #include <aubio.h> 5 5 6 int test_next_power_of_two() 7 { 6 int main(){ 8 7 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);11 8 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); 14 12 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); 17 16 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); 23 20 24 21 return 0; 25 22 } 26 23 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 2 2 3 3 #include <aubio.h> 4 #include <stdlib.h> 4 5 5 int main ()6 int main( ) 6 7 { 7 8 uint_t length; -
TabularUnified tests/src/utils/test-scale.c ¶
rbab24a0 r714d05e 3 3 #include <aubio.h> 4 4 5 int main ()6 { 7 uint_t n = 0;8 uint_t win_s = 1024; // window size9 fvec_t * in = new_fvec (win_s); // input buffer10 aubio_scale_t * o = new_aubio_scale(0,1,2,3);11 aubio_scale_set_limits (o,0,1,2,3);5 int 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; 12 12 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 }; 17 17 18 del_aubio_scale(o);19 del_fvec(in);18 del_aubio_scale(o); 19 del_fvec(in); 20 20 21 return 0;21 return 0; 22 22 } -
TabularUnified tests/wscript_build ¶
rbab24a0 r714d05e 3 3 for target_name in ctx.path.ant_glob('src/**/*.c'): 4 4 uselib = [] 5 includes = ['../src' , '.']5 includes = ['../src'] 6 6 extra_source = [] 7 7 if str(target_name).endswith('-jack.c') and ctx.env['JACK']:
Note: See TracChangeset
for help on using the changeset viewer.