strip down stable public API, defining add AUBIO_UNSTABLE to access unstable API
authorPaul Brossier <piem@piem.org>
Thu, 22 Oct 2009 01:13:07 +0000 (03:13 +0200)
committerPaul Brossier <piem@piem.org>
Thu, 22 Oct 2009 01:13:07 +0000 (03:13 +0200)
src/aubio.h
src/aubio_priv.h
src/mathutils.c
src/mathutils.h
src/musicutils.h [new file with mode: 0644]
src/pitch/pitch.c
src/pitch/pitchfcomb.c
src/vecutils.c

index 433a425..5aad3a1 100644 (file)
@@ -63,33 +63,37 @@ extern "C"
 #include "fvec.h"
 #include "cvec.h"
 #include "lvec.h"
 #include "fvec.h"
 #include "cvec.h"
 #include "lvec.h"
-#include "mathutils.h"
-#include "vecutils.h"
-#include "utils/scale.h"
-#include "utils/hist.h"
-#include "spectral/tss.h"
+#include "musicutils.h"
 #include "temporal/resampler.h"
 #include "temporal/filter.h"
 #include "temporal/biquad.h"
 #include "temporal/a_weighting.h"
 #include "temporal/c_weighting.h"
 #include "temporal/resampler.h"
 #include "temporal/filter.h"
 #include "temporal/biquad.h"
 #include "temporal/a_weighting.h"
 #include "temporal/c_weighting.h"
-#include "spectral/filterbank.h"
-#include "spectral/filterbank_mel.h"
-#include "spectral/mfcc.h"
 #include "spectral/fft.h"
 #include "spectral/phasevoc.h"
 #include "spectral/fft.h"
 #include "spectral/phasevoc.h"
-#include "spectral/spectral_centroid.h"
+#include "spectral/mfcc.h"
 #include "pitch/pitch.h"
 #include "pitch/pitch.h"
+#include "onset/onset.h"
+#include "tempo/tempo.h"
+
+#if AUBIO_UNSTABLE
+#include "vecutils.h"
+#include "mathutils.h"
+#include "utils/scale.h"
+#include "utils/hist.h"
+#include "spectral/tss.h"
+#include "spectral/filterbank.h"
+#include "spectral/filterbank_mel.h"
 #include "pitch/pitchmcomb.h"
 #include "pitch/pitchyin.h"
 #include "pitch/pitchyinfft.h"
 #include "pitch/pitchschmitt.h"
 #include "pitch/pitchfcomb.h"
 #include "onset/onsetdetection.h"
 #include "pitch/pitchmcomb.h"
 #include "pitch/pitchyin.h"
 #include "pitch/pitchyinfft.h"
 #include "pitch/pitchschmitt.h"
 #include "pitch/pitchfcomb.h"
 #include "onset/onsetdetection.h"
-#include "onset/onset.h"
+#include "spectral/spectral_centroid.h"
 #include "onset/peakpick.h"
 #include "tempo/beattracking.h"
 #include "onset/peakpick.h"
 #include "tempo/beattracking.h"
-#include "tempo/tempo.h"
+#endif
 
 #ifdef __cplusplus
 } /* extern "C" */
 
 #ifdef __cplusplus
 } /* extern "C" */
index 24aec2e..0f12904 100644 (file)
 
 #include "types.h"
 
 
 #include "types.h"
 
+#define AUBIO_UNSTABLE 1
+
+#include "mathutils.h"
+
 /****
  * 
  * SYSTEM INTERFACE
 /****
  * 
  * SYSTEM INTERFACE
index 9e5505a..6ff973b 100644 (file)
@@ -23,6 +23,7 @@
 #include "aubio_priv.h"
 #include "fvec.h"
 #include "mathutils.h"
 #include "aubio_priv.h"
 #include "fvec.h"
 #include "mathutils.h"
+#include "musicutils.h"
 #include "config.h"
 
 
 #include "config.h"
 
 
index 31cf8b7..9c545e0 100644 (file)
 #ifndef MATHUTILS_H
 #define MATHUTILS_H
 
 #ifndef MATHUTILS_H
 #define MATHUTILS_H
 
+#include "fvec.h"
+#include "musicutils.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/** create window 
-  References:
-    
-    - <a href="http://en.wikipedia.org/wiki/Window_function">Window
-function</a> on Wikipedia
-    - Amalia de Götzen, Nicolas Bernardini, and Daniel Arfib. Traditional (?)
-implementations of a phase vocoder: the tricks of the trade. In Proceedings of
-the International Conference on Digital Audio Effects (DAFx-00), pages 37–44,
-Uni- versity of Verona, Italy, 2000.
-  (<a href="http://profs.sci.univr.it/%7Edafx/Final-Papers/ps/Bernardini.ps.gz">
-  ps.gz</a>)
-
-*/
-fvec_t *new_aubio_window (char_t * window_type, uint_t size);
-
-/** compute the principal argument
-
-  This function maps the input phase to its corresponding value wrapped in the
-range \f$ [-\pi, \pi] \f$.
-
-  \param phase unwrapped phase to map to the unit circle
-  
-  \return equivalent phase wrapped to the unit circle
-
-*/
-smpl_t aubio_unwrap2pi (smpl_t phase);
-
 /** compute the mean of a vector
 
   \param s vector to compute mean from
 /** compute the mean of a vector
 
   \param s vector to compute mean from
@@ -296,61 +271,12 @@ peak is defined as follows:
 */
 uint_t fvec_peakpick (fvec_t * v, uint_t p);
 
 */
 uint_t fvec_peakpick (fvec_t * v, uint_t p);
 
