annotate xtract/xtract_vector.h @ 6:3977eb18153b

Fixed AMDF
author Jamie Bullock <jamie@postlude.co.uk>
date Thu, 05 Oct 2006 17:02:33 +0000
parents 819937ea6359
children 8b8d4f1c5fb6
rev   line source
jamie@1 1 /* libxtract feature extraction library
jamie@1 2 *
jamie@1 3 * Copyright (C) 2006 Jamie Bullock
jamie@1 4 *
jamie@1 5 * This program is free software; you can redistribute it and/or modify
jamie@1 6 * it under the terms of the GNU General Public License as published by
jamie@1 7 * the Free Software Foundation; either version 2 of the License, or
jamie@1 8 * (at your option) any later version.
jamie@1 9 *
jamie@1 10 * This program is distributed in the hope that it will be useful,
jamie@1 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jamie@1 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
jamie@1 13 * GNU General Public License for more details.
jamie@1 14 *
jamie@1 15 * You should have received a copy of the GNU General Public License
jamie@1 16 * along with this program; if not, write to the Free Software
jamie@1 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
jamie@1 18 * USA.
jamie@1 19 */
jamie@1 20
jamie@1 21 /* xtract_scalar.h: declares functions that extract a feature as a vector from an input vector */
jamie@1 22
jamie@1 23 #ifndef XTRACT_VECTOR
jamie@1 24 #define XTRACT_VECTOR
jamie@1 25
jamie@1 26 #ifdef __cplusplus
jamie@1 27 extern "C" {
jamie@1 28 #endif
jamie@1 29
jamie@2 30 /** \brief Extract normalized (0-1) frequency domain magnitude spectrum from time domain signal
jamie@2 31 *
jamie@2 32 * \param *data: a pointer to the first element in an array of floats representing an audio vector
jamie@2 33 * \param N: the number of array elements to be considered
jamie@2 34 * \param *argv: a pointer to NULL
jamie@2 35 * \param *result: the magnitude spectrum of N values from the array pointed to by *data
jamie@2 36 */
jamie@1 37 int xtract_magnitude_spectrum(float *data, int N, void *argv, float *result);
jamie@1 38
jamie@1 39
jamie@2 40 /** \brief Extract autocorrelation from time domain signal using time-domain autocorrelation technique
jamie@2 41 *
jamie@2 42 * \param *data: a pointer to the first element in an array of floats representing an audio vector
jamie@2 43 * \param N: the number of array elements to be considered
jamie@2 44 * \param *argv: a pointer to NULL
jamie@2 45 * \param *result: the autocorrelation of N values from the array pointed to by *data
jamie@2 46 */
jamie@1 47 int xtract_autocorrelation(float *data, int N, void *argv, float *result);
jamie@1 48
jamie@2 49 /** \brief Extract autocorrelation from time domain signal using FFT based method
jamie@2 50 *
jamie@2 51 * \param *data: a pointer to the first element in an array of floats representing an audio vector
jamie@2 52 * \param N: the number of array elements to be considered
jamie@2 53 * \param *argv: a pointer to NULL
jamie@2 54 * \param *result: the autocorrelation of N values from the array pointed to by *data
jamie@2 55 */
jamie@1 56 int xtract_autocorrelation_fft(float *data, int N, void *argv, float *result);
jamie@1 57
jamie@2 58 /** \brief Extract Average Magnitude Difference Function from time domain signal
jamie@2 59 *
jamie@2 60 * \param *data: a pointer to the first element in an array of floats
jamie@2 61 * \param N: the number of array elements to be considered
jamie@2 62 * \param *argv: a pointer to NULL
jamie@2 63 * \param *result: the AMDF of N values from the array pointed to by *data
jamie@2 64 */
jamie@1 65 int xtract_amdf(float *data, int N, void *argv, float *result);
jamie@1 66
jamie@2 67 /** \brief Extract Average Squared Difference Function from time domain signal
jamie@2 68 *
jamie@2 69 * \param *data: a pointer to the first element in an array of floats representing an audio vector
jamie@2 70 * \param N: the number of array elements to be considered
jamie@2 71 * \param *argv: a pointer to NULL
jamie@2 72 * \param *result: the ASDF of N values from the array pointed to by *data
jamie@2 73 */
jamie@1 74 int xtract_asdf(float *data, int N, void *argv, float *result);
jamie@1 75
jamie@2 76 /** \brief Extract Mel Frequency Cepstral Coefficients based on a method described by Rabiner
jamie@2 77 *
jamie@2 78 * \param *data: a pointer to the first element in an array of floats
jamie@2 79 * \param N: the number of array elements to be considered
jamie@2 80 * \param *argv: a pointer to a data structure of type xtract_mel_filter, containing n_filters coefficient tables to make up a mel-spaced filterbank
jamie@2 81 * \param *result: a pointer to an array containing the resultant MFCC
jamie@2 82 *
jamie@2 83 * The data structure pointed to by *argv must be obtained by first calling xtract_init_mfcc
jamie@2 84 */
jamie@1 85 int xtract_mfcc(float *data, int N, void *argv, float *result);
jamie@1 86
jamie@2 87 /** \brief Extract Bark band coefficients based on a method
jamie@2 88 * \param *data: a pointer to the first element in an array of floats representing the magnitude spectrum of an audio vector
jamie@2 89 * \param N: the number of array elements to be considered
jamie@2 90 * \param *argv: a pointer to an array of ints representing the limits of each bark band
jamie@2 91 * \param *result: a pointer to an array containing resultant bark coefficients
jamie@2 92 *
jamie@2 93 * The limits array pointed to by *argv must be obtained by first calling xtract_init_bark
jamie@2 94 *
jamie@2 95 */
jamie@1 96 int xtract_bark_coefficients(float *data, int N, void *argv, float *result);
jamie@1 97
jamie@2 98 /** \brief Extract the Discrete Cosine transform of a time domain signal
jamie@2 99 * \param *data: a pointer to the first element in an array of floats representing an audio vector
jamie@2 100 * \param N: the number of array elements to be considered
jamie@2 101 * \param *argv: a pointer to NULL
jamie@2 102 * \param *result: a pointer to an array containing resultant dct coefficients
jamie@2 103 */
jamie@1 104 int xtract_dct(float *data, int N, void *argv, float *result);
jamie@1 105
jamie@2 106 /** \brief Extract the frequency and amplitude of spectral peaks from a of a magnitude spectrum
jamie@2 107 * \param *data: a pointer to the first element in an array of floats representing the magnitude spectrum of an audio vector
jamie@2 108 * \param N: the number of array elements to be considered
jamie@2 109 * \param *argv: a pointer to an array containing peak threshold as percentage below max peak, and sample rate
jamie@2 110 * \param *result: a pointer to an array of size N, containing N/2 freqs and N/2 amplitudes, amplitudes are on a decibel scale with dbFS = 0
jamie@2 111 */
jamie@1 112 int xtract_peaks(float *data, int N, void *argv, float *result);
jamie@1 113
jamie@1 114 #ifdef __cplusplus
jamie@1 115 }
jamie@1 116 #endif
jamie@1 117
jamie@1 118 #endif