Mercurial > hg > libxtract
comparison xtract/xtract_scalar.h @ 113:72a9a393d5bd
- Fixed bugs in xtract_flatness(), or at least added necessary
documentation and error checking to avoid problems
- Added xtract_is_denormal() helper function and XTRACT_DENORMAL_FOUND
return code
- Replaced all instances of log, sqrt, exp etc. with respective
floating point counterparts (logf etc.)
- Added check for architecture endianness to configure script
- Bug fix to PD example, now no longer crashes if no arguments are
given
- Minor documentation updates
author | Jamie Bullock <jamie@postlude.co.uk> |
---|---|
date | Fri, 15 Feb 2008 12:43:13 +0000 |
parents | 35a3bb5c3ffd |
children | 859495925633 |
comparison
equal
deleted
inserted
replaced
112:a76501dc5307 | 113:72a9a393d5bd |
---|---|
237 * Note: if N = 1, the 'specific loudness' of the bark band pointed to by *data will be given by *result | 237 * Note: if N = 1, the 'specific loudness' of the bark band pointed to by *data will be given by *result |
238 * | 238 * |
239 */ | 239 */ |
240 int xtract_loudness(const float *data, const int N, const void *argv, float *result); | 240 int xtract_loudness(const float *data, const int N, const void *argv, float *result); |
241 | 241 |
242 /** \brief Extract the spectral flatness measure of an input vector using a method described by Tristan Jehan (2005) | 242 /** \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. |
243 * | 243 * |
244 * \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(). | 244 * \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(). |
245 * \param N: the number of elements to be considered | 245 * |
246 * \param *argv: a pointer to NULL | 246 * \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(). |
247 * \param *result: the spectral flatness of N values from the array pointed to by *data | 247 * \param N: the number of *data array elements to be considered |
248 * \param *argv: a pointer to NULL | |
249 * \param *result: the flatness of N values from the array pointed to by *data | |
248 */ | 250 */ |
249 int xtract_flatness(const float *data, const int N, const void *argv, float *result); | 251 int xtract_flatness(const float *data, const int N, const void *argv, float *result); |
250 | 252 |
251 | 253 /** \brief Extract the LOG spectral flatness measure of an input vector |
252 /** \brief Extract the tonality factor of an input vector using a method described by Tristan Jehan (2005) | 254 * |
253 * | 255 * \param *data: a pointer to NULL. |
254 * \param *data: not used. | 256 * \param N: not used - can safely be set to 0. |
255 * \param N: not used | 257 * \param *argv: a pointer to a float represnting spectral flatness. |
256 * \param *argv: a pointer to the spectral flatness measure of an audio vector (e.g. the output from xtract_flatness) | 258 * \param *result: the LOG spectral flatness of N values from the array pointed to by *data |
259 * | |
260 * flatness_db = 10 * log10(flatness) | |
261 * | |
262 */ | |
263 int xtract_flatness_db(const float *data, const int N, const void *argv, float *result); | |
264 | |
265 /** \brief Extract the tonality factor of an input vector using a method described by Peeters 2003 | |
266 * | |
267 * \param *data: a pointer to NULL. | |
268 * \param N: not used - can safely be set to 0. | |
269 * \param *argv: a pointer to the LOG spectral flatness measure of an audio vector (e.g. the output from xtract_flatness_db) | |
257 * \param *result: the tonality factor of N values from the array pointed to by *data | 270 * \param *result: the tonality factor of N values from the array pointed to by *data |
258 */ | 271 */ |
259 int xtract_tonality(const float *data, const int N, const void *argv, float *result); | 272 int xtract_tonality(const float *data, const int N, const void *argv, float *result); |
260 | 273 |
261 /** \brief Extract the noisiness of an input vector using a method described by Tae Hong Park (2000) | 274 /** \brief Extract the noisiness of an input vector using a method described by Tae Hong Park (2000) |
307 /** \brief Extract the Odd to even harmonic ratio of an input vector | 320 /** \brief Extract the Odd to even harmonic ratio of an input vector |
308 * | 321 * |
309 * \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(). | 322 * \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(). |
310 * \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. | 323 * \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. |
311 * \param *argv: a pointer to NULL | 324 * \param *argv: a pointer to NULL |
312 * \param *result: the odd/even harmonic ratio of N values from the array pointed to by *data | 325 * \param *result: the even/odd harmonic ratio of N values from the array pointed to by *data |
313 */ | 326 */ |
314 int xtract_odd_even_ratio(const float *data, const int N, const void *argv, float *result); | 327 int xtract_odd_even_ratio(const float *data, const int N, const void *argv, float *result); |
315 | 328 |
316 /** \brief Extract the Sharpness of an input vector | 329 /** \brief Extract the Sharpness of an input vector |
317 * | 330 * |