spectral/phasevoc.h \
spectral/fft.h \
spectral/tss.h \
+ spectral/spectral_centroid.h \
pitch/pitchdetection.h \
pitch/pitchmcomb.h \
pitch/pitchyin.h \
spectral/fft.h \
spectral/tss.c \
spectral/tss.h \
+ spectral/spectral_centroid.c \
+ spectral/spectral_centroid.h \
pitch/pitchdetection.c \
pitch/pitchdetection.h \
pitch/pitchmcomb.c \
/* in this order */
#include "types.h"
#include "sample.h"
-#include "spectral/fft.h"
-#include "spectral/phasevoc.h"
#include "mathutils.h"
#include "utils/scale.h"
#include "utils/hist.h"
#include "temporal/resample.h"
#include "temporal/biquad.h"
#include "temporal/filter.h"
+#include "spectral/filterbank.h"
+#include "spectral/mfcc.h"
+#include "spectral/fft.h"
+#include "spectral/phasevoc.h"
+#include "spectral/spectral_centroid.h"
#include "pitch/pitchdetection.h"
#include "pitch/pitchmcomb.h"
#include "pitch/pitchyin.h"
#include "onset/peakpick.h"
#include "tempo/beattracking.h"
#include "tempo/tempo.h"
-#include "spectral/filterbank.h"
-#include "spectral/mfcc.h"
#ifdef __cplusplus
} /* extern "C" */
return zcr/(smpl_t)input->length;
}
-smpl_t aubio_spectral_centroid(cvec_t * spectrum, smpl_t samplerate) {
- uint_t i=0, j;
- smpl_t sum = 0., sc = 0.;
- for ( j = 0; j < spectrum->length; j++ ) {
- sum += spectrum->norm[i][j];
- }
- if (sum == 0.) return 0.;
- for ( j = 0; j < spectrum->length; j++ ) {
- sc += (smpl_t)j * spectrum->norm[i][j];
- }
- return sc / sum * samplerate / (smpl_t)(spectrum->length);
-}
-
void aubio_autocorr(fvec_t * input, fvec_t * output) {
uint_t i = 0, j = 0, length = input->length;
smpl_t * data = input->data[0];
* zero-crossing rate (number of zero cross per sample)
*/
smpl_t aubio_zero_crossing_rate(fvec_t * input);
-/**
- * spectrum centroid computed on a cvec
- */
-smpl_t aubio_spectral_centroid(cvec_t * input, smpl_t samplerate);
/**
* clean up cached memory at the end of program
*
--- /dev/null
+/*
+ Copyright (C) 2007 Paul Brossier
+
+ This program 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 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "aubio_priv.h"
+#include "cvec.h"
+#include "spectral/spectral_centroid.h"
+
+smpl_t aubio_spectral_centroid(cvec_t * spectrum, smpl_t samplerate) {
+ uint_t i=0, j;
+ smpl_t sum = 0., sc = 0.;
+ for ( j = 0; j < spectrum->length; j++ ) {
+ sum += spectrum->norm[i][j];
+ }
+ if (sum == 0.) return 0.;
+ for ( j = 0; j < spectrum->length; j++ ) {
+ sc += (smpl_t)j * spectrum->norm[i][j];
+ }
+ return sc / sum * samplerate / (smpl_t)(spectrum->length);
+}
+
+
--- /dev/null
+/*
+ Copyright (C) 2007 Paul Brossier
+
+ This program 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 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file
+ * compute spectrum centroid of a cvec object
+ */
+
+/**
+ * spectrum centroid computed on a cvec
+ */
+smpl_t aubio_spectral_centroid(cvec_t * input, smpl_t samplerate);