diff options
Diffstat (limited to 'xtract')
-rw-r--r-- | xtract/libxtract.h | 9 | ||||
-rw-r--r-- | xtract/xtract_vector.h | 29 |
2 files changed, 36 insertions, 2 deletions
diff --git a/xtract/libxtract.h b/xtract/libxtract.h index e967372..40512b0 100644 --- a/xtract/libxtract.h +++ b/xtract/libxtract.h @@ -56,7 +56,7 @@ extern "C" { * @{ */ -#define XTRACT_FEATURES 54 +#define XTRACT_FEATURES 56 /** \brief Enumeration of features, elements are used as indixes to an array of pointers to feature extracton functions */ enum xtract_features_ { @@ -113,7 +113,9 @@ enum xtract_features_ { XTRACT_AUTOCORRELATION_FFT, XTRACT_MFCC, XTRACT_DCT, - XTRACT_HARMONIC_SPECTRUM + XTRACT_HARMONIC_SPECTRUM, + XTRACT_LPC, + XTRACT_LPCC }; /** \brief Enumeration of feature initialisation functions */ @@ -198,9 +200,12 @@ typedef enum xtract_vector_ { XTRACT_SPECTRAL_HARMONICS_MAGNITUDES, /* N spectral harmonic frequencies */ XTRACT_SPECTRAL_HARMONICS_FREQUENCIES, + XTRACT_AUTOCORRELATION_COEFFS, XTRACT_ARBITRARY_SERIES, XTRACT_AUDIO_SAMPLES, XTRACT_MEL_COEFFS, + XTRACT_LPC_COEFFS, + XTRACT_LPCC_COEFFS, XTRACT_BARK_COEFFS, XTRACT_NO_DATA } xtract_vector_t; diff --git a/xtract/xtract_vector.h b/xtract/xtract_vector.h index e67ae6d..7effac0 100644 --- a/xtract/xtract_vector.h +++ b/xtract/xtract_vector.h @@ -126,6 +126,35 @@ int xtract_peak_spectrum(const float *data, const int N, const void *argv, float */ int xtract_harmonic_spectrum(const float *data, const int N, const void *argv, float *result); +/** \brief Extract Linear Predictive Coding Coefficients + * + * Based on algorithm in Rabiner and Juang as implemented by Jutta Degener in Dr. Dobb's Journal December, 1994. + * + * Returns N-1 reflection (PARCOR) coefficients and N-1 LPC coefficients via *result + * + * \param *data: N autocorrelation values e.g the data pointed to by *result from xtract_autocorrelation() + * \param N: the number of autocorrelation values to be considered + * \param *argv: a pointer to NULL + * \param *result: a pointer to an array containing N-1 reflection coefficients and N-1 LPC coefficients. + * + * An array of size 2 * (N - 1) must be allocated, and *result must point to its first element. + */ +int xtract_lpc(const float *data, const int N, const void *argv, float *result); + +/** \brief Extract Linear Predictive Coding Cepstral Coefficients + * + * \param *data: a pointer to the first element in an array of LPC coeffiecients e.g. a pointer to the second half of the array pointed to by *result from xtract_lpc() + * \param N: the number of LPC coefficients to be considered + * \param *argv: a pointer to a float representing the order of the result vector. This must be a whole number. According to Rabiner and Juang the ratio between the number (p) of LPC coefficients and the order (Q) of the LPC cepstrum is given by Q ~ (3/2)p where Q > p. + * \param *result: a pointer to an array containing the resultant LPCC. + * + * An array of size Q, where Q is given by argv[0] must be allocated, and *result must point to its first element. + * + */ +int xtract_lpcc(const float *data, const int N, const void *argv, float *result); + + + /** @} */ #ifdef __cplusplus |