-/** convert frequency bin to midi value */
-smpl_t aubio_bintomidi (smpl_t bin, smpl_t samplerate, smpl_t fftsize);
-
-/** convert midi value to frequency bin */
-smpl_t aubio_miditobin (smpl_t midi, smpl_t samplerate, smpl_t fftsize);
-
-/** convert frequency bin to frequency (Hz) */
-smpl_t aubio_bintofreq (smpl_t bin, smpl_t samplerate, smpl_t fftsize);
-
-/** convert frequency (Hz) to frequency bin */
-smpl_t aubio_freqtobin (smpl_t freq, smpl_t samplerate, smpl_t fftsize);
-
-/** convert frequency (Hz) to midi value (0-128) */
-smpl_t aubio_freqtomidi (smpl_t freq);
-
-/** convert midi value (0-128) to frequency (Hz) */
-smpl_t aubio_miditofreq (smpl_t midi);
-
 /** return 1 if a is a power of 2, 0 otherwise */
 uint_t aubio_is_power_of_two(uint_t a);
 
 /** return the next power of power of 2 greater than a */
 uint_t aubio_next_power_of_two(uint_t a);
 
 /** return 1 if a is a power of 2, 0 otherwise */
 uint_t aubio_is_power_of_two(uint_t a);
 
 /** return the next power of power of 2 greater than a */
 uint_t aubio_next_power_of_two(uint_t a);
 
-/** compute sound pressure level (SPL) in dB
-
-  This quantity is often wrongly called 'loudness'.
-
-  \param v vector to compute dB SPL from
-
-  \return level of v in dB SPL
-
-*/
-smpl_t aubio_db_spl (fvec_t * v);
-
-/** check if buffer level in dB SPL is under a given threshold
-  \param v vector to get level from
-  \param threshold threshold in dB SPL
-
-  \return 0 if level is under the given threshold, 1 otherwise
-
-*/
-uint_t aubio_silence_detection (fvec_t * v, smpl_t threshold);
-
-/** get buffer level if level >= threshold, 1. otherwise
-
-  \param v vector to get level from
-  \param threshold threshold in dB SPL
-
-  \return level in dB SPL if level >= threshold, 1. otherwise
-
-*/
-smpl_t aubio_level_detection (fvec_t * v, smpl_t threshold);
-
 /** compute normalised autocorrelation function
 
   \param input vector to compute autocorrelation from
 /** compute normalised autocorrelation function
 
   \param input vector to compute autocorrelation from
@@ -359,26 +285,6 @@ smpl_t aubio_level_detection (fvec_t * v, smpl_t threshold);
 */
 void aubio_autocorr (fvec_t * input, fvec_t * output);
 
 */
 void aubio_autocorr (fvec_t * input, fvec_t * output);
 
