added bintomidi, freqtobin, miditofreq
[aubio.git] / src / mathutils.h
index e32bd03..e4499ff 100644 (file)
@@ -94,25 +94,25 @@ extern "C" {
 #endif
 
 typedef enum {
-       rectangle,          
-       hamming,
-       hanning,
-       hanningz,
-       blackman,
-       blackman_harris,
-       gaussian,
-       welch,
-       parzen
-} window_type_t;
+       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
+} aubio_window_type;
 
 /** create window */
-void window(smpl_t *w, uint_t size, window_type_t wintype);
+void aubio_window(smpl_t *w, uint_t size, aubio_window_type wintype);
 
 /** principal argument
  *
  * mod(phase+PI,-TWO_PI)+PI 
  */
-smpl_t unwrap2pi (smpl_t phase);
+smpl_t aubio_unwrap2pi (smpl_t phase);
 
 /** calculates the mean of a vector
  *
@@ -177,7 +177,7 @@ void vec_alpha_normalise(fvec_t * mag, uint_t alpha);
 void vec_add(fvec_t * mag, smpl_t threshold);
 
 void vec_adapt_thres(fvec_t * vec, fvec_t * tmp, 
-    uint_t post, uint_t pre);
+    uint_t win_post, uint_t win_pre);
 /**  adaptative thresholding 
  *
  * y=fn_thresh(fn,x,post,pre)
@@ -198,7 +198,7 @@ void vec_adapt_thres(fvec_t * vec, fvec_t * tmp,
  * see SPARMS for explanation of post and pre
  */
 smpl_t vec_moving_thres(fvec_t * vec, fvec_t * tmp, 
-    uint_t post, uint_t pre, uint_t pos);
+    uint_t win_post, uint_t win_pre, uint_t win_pos);
 
 /** returns the median of the vector 
  *
@@ -224,17 +224,24 @@ smpl_t vec_quadint(fvec_t * x,uint_t pos);
  *    \param s0,s1,s2 are 3 known points on the curve,
  *    \param pf is the floating point index [0;2]
  */
-smpl_t quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf);
+smpl_t aubio_quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf);
 
 /** returns 1 if X1 is a peak and positive */
 uint_t vec_peakpick(fvec_t * input, uint_t pos);
 
-smpl_t bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
-smpl_t bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
-smpl_t freqtomidi(smpl_t freq);
+smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
+smpl_t aubio_miditobin(smpl_t midi, smpl_t samplerate, smpl_t fftsize);
+smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
+smpl_t aubio_freqtobin(smpl_t freq, smpl_t samplerate, smpl_t fftsize);
+smpl_t aubio_freqtomidi(smpl_t freq);
+smpl_t aubio_miditofreq(smpl_t midi);
 
 uint_t aubio_silence_detection(fvec_t * ibuf, smpl_t threshold);
 smpl_t aubio_level_detection(fvec_t * ibuf, smpl_t threshold);
+/** 
+ * calculate normalised autocorrelation function
+ */
+void aubio_autocorr(fvec_t * input, fvec_t * output);
 
 #ifdef __cplusplus
 }