annotate xtract/xtract_scalar.h @ 116:859495925633

- Fixed build fail if --enable-fft not specified - Fixed doxygen build so that it includes libxtract.h - Doxygen tweaks
author Jamie Bullock <jamie@postlude.co.uk>
date Wed, 26 Mar 2008 13:04:33 +0000
parents 72a9a393d5bd
children 2b2d0609e44f
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@2 21 /** \file xtract_scalar.h: declares functions that extract a feature as a single value from an input vector */
jamie@1 22
jamie@56 23 #ifndef XTRACT_SCALAR_H
jamie@56 24 #define XTRACT_SCALAR_H
jamie@1 25
jamie@1 26 #ifdef __cplusplus
jamie@1 27 extern "C" {
jamie@1 28 #endif
jamie@1 29
jamie@20 30 /**
jamie@83 31 * \defgroup scalar scalar extraction functions
jamie@116 32 *
jamie@116 33 * Functions that extract a feature as a single value from an input vector
jamie@20 34 *
jamie@20 35 * @{
jamie@20 36 */
jamie@1 37
jamie@92 38 void test(void);
jamie@92 39
jamie@2 40 /** \brief Extract the mean of an input vector
jamie@2 41 *
jamie@52 42 * \param *data: a pointer to the first element
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 mean of N values from the array pointed to by *data
jamie@2 46 */
jamie@43 47 int xtract_mean(const float *data, const int N, const void *argv, float *result);
jamie@1 48
jamie@2 49 /** \brief Extract the variance of an input vector
jamie@2 50 *
jamie@2 51 * \param *data: a pointer to the first element in an array of floats
jamie@2 52 * \param N: the number of elements to be considered
jamie@41 53 * \param *argv: a pointer to a float representing the mean of the input vector
jamie@2 54 * \param *result: the variance of N values from the array pointed to by *data
jamie@2 55 */
jamie@43 56 int xtract_variance(const float *data, const int N, const void *argv, float *result);
jamie@2 57
jamie@2 58 /** \brief Extract the deviation of an input vector
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 elements to be considered
jamie@41 62 * \param *argv: a pointer to a float representing the variance of the input vector
jamie@2 63 * \param *result: the deviation of N values from the array pointed to by *data
jamie@2 64 */
jamie@43 65 int xtract_standard_deviation(const float *data, const int N, const void *argv, float *result);
jamie@2 66
jamie@2 67 /** \brief Extract the average deviation of an input vector
jamie@2 68 *
jamie@2 69 * \param *data: a pointer to the first element in an array of floats
jamie@2 70 * \param N: the number of elements to be considered
jamie@41 71 * \param *argv: a pointer to a float representing the mean of the input vector
jamie@2 72 * \param *result: the average deviation of N values from the array pointed to by *data
jamie@2 73 */
jamie@43 74 int xtract_average_deviation(const float *data, const int N, const void *argv, float *result);
jamie@2 75
jamie@2 76 /** \brief Extract the skewness of an input vector
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 elements to be considered
jamie@41 80 * \param *argv: a pointer to an array of floats representing the mean and standard deviation of the input vector
jamie@2 81 * \param *result: the skewness of N values from the array pointed to by *data
jamie@2 82 */
jamie@43 83 int xtract_skewness(const float *data, const int N, const void *argv, float *result);
jamie@2 84
jamie@2 85 /** \brief Extract the kurtosis of an input vector
jamie@2 86 *
jamie@2 87 * \param *data: a pointer to the first element in an array of floats
jamie@2 88 * \param N: the number of elements to be considered
jamie@2 89 * \param *argv: a pointer to an array of values representing the mean and standard deviation of the input vector
jamie@2 90 * \param *result: the kurtosis of N values from the array pointed to by *data
jamie@2 91 */
jamie@43 92 int xtract_kurtosis(const float *data, const int N, const void *argv, float *result);
jamie@1 93
jamie@52 94 /** \brief Extract the mean of an input spectrum
jamie@52 95 *
jamie@78 96 * \param *data: a pointer to the first element in an array of floats representing the spectrum of an audio vector, (e.g. the array pointed to by *result from xtract_spectrum(), xtract_peak_spectrum() or xtract_harmonic_spectrum()).
jamie@52 97 * \param N: the size of the array pointed to by *data
jamie@52 98 * \param *argv: a pointer to NULL
jamie@52 99 * \param *result: the mean of the spectrum pointed to by *data
jamie@52 100 */
jamie@52 101 int xtract_spectral_mean(const float *data, const int N, const void *argv, float *result);
jamie@52 102
jamie@52 103 /** \brief Extract the variance of an input spectrum
jamie@52 104 *
jamie@78 105 * \param *data: a pointer to the first element in an array of floats representing the spectrum of an audio vector, (e.g. the array pointed to by *result from xtract_spectrum(), xtract_peak_spectrum() or xtract_harmonic_spectrum()).
jamie@52 106 * \param N: the number of elements to be considered
jamie@52 107 * \param N: the size of the array pointed to by *data
jamie@59 108 * \param *argv: a pointer to a float representing the spectral mean of the input spectrum
jamie@52 109 * \param *result: the variance of the spectrum pointed to by *data
jamie@52 110 */
jamie@52 111 int xtract_spectral_variance(const float *data, const int N, const void *argv, float *result);
jamie@52 112
jamie@52 113 /** \brief Extract the deviation of an input spectrum
jamie@52 114 *
jamie@78 115 * \param *data: a pointer to the first element in an array of floats representing the spectrum of an audio vector, (e.g. the array pointed to by *result from xtract_spectrum(), xtract_peak_spectrum() or xtract_harmonic_spectrum()).
jamie@52 116 * \param N: the size of the array pointed to by *data
jamie@59 117 * \param *argv: a pointer to a float representing the spectral variance of the input spectrum
jamie@52 118 * \param *result: the deviation of the spectrum pointed to by *data
jamie@52 119 */
jamie@52 120 int xtract_spectral_standard_deviation(const float *data, const int N, const void *argv, float *result);
jamie@52 121
jamie@52 122 /** \brief Extract the average deviation of an input spectrum
jamie@52 123 *
jamie@78 124 * \param *data: a pointer to the first element in an array of floats representing the spectrum of an audio vector, (e.g. the array pointed to by *result from xtract_spectrum(), xtract_peak_spectrum() or xtract_harmonic_spectrum()).
jamie@52 125 * \param N: the size of the array pointed to by *data
jamie@59 126 * \param *argv: a pointer to a float representing the spectral mean of the input spectrum
jamie@52 127 * \param *result: the average deviation of the spectrum pointed to by *data
jamie@52 128 */
jamie@52 129 int xtract_spectral_average_deviation(const float *data, const int N, const void *argv, float *result);
jamie@52 130
jamie@52 131 /** \brief Extract the skewness of an input spectrum
jamie@52 132 *
jamie@78 133 * \param *data: a pointer to the first element in an array of floats representing the spectrum of an audio vector, (e.g. the array pointed to by *result from xtract_spectrum(), xtract_peak_spectrum() or xtract_harmonic_spectrum()).
jamie@52 134 * \param N: the size of the array pointed to by *data
jamie@59 135 * \param *argv: a pointer to an array of floats representing the spectral mean and spectral standard deviation of the input spectrum
jamie@52 136 * \param *result: the skewness of the spectrum pointed to by *data
jamie@52 137 */
jamie@52 138 int xtract_spectral_skewness(const float *data, const int N, const void *argv, float *result);
jamie@52 139
jamie@52 140 /** \brief Extract the kurtosis of an input spectrum
jamie@52 141 *
jamie@78 142 * \param *data: a pointer to the first element in an array of floats representing the spectrum of an audio vector, (e.g. the array pointed to by *result from xtract_spectrum(), xtract_peak_spectrum() or xtract_harmonic_spectrum()).
jamie@52 143 * \param N: the size of the array pointed to by *data
jamie@59 144 * \param *argv: a pointer to an array of values representing the spectral mean and spectral standard deviation of the input spectrum
jamie@52 145 * \param *result: the kurtosis of the spectrum pointed to by *data
jamie@52 146 */
jamie@52 147 int xtract_spectral_kurtosis(const float *data, const int N, const void *argv, float *result);
jamie@52 148
jamie@41 149 /** \brief Extract the centroid of an input vector
jamie@11 150 *
jamie@78 151 * \param *data: a pointer to the first element in an array of floats representing the spectrum of an audio vector, (e.g. the array pointed to by *result from xtract_spectrum(), xtract_peak_spectrum() or xtract_harmonic_spectrum()).
jamie@11 152 * \param N: the number of elements to be considered
jamie@11 153 * \param *argv: a pointer to NULL
jamie@11 154 * \param *result: the centroid of the values pointed to by *data
jamie@47 155 *
jamie@78 156 * Note: for a more 'accurate' result *result from xtract_peak_spectrum() can be passed in. This gives the interpolated peak frequency locations.
jamie@47 157 *
jamie@11 158 */
jamie@52 159 int xtract_spectral_centroid(const float *data, const int N, const void *argv, float *result);
jamie@11 160
jamie@2 161 /** \brief Calculate the Irregularity of an input vector using a method described by Krimphoff (1994)
jamie@2 162 *
jamie@54 163 * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
jamie@2 164 * \param N: the number of elements to be considered
jamie@2 165 * \param *argv: a pointer to NULL
jamie@2 166 * \param *result: the irregularity of N values from the array pointed to by *data
jamie@2 167 */
jamie@43 168 int xtract_irregularity_k(const float *data, const int N, const void *argv, float *result);
jamie@1 169
jamie@2 170 /** \brief Calculate the Irregularity of an input vector using a method described by Jensen (1999)
jamie@2 171 *
jamie@54 172 * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
jamie@2 173 * \param N: the number of elements to be considered
jamie@2 174 * \param *argv: a pointer to NULL
jamie@2 175 * \param *result: the irregularity of N values from the array pointed to by *data
jamie@2 176 */
jamie@43 177 int xtract_irregularity_j(const float *data, const int N, const void *argv, float *result);
jamie@1 178
jamie@2 179 /** \brief Calculate the Tristimulus of an input vector using a method described by Pollard and Jansson (1982)
jamie@2 180 *
jamie@78 181 * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients of the harmonic spectrum of an audio vector e.g. a pointer to the first half of the array pointed to by *result from xtract_harmonics(). The amplitudes of the peak spectrum (e.g. *result from xtract_peak_spectrum()) can be used if one wishes to consider all partials not just harmonics.
jamie@2 182 * \param N: the number of elements to be considered
jamie@2 183 * \param *argv: a pointer to NULL
jamie@2 184 * \param *result: the tristimulus of N values from the array pointed to by *data
jamie@2 185 *
jamie@2 186 * These three functions provide the first, second and third order tristimulus formulae
jamie@2 187 *
jamie@2 188 */
jamie@43 189 int xtract_tristimulus_1(const float *data, const int N, const void *argv, float *result);
jamie@43 190 int xtract_tristimulus_2(const float *data, const int N, const void *argv, float *result);
jamie@43 191 int xtract_tristimulus_3(const float *data, const int N, const void *argv, float *result);
jamie@1 192
jamie@2 193 /** \brief Extract the smoothness of an input vector using a method described by McAdams (1999)
jamie@2 194 *
jamie@54 195 * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
jamie@2 196 * \param N: the number of elements to be considered
jamie@43 197 * \param *argv: a pointer to the first element of an array of integers containing the lower bound, upper bound, and pre-scaling factor, whereby array data in the range lower < n < upper will be pre-scaled by p before processing.
jamie@2 198 * \param *result: the smoothness of N values from the array pointed to by *data
jamie@2 199 */
jamie@43 200 int xtract_smoothness(const float *data, const int N, const void *argv, float *result);
jamie@1 201
jamie@2 202 /** \brief Extract the spectral spread of an input vector using a method described by Casagrande(2005)
jamie@2 203 *
jamie@54 204 * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
jamie@2 205 * \param N: the number of elements to be considered
jamie@83 206 * \param *argv: a pointer to a float corresponding to the spectral centroid
jamie@2 207 * \param *result: the spectral spread of N values from the array pointed to by *data
jamie@2 208 */
jamie@43 209 int xtract_spread(const float *data, const int N, const void *argv, float *result);
jamie@1 210
jamie@1 211 /* Zero crossing rate */
jamie@1 212
jamie@2 213 /** \brief Extract the zero crossing rate of an input vector
jamie@2 214 *
jamie@2 215 * \param *data: a pointer to the first element in an array of floats
jamie@2 216 * \param N: the number of elements to be considered
jamie@2 217 * \param *argv: a pointer to NULL
jamie@2 218 * \param *result: the zero crossing rate of N values from the array pointed to by *data
jamie@2 219 */
jamie@43 220 int xtract_zcr(const float *data, const int N, const void *argv, float *result);
jamie@1 221
jamie@2 222 /** \brief Extract the spectral rolloff of an input vector using a method described by Bee Suan Ong (2005)
jamie@2 223 *
jamie@54 224 * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
jamie@2 225 * \param N: the number of elements to be considered
jamie@55 226 * \param *argv: a pointer to an array containing a float representing (samplerate / N ) and a float representing the threshold for rolloff, i.e. the percentile at which the rolloff is determined, expressed as a percentage, and
jamie@42 227 * \param *result: the spectral rolloff in Hz of N values from the array pointed to by *data. This is the point in the spectrum below which argv[0] of the energy is distributed.
jamie@2 228 */
jamie@43 229 int xtract_rolloff(const float *data, const int N, const void *argv, float *result);
jamie@1 230
jamie@47 231 /** \brief Extract the 'total loudness' of an input vector using a method described by Moore, Glasberg et al (2005)
jamie@2 232 *
jamie@2 233 * \param *data: a pointer to the first element in an array of floats representing a set of BARK_BANDS bark coefficients
jamie@2 234 * \param N: the number of coefficients to be considered
jamie@2 235 * \param *argv: a pointer to NULL
jamie@47 236 * \param *result: the total loudness of N values from the array pointed to by *data
jamie@47 237 *
jamie@47 238 * Note: if N = 1, the 'specific loudness' of the bark band pointed to by *data will be given by *result
jamie@47 239 *
jamie@2 240 */
jamie@43 241 int xtract_loudness(const float *data, const int N, const void *argv, float *result);
jamie@1 242
jamie@113 243 /** \brief Extract the spectral flatness measure of an input vector, where the flatness measure (SFM) is defined as the ratio of the geometric mean to the arithmetic mean of a magnitude spectrum.
jamie@113 244 *
jamie@113 245 * \note The computation method used here is the most efficient by a significant margin, but suffers from precision problems due to the multiplication operationin the geometric mean calculation. This is particularly accute for larger values of N (>=256). However, as noted by Peeters (2003), the SFM should generally be computed on a small number of 'bands' rather than on the complete magnitude spectrum. It is therefore highly recommended that xtract_bands() is used prior to calling xtract_flatness().
jamie@2 246 *
jamie@113 247 * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum(). Alternatively the magnitudes from a number of 'subbands' can be used by using *result from xtract_bands().
jamie@113 248 * \param N: the number of *data array elements to be considered
jamie@2 249 * \param *argv: a pointer to NULL
jamie@113 250 * \param *result: the flatness of N values from the array pointed to by *data
jamie@2 251 */
jamie@43 252 int xtract_flatness(const float *data, const int N, const void *argv, float *result);
jamie@1 253
jamie@113 254 /** \brief Extract the LOG spectral flatness measure of an input vector
jamie@113 255 *
jamie@113 256 * \param *data: a pointer to NULL.
jamie@113 257 * \param N: not used - can safely be set to 0.
jamie@113 258 * \param *argv: a pointer to a float represnting spectral flatness.
jamie@113 259 * \param *result: the LOG spectral flatness of N values from the array pointed to by *data
jamie@113 260 *
jamie@113 261 * flatness_db = 10 * log10(flatness)
jamie@113 262 *
jamie@113 263 */
jamie@113 264 int xtract_flatness_db(const float *data, const int N, const void *argv, float *result);
jamie@1 265
jamie@113 266 /** \brief Extract the tonality factor of an input vector using a method described by Peeters 2003
jamie@2 267 *
jamie@113 268 * \param *data: a pointer to NULL.
jamie@113 269 * \param N: not used - can safely be set to 0.
jamie@113 270 * \param *argv: a pointer to the LOG spectral flatness measure of an audio vector (e.g. the output from xtract_flatness_db)
jamie@2 271 * \param *result: the tonality factor of N values from the array pointed to by *data
jamie@2 272 */
jamie@43 273 int xtract_tonality(const float *data, const int N, const void *argv, float *result);
jamie@1 274
jamie@2 275 /** \brief Extract the noisiness of an input vector using a method described by Tae Hong Park (2000)
jamie@2 276 *
jamie@55 277 * \param *data: a pointer to NULL
jamie@55 278 * \param N:
jamie@55 279 * \param *argv: a pointer to an array containing a float represnting the number of harmonic partials in a spectrum, and a float representing the number of partials in a spectrum
jamie@55 280 * \param *result: the noisiness coefficient as calculated from argv
jamie@2 281 */
jamie@43 282 int xtract_noisiness(const float *data, const int N, const void *argv, float *result);
jamie@1 283
jamie@2 284 /** \brief Extract the RMS amplitude of an input vector using a method described by Tae Hong Park (2000)
jamie@2 285 *
jamie@2 286 * \param *data: a pointer to the first element in an array of floats
jamie@2 287 * \param N: the number of elements to be considered
jamie@2 288 * \param *argv: a pointer to NULL
jamie@2 289 * \param *result: the RMS amplitude of N values from the array pointed to by *data
jamie@2 290 */
jamie@43 291 int xtract_rms_amplitude(const float *data, const int N, const void *argv, float *result);
jamie@1 292
jamie@2 293 /** \brief Extract the Inharmonicity of an input vector
jamie@2 294 *
jamie@78 295 * \param *data: a pointer to the first element in an array of floats represeting a magnitude peak spectrum of size N/2, and a frequency spectrum of size N/2 (This is the output format of xtract_peak_spectrum())
jamie@2 296 * \param N: the number of elements to be considered
jamie@41 297 * \param *argv: a pointer to a float representing the fundamental frequency of the input vector.
jamie@2 298 * \param *result: the inharmonicity of N values from the array pointed to by *data
jamie@2 299 */
jamie@52 300 int xtract_spectral_inharmonicity(const float *data, const int N, const void *argv, float *result);
jamie@1 301
jamie@2 302 /** \brief Extract the spectral crest of an input vector using a method described by Peeters (2003)
jamie@2 303 *
jamie@55 304 * \param *data: a pointer to NULL
jamie@55 305 * \param N: not used
jamie@55 306 * \param *argv: a pointer to an array containing a float representing the maximum value in a spectrum, and a float representing the mean value of a spectrum
jamie@2 307 * \param *result: the spectral crest of N values from the array pointed to by *data
jamie@2 308 */
jamie@43 309 int xtract_crest(const float *data, const int N, const void *argv, float *result);
jamie@1 310
jamie@2 311 /** \brief Extract the Spectral Power of an input vector using a method described by Bee Suan Ong (2005)
jamie@2 312 *
jamie@54 313 * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
jamie@2 314 * \param N: the number of elements to be considered
jamie@2 315 * \param *argv: a pointer to NULL
jamie@2 316 * \param *result: the spectral power of N values from the array pointed to by *data
jamie@2 317 */
jamie@43 318 int xtract_power(const float *data, const int N, const void *argv, float *result);
jamie@1 319
jamie@1 320 /* Odd to even harmonic ratio */
jamie@2 321 /** \brief Extract the Odd to even harmonic ratio of an input vector
jamie@2 322 *
jamie@59 323 * \param *data: a pointer to the first element in an array of floats representing the amplitudes of the harmonic spectrum of an audio vector. It is sufficient to pass in a pointer to the first half of the array pointed to by *result from xtract_harmonic_spectrum().
jamie@59 324 * \param N: the number of elements to be considered. If using the array pointed to by *result from xtract_harmonics, N should equal half the total array size i.e., just the amplitudes of the peaks.
jamie@59 325 * \param *argv: a pointer to NULL
jamie@113 326 * \param *result: the even/odd harmonic ratio of N values from the array pointed to by *data
jamie@2 327 */
jamie@43 328 int xtract_odd_even_ratio(const float *data, const int N, const void *argv, float *result);
jamie@1 329
jamie@2 330 /** \brief Extract the Sharpness of an input vector
jamie@2 331 *
jamie@54 332 * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
jamie@2 333 * \param N: the number of elements to be considered
jamie@2 334 * \param *argv: a pointer to NULL
jamie@2 335 * \param *result: the Sharpness of N values from the array pointed to by *data
jamie@2 336 */
jamie@43 337 int xtract_sharpness(const float *data, const int N, const void *argv, float *result);
jamie@1 338
jamie@48 339 /** \brief Extract the Slope of an input vector using a method described by Peeters(2003)
jamie@2 340 *
jamie@78 341 * \param *data: a pointer to the first element in an array of floats representing the spectrum of an audio vector, (e.g. the array pointed to by *result from xtract_spectrum(), xtract_peak_spectrum() or xtract_harmonic_spectrum()).
jamie@2 342 * \param N: the number of elements to be considered
jamie@2 343 * \param *argv: a pointer to NULL
jamie@2 344 * \param *result: the Slope of N values from the array pointed to by *data
jamie@2 345 */
jamie@52 346 int xtract_spectral_slope(const float *data, const int N, const void *argv, float *result);
jamie@1 347
jamie@45 348 /** \brief Extract the value of the lowest value in an input vector
jamie@2 349 *
jamie@43 350 * \param *data: a pointer to the first element in an array of floats
jamie@2 351 * \param N: the number of elements to be considered
jamie@45 352 * \param *argv: a pointer to a float representing the lower limit for the search. i.e. (*result > *argv) returns 1.
jamie@45 353 * \param *result: a pointer to a value representing the lowest component in *data that falls above a given threshold.
jamie@2 354 *
jamie@43 355 */
jamie@45 356 int xtract_lowest_value(const float *data, const int N, const void *argv, float *result);
jamie@45 357
jamie@45 358 /** \brief Extract the value of the highest value in an input vector
jamie@45 359 *
jamie@45 360 * \param *data: a pointer to the first element in an array of floats
jamie@45 361 * \param N: the number of elements to be considered
jamie@45 362 * \param *argv: a pointer to NULL.
jamie@45 363 * \param *result: a pointer to a value representing the highest component in *data.
jamie@45 364 *
jamie@45 365 */
jamie@45 366 int xtract_highest_value(const float *data, const int N, const void *argv, float *result);
jamie@45 367
jamie@45 368 /** \brief Extract the sum of the values in an input vector
jamie@45 369 *
jamie@45 370 * \param *data: a pointer to the first element in an array of floats
jamie@45 371 * \param N: the number of elements to be considered
jamie@45 372 * \param *argv: a pointer to NULL.
jamie@45 373 * \param *result: a pointer to a value representing the sum of all of the values pointed to by *data.
jamie@45 374 *
jamie@45 375 */
jamie@45 376 int xtract_sum(const float *data, const int N, const void *argv, float *result);
jamie@1 377
jamie@2 378 /** \brief Extract the Pitch of an input vector using Harmonic Product Spectrum (HPS) analysis
jamie@2 379 *
jamie@22 380 * \warning {This function doesn't work properly}
jamie@22 381 *
jamie@54 382 * \param *data: a pointer to the first element in an array of floats representing the magnitude coefficients from the spectrum of an audio vector, (e.g. the first half of the array pointed to by *result from xtract_spectrum().
jamie@2 383 * \param N: the number of elements to be considered
jamie@2 384 * \param *argv: a pointer to NULL
jamie@2 385 * \param *result: the pitch of N values from the array pointed to by *data
jamie@2 386 */
jamie@43 387 int xtract_hps(const float *data, const int N, const void *argv, float *result);
jamie@1 388
jamie@5 389 /** \brief Extract the fundamental frequency of an input vector
jamie@5 390 *
jamie@5 391 * \param *data: a pointer to the first element in an array of floats representing an audio vector
jamie@5 392 * \param N: the number of elements to be considered
jamie@22 393 * \param *argv: a pointer to a float representing the audio sample rate
jamie@5 394 * \param *result: the pitch of N values from the array pointed to by *data
jamie@12 395 *
jamie@22 396 * This algorithm is based on the AMDF, with peak and centre clipping. It would benefit from further improvements to improve noise robustness and overall efficiency
jamie@12 397 *
jamie@5 398 */
jamie@43 399 int xtract_f0(const float *data, const int N, const void *argv, float *result);
jamie@43 400
jamie@43 401 /** \brief Extract the fundamental frequency of an input vector
jamie@43 402 *
jamie@43 403 * \param *data: a pointer to the first element in an array of floats representing an audio vector
jamie@43 404 * \param N: the number of elements to be considered
jamie@43 405 * \param *argv: a pointer to a float representing the audio sample rate
jamie@43 406 * \param *result: the pitch of N values from the array pointed to by *data
jamie@43 407 *
jamie@43 408 * This function wraps xtract_f0, but provides the frequency of the lowest partial in the peak spectrum if f0 can't be found.
jamie@43 409 *
jamie@43 410 */
jamie@43 411 int xtract_failsafe_f0(const float *data, const int N, const void *argv, float *result);
jamie@5 412
jamie@59 413 /** \brief Extract the number of non-zero elements in an input vector
jamie@59 414 *
jamie@59 415 * \param *data: a pointer to the first element in an array of floats
jamie@59 416 * \param N: the number of elements to be considered
jamie@59 417 * \param *argv: not used
jamie@59 418 * \param *result: the number of non-zero elements in the array pointed to by *data
jamie@59 419 *
jamie@59 420 */
jamie@59 421 int xtract_nonzero_count(const float *data, const int N, const void *argv, float *result);
jamie@59 422
jamie@20 423 /** @} */
jamie@20 424
jamie@1 425 #ifdef __cplusplus
jamie@1 426 }
jamie@1 427 #endif
jamie@1 428
jamie@1 429 #endif
jamie@1 430
jamie@1 431
jamie@1 432