-/** zero-crossing rate (ZCR)
-
-  The zero-crossing rate is the number of times a signal changes sign,
-  divided by the length of this signal.
-
-  \param v vector to compute ZCR from
-
-  \return zero-crossing rate of v
-
-*/
-smpl_t aubio_zero_crossing_rate (fvec_t * v);
-
-/** clean up cached memory at the end of program
-  This function should be used at the end of programs to purge all cached
-  memory. So far it is only useful to clean FFTW's cache.
-
-*/
-void aubio_cleanup (void);
-
 #ifdef __cplusplus
 }
 #endif
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/musicutils.h b/src/musicutils.h
new file mode 100644 (file)
index 0000000..92fd2a2
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+
+  This file is part of aubio.
+
+  aubio is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  aubio is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+/** @file
+ *  various math functions
+ */
+
+#ifndef MUSICUTILS_H
+#define MUSICUTILS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** create window 
+  References:
+    
+    - <a href="http://en.wikipedia.org/wiki/Window_function">Window
+function</a> on Wikipedia
+    - Amalia de Götzen, Nicolas Bernardini, and Daniel Arfib. Traditional (?)
+implementations of a phase vocoder: the tricks of the trade. In Proceedings of
+the International Conference on Digital Audio Effects (DAFx-00), pages 37–44,
+Uni- versity of Verona, Italy, 2000.
+  (<a href="http://profs.sci.univr.it/%7Edafx/Final-Papers/ps/Bernardini.ps.gz">
+  ps.gz</a>)
+
+*/
+fvec_t *new_aubio_window (char_t * window_type, uint_t size);
+
+/** compute the principal argument
+
+  This function maps the input phase to its corresponding value wrapped in the
+range \f$ [-\pi, \pi] \f$.
+
+  \param phase unwrapped phase to map to the unit circle
+  
+  \return equivalent phase wrapped to the unit circle
+
+*/
+smpl_t aubio_unwrap2pi (smpl_t phase);
+
+/** convert frequency bin to midi value */
+smpl_t aubio_bintomidi (smpl_t bin, smpl_t samplerate, smpl_t fftsize);
+
+/** convert midi value to frequency bin */
+smpl_t aubio_miditobin (smpl_t midi, smpl_t samplerate, smpl_t fftsize);
+
+/** convert frequency bin to frequency (Hz) */
+smpl_t aubio_bintofreq (smpl_t bin, smpl_t samplerate, smpl_t fftsize);
+
+/** convert frequency (Hz) to frequency bin */
+smpl_t aubio_freqtobin (smpl_t freq, smpl_t samplerate, smpl_t fftsize);
+
+/** convert frequency (Hz) to midi value (0-128) */
+smpl_t aubio_freqtomidi (smpl_t freq);
+
+/** convert midi value (0-128) to frequency (Hz) */
+smpl_t aubio_miditofreq (smpl_t midi);
+
+/** clean up cached memory at the end of program
+  This function should be used at the end of programs to purge all cached
+  memory. So far it is only useful to clean FFTW's cache.
+
+*/
+void aubio_cleanup (void);
+
+/** zero-crossing rate (ZCR)
+
+  The zero-crossing rate is the number of times a signal changes sign,
+  divided by the length of this signal.
+
+  \param v vector to compute ZCR from
+
+  \return zero-crossing rate of v
+
+*/
+smpl_t aubio_zero_crossing_rate (fvec_t * v);
+
+/** compute sound pressure level (SPL) in dB
+
+  This quantity is often wrongly called 'loudness'.
+
+  \param v vector to compute dB SPL from
+
+  \return level of v in dB SPL
+
+*/
+smpl_t aubio_db_spl (fvec_t * v);
+
+/** check if buffer level in dB SPL is under a given threshold
+  \param v vector to get level from
+  \param threshold threshold in dB SPL
+
+  \return 0 if level is under the given threshold, 1 otherwise
+
+*/
+uint_t aubio_silence_detection (fvec_t * v, smpl_t threshold);
+
+/** get buffer level if level >= threshold, 1. otherwise
+
+  \param v vector to get level from
+  \param threshold threshold in dB SPL
+
+  \return level in dB SPL if level >= threshold, 1. otherwise
+
+*/
+smpl_t aubio_level_detection (fvec_t * v, smpl_t threshold);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
index 8b45b61..cd03bbb 100644 (file)
@@ -20,8 +20,9 @@
 #include "fvec.h"
 #include "cvec.h"
 #include "lvec.h"
 #include "fvec.h"
 #include "cvec.h"
 #include "lvec.h"
-#include "spectral/phasevoc.h"
 #include "mathutils.h"
 #include "mathutils.h"
+#include "musicutils.h"
+#include "spectral/phasevoc.h"
 #include "temporal/filter.h"
 #include "temporal/c_weighting.h"
 #include "pitch/pitchmcomb.h"
 #include "temporal/filter.h"
 #include "temporal/c_weighting.h"
 #include "pitch/pitchmcomb.h"
index 68fa89a..56ebb88 100644 (file)
@@ -21,6 +21,7 @@
 #include "fvec.h"
 #include "cvec.h"
 #include "mathutils.h"
 #include "fvec.h"
 #include "cvec.h"
 #include "mathutils.h"
+#include "musicutils.h"
 #include "spectral/fft.h"
 #include "pitch/pitchfcomb.h"
 
 #include "spectral/fft.h"
 #include "pitch/pitchfcomb.h"
 
index fb181c9..66c9716 100644 (file)
@@ -1,8 +1,8 @@
 #include "config.h"
 #include "config.h"
+#include "aubio_priv.h"
 #include "types.h"
 #include "fvec.h"
 #include "cvec.h"
 #include "types.h"
 #include "fvec.h"
 #include "cvec.h"
-#include "aubio_priv.h"
 #include "vecutils.h"
 
 #define AUBIO_OP(OPNAME, OP, TYPE, OBJ) \
 #include "vecutils.h"
 
 #define AUBIO_OP(OPNAME, OP, TYPE, OBJ) \