mathutils.h File Reference

various math functions More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  aubio_window_type {
  aubio_win_rectangle, aubio_win_hamming, aubio_win_hanning, aubio_win_hanningz,
  aubio_win_blackman, aubio_win_blackman_harris, aubio_win_gaussian, aubio_win_welch,
  aubio_win_parzen
}
 Window types. More...

Functions

void aubio_window (smpl_t *w, uint_t size, aubio_window_type wintype)
 create window
smpl_t aubio_unwrap2pi (smpl_t phase)
 principal argument
smpl_t vec_mean (fvec_t *s)
 calculates the mean of a vector
smpl_t vec_max (fvec_t *s)
 returns the max of a vector
smpl_t vec_min (fvec_t *s)
 returns the min of a vector
uint_t vec_min_elem (fvec_t *s)
 returns the index of the min of a vector
uint_t vec_max_elem (fvec_t *s)
 returns the index of the max of a vector
void vec_shift (fvec_t *s)
 implement 'fftshift' like function
smpl_t vec_sum (fvec_t *s)
 returns sum
smpl_t vec_local_energy (fvec_t *f)
 returns energy
smpl_t vec_local_hfc (fvec_t *f)
 returns High Frequency Energy Content
smpl_t vec_alpha_norm (fvec_t *DF, smpl_t alpha)
 return alpha norm.
void vec_dc_removal (fvec_t *mag)
 dc(min) removal
void vec_alpha_normalise (fvec_t *mag, uint_t alpha)
 alpha normalisation
void vec_add (fvec_t *mag, smpl_t threshold)
 add a constant to all members of a vector
void vec_adapt_thres (fvec_t *vec, fvec_t *tmp, uint_t win_post, uint_t win_pre)
 compute adaptive threshold of input vector
smpl_t vec_moving_thres (fvec_t *vec, fvec_t *tmp, uint_t win_post, uint_t win_pre, uint_t win_pos)
 adaptative thresholding
smpl_t vec_median (fvec_t *input)
 returns the median of the vector
smpl_t vec_quadint (fvec_t *x, uint_t pos)
 finds exact maximum position by quadratic interpolation
smpl_t vec_quadint_min (fvec_t *x, uint_t pos, uint_t span)
 finds exact minimum position by quadratic interpolation
smpl_t aubio_quadfrac (smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf)
 Quadratic interpolation using Lagrange polynomial.
uint_t vec_peakpick (fvec_t *input, uint_t pos)
 returns 1 if X1 is a peak and positive
smpl_t aubio_bintomidi (smpl_t bin, smpl_t samplerate, smpl_t fftsize)
 convert frequency bin to midi value
smpl_t aubio_miditobin (smpl_t midi, smpl_t samplerate, smpl_t fftsize)
 convert midi value to frequency bin
smpl_t aubio_bintofreq (smpl_t bin, smpl_t samplerate, smpl_t fftsize)
 convert frequency bin to frequency (Hz)
smpl_t aubio_freqtobin (smpl_t freq, smpl_t samplerate, smpl_t fftsize)
 convert frequency (Hz) to frequency bin
smpl_t aubio_freqtomidi (smpl_t freq)
 convert frequency (Hz) to midi value (0-128)
smpl_t aubio_miditofreq (smpl_t midi)
 convert midi value (0-128) to frequency (Hz)
uint_t aubio_silence_detection (fvec_t *ibuf, smpl_t threshold)
 check if current buffer level is under a given threshold
smpl_t aubio_level_detection (fvec_t *ibuf, smpl_t threshold)
 get the current buffer level
void aubio_autocorr (fvec_t *input, fvec_t *output)
 calculate normalised autocorrelation function
void aubio_cleanup (void)
 clean up cached memory at the end of program


Detailed Description

various math functions

Todo:
multichannel (each function should return -or set- an array sized to the number of channel in the input vector)
Todo:
appropriate switches depending on types.h content

Enumeration Type Documentation

enum aubio_window_type

Window types.

inspired from


Function Documentation

void aubio_cleanup ( void   ) 

clean up cached memory at the end of program

use this function at the end of programs to purge all cached memory. so far this function is only used to clean fftw cache.

smpl_t aubio_quadfrac ( smpl_t  s0,
smpl_t  s1,
smpl_t  s2,
smpl_t  pf 
)

Quadratic interpolation using Lagrange polynomial.

inspired from ``Comparison of interpolation algorithms in real-time sound processing'', Vladimir Arnost,

estimate = s0 + (pf/2.)*((pf-3.)*s0-2.*(pf-2.)*s1+(pf-1.)*s2); where

Parameters:
s0,s1,s2 are 3 known points on the curve,
pf is the floating point index [0;2]

smpl_t aubio_unwrap2pi ( smpl_t  phase  ) 

principal argument

mod(phase+PI,-TWO_PI)+PI

smpl_t vec_alpha_norm ( fvec_t DF,
smpl_t  alpha 
)

return alpha norm.

alpha=2 means normalise variance. alpha=1 means normalise abs value. as alpha goes large, tends to normalisation by max value.

Bug:
should not use POW :(

smpl_t vec_local_energy ( fvec_t f  ) 

returns energy

Bug:
mono

smpl_t vec_local_hfc ( fvec_t f  ) 

returns High Frequency Energy Content

Bug:
mono

smpl_t vec_max ( fvec_t s  ) 

returns the max of a vector

Bug:
mono

uint_t vec_max_elem ( fvec_t s  ) 

returns the index of the max of a vector

Bug:
mono

smpl_t vec_mean ( fvec_t s  ) 

calculates the mean of a vector

Bug:
mono

smpl_t vec_median ( fvec_t input  ) 

returns the median of the vector

This Quickselect routine is based on the algorithm described in "Numerical recipes in C", Second Edition, Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5

This code by Nicolas Devillard - 1998. Public domain, available at http://ndevilla.free.fr/median/median/

smpl_t vec_min ( fvec_t s  ) 

returns the min of a vector

Bug:
mono

uint_t vec_min_elem ( fvec_t s  ) 

returns the index of the min of a vector

Bug:
mono

smpl_t vec_moving_thres ( fvec_t vec,
fvec_t tmp,
uint_t  win_post,
uint_t  win_pre,
uint_t  win_pos 
)

adaptative thresholding

y=fn_thresh(fn,x,post,pre) compute adaptive threshold at each time fn : a function name or pointer, eg 'median' x: signal vector post: window length, causal part pre: window length, anti-causal part Returns: y: signal the same length as x

Formerly median_thresh, used compute median over a window of post+pre+1 samples, but now works with any function that takes a vector or matrix and returns a 'representative' value for each column, eg medians=fn_thresh(median,x,8,8) minima=fn_thresh(min,x,8,8) see SPARMS for explanation of post and pre

void vec_shift ( fvec_t s  ) 

implement 'fftshift' like function

a[0]...,a[n/2],a[n/2+1],...a[n]

becomes

a[n/2+1],...a[n],a[0]...,a[n/2]


Generated on Wed Oct 11 17:36:52 2006 for aubio by  doxygen 1.4.7