# HG changeset patch # User Chris Cannam # Date 1425033853 0 # Node ID 2fed1f101172f3e8d43c0e75cb511c3c881985ea # Parent f6be68852c1df69581d8490d63856ca41d60e5ff Another process wrapper diff -r f6be68852c1d -r 2fed1f101172 src/FeatureExtractor.cpp --- a/src/FeatureExtractor.cpp Fri Feb 27 10:05:04 2015 +0000 +++ b/src/FeatureExtractor.cpp Fri Feb 27 10:44:13 2015 +0000 @@ -179,6 +179,18 @@ } feature_t +FeatureExtractor::process(const float *real, const float *imag) +{ + vector mags(m_params.fftSize/2 + 1, 0.0); + + for (int i = 0; i <= m_params.fftSize/2; i++) { + mags[i] = real[i] * real[i] + imag[i] * imag[i]; + } + + return processMags(mags); +} + +feature_t FeatureExtractor::process(const float *cframe) { vector mags(m_params.fftSize/2 + 1, 0.0); diff -r f6be68852c1d -r 2fed1f101172 src/FeatureExtractor.h --- a/src/FeatureExtractor.h Fri Feb 27 10:05:04 2015 +0000 +++ b/src/FeatureExtractor.h Fri Feb 27 10:44:13 2015 +0000 @@ -97,8 +97,8 @@ static int getFeatureSizeFor(Parameters params); /** - * Process one frequency-domain audio frame (provided as real & - * imaginary components from the FFT output). Return a feature + * Process one frequency-domain audio frame, provided as real & + * imaginary components from the FFT output. Return a feature * vector of size given by getFeatureSize(). Input vectors must * have at least params.fftSize/2+1 elements each. * @@ -110,8 +110,8 @@ const std::vector &imag); /** - * Process one frequency-domain audio frame (provided as real & - * imaginary components from the FFT output). Return a feature + * Process one frequency-domain audio frame, provided as real & + * imaginary components from the FFT output. Return a feature * vector of size given by getFeatureSize(). Input vectors must * have at least params.fftSize/2+1 elements each. * @@ -123,6 +123,18 @@ const std::vector &imag); /** + * Process one frequency-domain audio frame, provided as real & + * imaginary components from the FFT output. Return a feature + * vector of size given by getFeatureSize(). Input arrays must + * have at least params.fftSize/2+1 elements each. + * + * Operates by mapping the frequency bins into a part-linear + * part-logarithmic array, unless useChromaFrequencyMap is true in + * which case they are mapped into chroma bins. + */ + feature_t process(const float *real, const float *imag); + + /** * Process one frequency-domain audio frame, provided as a single * array of alternating real and imaginary components. Input array * must have at least 2 * (params.fftSize/2 + 1) elements.