comparison xtract/xtract_scalar.h @ 78:afb298ce1b4d

Fixes for MSP example, and changed the fundamental estimators so that if they don't get a samplerate 44100 is assumed (I'm not sure if this is a good idea!).
author Jamie Bullock <jamie@postlude.co.uk>
date Sun, 19 Aug 2007 16:54:25 +0000
parents 8fd7088c8ff6
children 5fadbacdb2a7
comparison
equal deleted inserted replaced
77:899c31350e8d 78:afb298ce1b4d
88 */ 88 */
89 int xtract_kurtosis(const float *data, const int N, const void *argv, float *result); 89 int xtract_kurtosis(const float *data, const int N, const void *argv, float *result);
90 90
91 /** \brief Extract the mean of an input spectrum 91 /** \brief Extract the mean of an input spectrum
92 * 92 *
93 * \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_magnitude_spectrum(), xtract_spectral_peaks() or xtract_spectral_harmonics()). 93 * \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()).
94 * \param N: the size of the array pointed to by *data 94 * \param N: the size of the array pointed to by *data
95 * \param *argv: a pointer to NULL 95 * \param *argv: a pointer to NULL
96 * \param *result: the mean of the spectrum pointed to by *data 96 * \param *result: the mean of the spectrum pointed to by *data
97 */ 97 */
98 int xtract_spectral_mean(const float *data, const int N, const void *argv, float *result); 98 int xtract_spectral_mean(const float *data, const int N, const void *argv, float *result);
99 99
100 /** \brief Extract the variance of an input spectrum 100 /** \brief Extract the variance of an input spectrum
101 * 101 *
102 * \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_magnitude_spectrum(), xtract_spectral_peaks() or xtract_spectral_harmonics()). 102 * \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()).
103 * \param N: the number of elements to be considered 103 * \param N: the number of elements to be considered
104 * \param N: the size of the array pointed to by *data 104 * \param N: the size of the array pointed to by *data
105 * \param *argv: a pointer to a float representing the spectral mean of the input spectrum 105 * \param *argv: a pointer to a float representing the spectral mean of the input spectrum
106 * \param *result: the variance of the spectrum pointed to by *data 106 * \param *result: the variance of the spectrum pointed to by *data
107 */ 107 */
108 int xtract_spectral_variance(const float *data, const int N, const void *argv, float *result); 108 int xtract_spectral_variance(const float *data, const int N, const void *argv, float *result);
109 109
110 /** \brief Extract the deviation of an input spectrum 110 /** \brief Extract the deviation of an input spectrum
111 * 111 *
112 * \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_magnitude_spectrum(), xtract_spectral_peaks() or xtract_spectral_harmonics()). 112 * \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()).
113 * \param N: the size of the array pointed to by *data 113 * \param N: the size of the array pointed to by *data
114 * \param *argv: a pointer to a float representing the spectral variance of the input spectrum 114 * \param *argv: a pointer to a float representing the spectral variance of the input spectrum
115 * \param *result: the deviation of the spectrum pointed to by *data 115 * \param *result: the deviation of the spectrum pointed to by *data
116 */ 116 */
117 int xtract_spectral_standard_deviation(const float *data, const int N, const void *argv, float *result); 117 int xtract_spectral_standard_deviation(const float *data, const int N, const void *argv, float *result);
118 118
119 /** \brief Extract the average deviation of an input spectrum 119 /** \brief Extract the average deviation of an input spectrum
120 * 120 *
121 * \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_magnitude_spectrum(), xtract_spectral_peaks() or xtract_spectral_harmonics()). 121 * \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()).
122 * \param N: the size of the array pointed to by *data 122 * \param N: the size of the array pointed to by *data
123 * \param *argv: a pointer to a float representing the spectral mean of the input spectrum 123 * \param *argv: a pointer to a float representing the spectral mean of the input spectrum
124 * \param *result: the average deviation of the spectrum pointed to by *data 124 * \param *result: the average deviation of the spectrum pointed to by *data
125 */ 125 */
126 int xtract_spectral_average_deviation(const float *data, const int N, const void *argv, float *result); 126 int xtract_spectral_average_deviation(const float *data, const int N, const void *argv, float *result);
127 127
128 /** \brief Extract the skewness of an input spectrum 128 /** \brief Extract the skewness of an input spectrum
129 * 129 *
130 * \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_magnitude_spectrum(), xtract_spectral_peaks() or xtract_spectral_harmonics()). 130 * \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()).
131 * \param N: the size of the array pointed to by *data 131 * \param N: the size of the array pointed to by *data
132 * \param *argv: a pointer to an array of floats representing the spectral mean and spectral standard deviation of the input spectrum 132 * \param *argv: a pointer to an array of floats representing the spectral mean and spectral standard deviation of the input spectrum
133 * \param *result: the skewness of the spectrum pointed to by *data 133 * \param *result: the skewness of the spectrum pointed to by *data
134 */ 134 */
135 int xtract_spectral_skewness(const float *data, const int N, const void *argv, float *result); 135 int xtract_spectral_skewness(const float *data, const int N, const void *argv, float *result);
136 136
137 /** \brief Extract the kurtosis of an input spectrum 137 /** \brief Extract the kurtosis of an input spectrum
138 * 138 *
139 * \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_magnitude_spectrum(), xtract_spectral_peaks() or xtract_spectral_harmonics()). 139 * \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()).
140 * \param N: the size of the array pointed to by *data 140 * \param N: the size of the array pointed to by *data
141 * \param *argv: a pointer to an array of values representing the spectral mean and spectral standard deviation of the input spectrum 141 * \param *argv: a pointer to an array of values representing the spectral mean and spectral standard deviation of the input spectrum
142 * \param *result: the kurtosis of the spectrum pointed to by *data 142 * \param *result: the kurtosis of the spectrum pointed to by *data
143 */ 143 */
144 int xtract_spectral_kurtosis(const float *data, const int N, const void *argv, float *result); 144 int xtract_spectral_kurtosis(const float *data, const int N, const void *argv, float *result);
145 145
146 /** \brief Extract the centroid of an input vector 146 /** \brief Extract the centroid of an input vector
147 * 147 *
148 * \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_magnitude_spectrum(), xtract_spectral_peaks() or xtract_spectral_harmonics()). 148 * \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()).
149 * \param N: the number of elements to be considered 149 * \param N: the number of elements to be considered
150 * \param *argv: a pointer to NULL 150 * \param *argv: a pointer to NULL
151 * \param *result: the centroid of the values pointed to by *data 151 * \param *result: the centroid of the values pointed to by *data
152 * 152 *
153 * Note: for a more 'accurate' result *result from xtract_spectral_peaks() can be passed in. This gives the interpolated peak frequency locations. 153 * Note: for a more 'accurate' result *result from xtract_peak_spectrum() can be passed in. This gives the interpolated peak frequency locations.
154 * 154 *
155 */ 155 */
156 int xtract_spectral_centroid(const float *data, const int N, const void *argv, float *result); 156 int xtract_spectral_centroid(const float *data, const int N, const void *argv, float *result);
157 157
158 /** \brief Calculate the Irregularity of an input vector using a method described by Krimphoff (1994) 158 /** \brief Calculate the Irregularity of an input vector using a method described by Krimphoff (1994)
173 */ 173 */
174 int xtract_irregularity_j(const float *data, const int N, const void *argv, float *result); 174 int xtract_irregularity_j(const float *data, const int N, const void *argv, float *result);
175 175
176 /** \brief Calculate the Tristimulus of an input vector using a method described by Pollard and Jansson (1982) 176 /** \brief Calculate the Tristimulus of an input vector using a method described by Pollard and Jansson (1982)
177 * 177 *
178 * \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_spectral_peaks()) can be used if one wishes to consider all partials not just harmonics. 178 * \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.
179 * \param N: the number of elements to be considered 179 * \param N: the number of elements to be considered
180 * \param *argv: a pointer to NULL 180 * \param *argv: a pointer to NULL
181 * \param *result: the tristimulus of N values from the array pointed to by *data 181 * \param *result: the tristimulus of N values from the array pointed to by *data
182 * 182 *
183 * These three functions provide the first, second and third order tristimulus formulae 183 * These three functions provide the first, second and third order tristimulus formulae
274 */ 274 */
275 int xtract_rms_amplitude(const float *data, const int N, const void *argv, float *result); 275 int xtract_rms_amplitude(const float *data, const int N, const void *argv, float *result);
276 276
277 /** \brief Extract the Inharmonicity of an input vector 277 /** \brief Extract the Inharmonicity of an input vector
278 * 278 *
279 * \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_spectral_peaks()) 279 * \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())
280 * \param N: the number of elements to be considered 280 * \param N: the number of elements to be considered
281 * \param *argv: a pointer to a float representing the fundamental frequency of the input vector. 281 * \param *argv: a pointer to a float representing the fundamental frequency of the input vector.
282 * \param *result: the inharmonicity of N values from the array pointed to by *data 282 * \param *result: the inharmonicity of N values from the array pointed to by *data
283 */ 283 */
284 int xtract_spectral_inharmonicity(const float *data, const int N, const void *argv, float *result); 284 int xtract_spectral_inharmonicity(const float *data, const int N, const void *argv, float *result);
320 */ 320 */
321 int xtract_sharpness(const float *data, const int N, const void *argv, float *result); 321 int xtract_sharpness(const float *data, const int N, const void *argv, float *result);
322 322
323 /** \brief Extract the Slope of an input vector using a method described by Peeters(2003) 323 /** \brief Extract the Slope of an input vector using a method described by Peeters(2003)
324 * 324 *
325 * \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_magnitude_spectrum(), xtract_spectral_peaks() or xtract_spectral_harmonics()). 325 * \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()).
326 * \param N: the number of elements to be considered 326 * \param N: the number of elements to be considered
327 * \param *argv: a pointer to NULL 327 * \param *argv: a pointer to NULL
328 * \param *result: the Slope of N values from the array pointed to by *data 328 * \param *result: the Slope of N values from the array pointed to by *data
329 */ 329 */
330 int xtract_spectral_slope(const float *data, const int N, const void *argv, float *result); 330 int xtract_spectral_slope(const float *data, const int N, const void *argv, float *result);