comparison include/xtract/xtract_scalar.h @ 254:39f1f8cf6756

Move xtract inside "include" directory
author Jamie Bullock <jamie@jamiebullock.com>
date Fri, 07 Nov 2014 12:49:21 +0000
parents
children
comparison
equal deleted inserted replaced
253:17531082a918 254:39f1f8cf6756
1 /*
2 * Copyright (C) 2012 Jamie Bullock
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 * IN THE SOFTWARE.
21 *
22 */
23
24 /** \file xtract_scalar.h: declares functions that extract a feature as a single value from an input vector */
25
26 #ifndef XTRACT_SCALAR_H
27 #define XTRACT_SCALAR_H
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /**
34 * \defgroup scalar scalar extraction functions
35 *
36 * Functions that extract a feature as a single value from an input vector
37 *
38 * @{
39 */
40
41 /** \brief Extract the mean of an input vector
42 *
43 * \param *data: a pointer to the first element
44 * \param N: the number of array elements to be considered
45 * \param *argv: a pointer to NULL
46 * \param *result: the mean of N values from the array pointed to by *data
47 */
48 int xtract_mean(const double *data, const int N, const void *argv, double *result);
49
50 /** \brief Extract the variance of an input vector
51 *
52 * \param *data: a pointer to the first element in an array of doubles
53 * \param N: the number of elements to be considered
54 * \param *argv: a pointer to a double representing the mean of the input vector
55 * \param *result: the variance of N values from the array pointed to by *data
56 */
57 int xtract_variance(const double *data, const int N, const void *argv, double *result);
58
59 /** \brief Extract the deviation of an input vector
60 *
61 * \param *data: a pointer to the first element in an array of doubles
62 * \param N: the number of elements to be considered
63 * \param *argv: a pointer to a double representing the variance of the input vector
64 * \param *result: the deviation of N values from the array pointed to by *data
65 */
66 int xtract_standard_deviation(const double *data, const int N, const void *argv, double *result);
67
68 /** \brief Extract the average deviation of an input vector
69 *
70 * \param *data: a pointer to the first element in an array of doubles
71 * \param N: the number of elements to be considered
72 * \param *argv: a pointer to a double representing the mean of the input vector
73 * \param *result: the average deviation of N values from the array pointed to by *data
74 */
75 int xtract_average_deviation(const double *data, const int N, const void *argv, double *result);
76
77
78 /** \brief Extract the skewness of an input vector
79 *
80 * \param *data: a pointer to the first element in an array of doubles
81 * \param N: the number of elements to be considered
82 * \param *argv: a pointer to an array of doubles representing the mean and standard deviation of the input vector
83 * \param *result: the skewness of N values from the array pointed to by *data
84 */
85 int xtract_skewness(const double *data, const int N, const void *argv, double *result);
86
87 /** \brief Extract the kurtosis of an input vector
88 *
89 * \param *data: a pointer to the first element in an array of doubles
90 * \param N: the number of elements to be considered
91 * \param *argv: a pointer to an array of values representing the mean and standard deviation of the input vector
92 * \param *result: the kurtosis of N values from the array pointed to by *data
93 */
94 int xtract_kurtosis(const double *data, const int N, const void *argv, double *result);
95
96 /** \brief Extract the mean of an input spectrum
97 *
98 * \param *data: a pointer to the first element in an array of doubles 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()).
99 * \param N: the size of the array pointed to by *data
100 * \param *argv: a pointer to NULL
101 * \param *result: the mean of the spectrum pointed to by *data
102 */
103 int xtract_spectral_mean(const double *data, const int N, const void *argv, double *result);
104
105 /** \brief Extract the variance of an input spectrum
106 *
107 * \param *data: a pointer to the first element in an array of doubles 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()).
108 * \param N: the number of elements to be considered
109 * \param N: the size of the array pointed to by *data
110 * \param *argv: a pointer to a double representing the spectral mean of the input spectrum
111 * \param *result: the variance of the spectrum pointed to by *data
112 */
113 int xtract_spectral_variance(const double *data, const int N, const void *argv, double *result);
114
115 /** \brief Extract the deviation of an input spectrum
116 *
117 * \param *data: a pointer to the first element in an array of doubles 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()).
118 * \param N: the size of the array pointed to by *data
119 * \param *argv: a pointer to a double representing the spectral variance of the input spectrum
120 * \param *result: the deviation of the spectrum pointed to by *data
121 */
122 int xtract_spectral_standard_deviation(const double *data, const int N, const void *argv, double *result);
123
124 /** \brief Extract the average deviation of an input spectrum
125 *
126 * \param *data: a pointer to the first element in an array of doubles 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()).
127 * \param N: the size of the array pointed to by *data
128 * \param *argv: a pointer to a double representing the spectral mean of the input spectrum
129 * \param *result: the average deviation of the spectrum pointed to by *data
130 */
131 /*
132 int xtract_spectral_average_deviation(const double *data, const int N, const void *argv, double *result);
133 */
134
135 /** \brief Extract the skewness of an input spectrum
136 *
137 * \param *data: a pointer to the first element in an array of doubles 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()).
138 * \param N: the size of the array pointed to by *data
139 * \param *argv: a pointer to an array of doubles representing the spectral mean and spectral standard deviation of the input spectrum
140 * \param *result: the skewness of the spectrum pointed to by *data
141 */
142 int xtract_spectral_skewness(const double *data, const int N, const void *argv, double *result);
143
144 /** \brief Extract the kurtosis of an input spectrum
145 *
146 * \param *data: a pointer to the first element in an array of doubles 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()).
147 * \param N: the size of the array pointed to by *data
148 * \param *argv: a pointer to an array of values representing the spectral mean and spectral standard deviation of the input spectrum
149 * \param *result: the kurtosis of the spectrum pointed to by *data
150 */
151 int xtract_spectral_kurtosis(const double *data, const int N, const void *argv, double *result);
152
153 /** \brief Extract the centroid of an input vector
154 *
155 * \param *data: a pointer to the first element in an array of doubles 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()).
156 * \param N: the number of elements to be considered
157 * \param *argv: a pointer to NULL
158 * \param *result: the centroid of the values pointed to by *data
159 *
160 * Note: for a more 'accurate' result *result from xtract_peak_spectrum() can be passed in. This gives the interpolated peak frequency locations.
161 *
162 */
163 int xtract_spectral_centroid(const double *data, const int N, const void *argv, double *result);
164
165 /** \brief Calculate the Irregularity of an input vector using a method described by Krimphoff (1994)
166 *
167 * \param *data: a pointer to the first element in an array of doubles 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().
168 * \param N: the number of elements to be considered
169 * \param *argv: a pointer to NULL
170 * \param *result: the irregularity of N values from the array pointed to by *data
171 */
172 int xtract_irregularity_k(const double *data, const int N, const void *argv, double *result);
173
174 /** \brief Calculate the Irregularity of an input vector using a method described by Jensen (1999)
175 *
176 * \param *data: a pointer to the first element in an array of doubles 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().
177 * \param N: the number of elements to be considered
178 * \param *argv: a pointer to NULL
179 * \param *result: the irregularity of N values from the array pointed to by *data
180 */
181 int xtract_irregularity_j(const double *data, const int N, const void *argv, double *result);
182
183 /** \brief Calculate the Tristimulus of an input vector using a method described by Pollard and Jansson (1982)
184 *
185 * \param *data: a pointer to the first element in an array of doubles representing a harmonic spectrum of size N/2, and a frequency spectrum of size N/2 (This is the output format of xtract_harmonic_spectrum())
186 * \param N: the number of elements to be considered
187 * \param *argv: a pointer to a double representing the fundamental frequency of the input vector.
188 * \param *result: the tristimulus of N values from the array pointed to by *data
189 *
190 * These three functions provide the first, second and third order tristimulus formulae
191 *
192 */
193 int xtract_tristimulus_1(const double *data, const int N, const void *argv, double *result);
194 int xtract_tristimulus_2(const double *data, const int N, const void *argv, double *result);
195 int xtract_tristimulus_3(const double *data, const int N, const void *argv, double *result);
196
197 /** \brief Extract the smoothness of an input vector using a method described by McAdams (1999)
198 *
199 * \param *data: a pointer to the first element in an array of doubles 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().
200 * \param N: the number of elements to be considered
201 * \param *argv: a pointer to NULL
202 * \param *result: the smoothness of N values from the array pointed to by *data
203 */
204 int xtract_smoothness(const double *data, const int N, const void *argv, double *result);
205
206 /** \brief Extract the spectral spread of an input vector using a method described by Casagrande(2005)
207 *
208 * \param *data: a pointer to the first element in an array of doubles 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().
209 * \param N: the number of elements to be considered
210 * \param *argv: a pointer to a double corresponding to the spectral centroid
211 * \param *result: the spectral spread of N values from the array pointed to by *data
212 */
213 int xtract_spread(const double *data, const int N, const void *argv, double *result);
214
215 /* Zero crossing rate */
216
217 /** \brief Extract the zero crossing rate of an input vector
218 *
219 * \param *data: a pointer to the first element in an array of doubles
220 * \param N: the number of elements to be considered
221 * \param *argv: a pointer to NULL
222 * \param *result: the zero crossing rate of N values from the array pointed to by *data
223 */
224 int xtract_zcr(const double *data, const int N, const void *argv, double *result);
225
226 /** \brief Extract the spectral rolloff of an input vector using a method described by Bee Suan Ong (2005)
227 *
228 * \param *data: a pointer to the first element in an array of doubles 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().
229 * \param N: the number of elements to be considered
230 * \param *argv: a pointer to an array containing a double representing (samplerate / N ) and a double representing the threshold for rolloff, i.e. the percentile at which the rolloff is determined, expressed as a percentage, and
231 * \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.
232 */
233 int xtract_rolloff(const double *data, const int N, const void *argv, double *result);
234
235 /** \brief Extract the 'total loudness' of an input vector using a method described by Moore, Glasberg et al (2005)
236 *
237 * \param *data: a pointer to the first element in an array of doubles representing a set of BARK_BANDS bark coefficients
238 * \param N: the number of coefficients to be considered
239 * \param *argv: a pointer to NULL
240 * \param *result: the total loudness of N values from the array pointed to by *data
241 *
242 * Note: if N = 1, the 'specific loudness' of the bark band pointed to by *data will be given by *result
243 *
244 */
245 int xtract_loudness(const double *data, const int N, const void *argv, double *result);
246
247 /** \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.
248 *
249 * \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().
250 *
251 * \param *data: a pointer to the first element in an array of doubles 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().
252 * \param N: the number of *data array elements to be considered
253 * \param *argv: a pointer to NULL
254 * \param *result: the flatness of N values from the array pointed to by *data
255 */
256 int xtract_flatness(const double *data, const int N, const void *argv, double *result);
257
258 /** \brief Extract the LOG spectral flatness measure of an input vector
259 *
260 * \param *data: a pointer to NULL.
261 * \param N: not used - can safely be set to 0.
262 * \param *argv: a pointer to a double represnting spectral flatness.
263 * \param *result: the LOG spectral flatness of N values from the array pointed to by *data
264 *
265 * flatness_db = 10 * log10(flatness)
266 *
267 */
268 int xtract_flatness_db(const double *data, const int N, const void *argv, double *result);
269
270 /** \brief Extract the tonality factor of an input vector using a method described by Peeters 2003
271 *
272 * \param *data: a pointer to NULL.
273 * \param N: not used - can safely be set to 0.
274 * \param *argv: a pointer to the LOG spectral flatness measure of an audio vector (e.g. the output from xtract_flatness_db)
275 * \param *result: the tonality factor of N values from the array pointed to by *data
276 */
277 int xtract_tonality(const double *data, const int N, const void *argv, double *result);
278
279 /** \brief Extract the noisiness of an input vector using a method described by Tae Hong Park (2000)
280 *
281 * \param *data: a pointer to NULL
282 * \param N:
283 * \param *argv: a pointer to an array containing a double represnting the number of harmonic partials in a spectrum, and a double representing the number of partials in a spectrum
284 * \param *result: the noisiness coefficient as calculated from argv
285 */
286 int xtract_noisiness(const double *data, const int N, const void *argv, double *result);
287
288 /** \brief Extract the RMS amplitude of an input vector using a method described by Tae Hong Park (2000)
289 *
290 * \param *data: a pointer to the first element in an array of doubles
291 * \param N: the number of elements to be considered
292 * \param *argv: a pointer to NULL
293 * \param *result: the RMS amplitude of N values from the array pointed to by *data
294 */
295 int xtract_rms_amplitude(const double *data, const int N, const void *argv, double *result);
296
297 /** \brief Extract the Inharmonicity of an input vector
298 *
299 * \param *data: a pointer to the first element in an array of doubles 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())
300 * \param N: the number of elements to be considered
301 * \param *argv: a pointer to a double representing the fundamental frequency of the input vector.
302 * \param *result: the inharmonicity of N values from the array pointed to by *data
303 */
304 int xtract_spectral_inharmonicity(const double *data, const int N, const void *argv, double *result);
305
306 /** \brief Extract the spectral crest of an input vector using a method described by Peeters (2003)
307 *
308 * \param *data: a pointer to NULL
309 * \param N: not used
310 * \param *argv: a pointer to an array containing a double representing the maximum value in a spectrum, and a double representing the mean value of a spectrum
311 * \param *result: the spectral crest of N values from the array pointed to by *data
312 */
313 int xtract_crest(const double *data, const int N, const void *argv, double *result);
314
315 /** \brief Extract the Spectral Power of an input vector using a method described by Bee Suan Ong (2005)
316 *
317 * \param *data: a pointer to the first element in an array of doubles 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().
318 * \param N: the number of elements to be considered
319 * \param *argv: a pointer to NULL
320 * \param *result: the spectral power of N values from the array pointed to by *data
321 */
322 int xtract_power(const double *data, const int N, const void *argv, double *result);
323
324 /* Odd to even harmonic ratio */
325 /** \brief Extract the Odd to even harmonic ratio of an input vector
326 *
327 * \param *data: a pointer to the first element in an array of doubles representing a harmonic spectrum of size N/2, and a frequency spectrum of size N/2 (This is the output format of xtract_harmonic_spectrum())
328 * \param N: the number of elements to be considered.
329 * \param *argv: a pointer to a double representing the fundamental frequency of the input vector.
330 * \param *result: the even/odd harmonic ratio of N values from the array pointed to by *data
331 */
332 int xtract_odd_even_ratio(const double *data, const int N, const void *argv, double *result);
333
334 /** \brief Extract the Sharpness of an input vector
335 *
336 * \param *data: a pointer to the first element in an array of doubles 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().
337 * \param N: the number of elements to be considered
338 * \param *argv: a pointer to NULL
339 * \param *result: the Sharpness of N values from the array pointed to by *data
340 */
341 int xtract_sharpness(const double *data, const int N, const void *argv, double *result);
342
343 /** \brief Extract the Slope of an input vector using a method described by Peeters(2003)
344 *
345 * \param *data: a pointer to the first element in an array of doubles 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()).
346 * \param N: the number of elements to be considered
347 * \param *argv: a pointer to NULL
348 * \param *result: the Slope of N values from the array pointed to by *data
349 */
350 int xtract_spectral_slope(const double *data, const int N, const void *argv, double *result);
351
352 /** \brief Extract the value of the lowest value in an input vector
353 *
354 * \param *data: a pointer to the first element in an array of doubles
355 * \param N: the number of elements to be considered
356 * \param *argv: a pointer to a double representing the lower limit for the search. All values in the array pointed to by *data that are below or equal to this threshold will be ignored.
357 * \param *result: a pointer to a value representing the lowest component in *data that falls above a given threshold.
358 *
359 * \return XTRACT_SUCCESS is a lowest value was found or XTRACT_NO_VALUE if all values
360 * in the array pointed to by *data are below or equal to the threshold set with *argv
361 *
362 * \note If XTRACT_NO_VALUE is returned, *result will be set to DBL_MAX
363 *
364 */
365 int xtract_lowest_value(const double *data, const int N, const void *argv, double *result);
366
367 /** \brief Extract the value of the highest value in an input vector
368 *
369 * \param *data: a pointer to the first element in an array of doubles
370 * \param N: the number of elements to be considered
371 * \param *argv: a pointer to NULL.
372 * \param *result: a pointer to a value representing the highest component in *data.
373 *
374 */
375 int xtract_highest_value(const double *data, const int N, const void *argv, double *result);
376
377 /** \brief Extract the sum of the values in an input vector
378 *
379 * \param *data: a pointer to the first element in an array of doubles
380 * \param N: the number of elements to be considered
381 * \param *argv: a pointer to NULL.
382 * \param *result: a pointer to a value representing the sum of all of the values pointed to by *data.
383 *
384 */
385 int xtract_sum(const double *data, const int N, const void *argv, double *result);
386
387 /** \brief Extract the Pitch of an input vector using Harmonic Product Spectrum (HPS) analysis
388 *
389 * \param *data: a pointer to the first element in an array of doubles representing the spectrum of an audio vector (e.g. *result from xtract_spectrum). It is expected that the first half of the array pointed to by *data will contain amplitudes for each frequecy bin, and the second half will contain the respective frequencies
390 * \param N: The length of the vector pointed to by *data.
391 * \param *argv: a pointer to NULL
392 * \param *result: the pitch of N values from the array pointed to by *data
393 */
394 int xtract_hps(const double *data, const int N, const void *argv, double *result);
395
396 /** \brief Extract the fundamental frequency of an input vector
397 *
398 * \param *data: a pointer to the first element in an array of doubles representing an audio vector
399 * \param N: the number of elements to be considered
400 * \param *argv: a pointer to a double representing the audio sample rate
401 * \param *result: the pitch of N values from the array pointed to by *data
402 *
403 * 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
404 *
405 * It is based on suggestion by Robert Bristow-Johnson in a discussion on the comp.dsp mailing list, subject "Reference implementation of pitch detection"
406 *
407 */
408 int xtract_f0(const double *data, const int N, const void *argv, double *result);
409
410 /** \brief Extract the fundamental frequency of an input vector
411 *
412 * \param *data: a pointer to the first element in an array of doubles representing an audio vector
413 * \param N: the number of elements to be considered
414 * \param *argv: a pointer to a double representing the audio sample rate
415 * \param *result: the pitch of N values from the array pointed to by *data
416 *
417 * This function wraps xtract_f0, but provides the frequency of the lowest partial in the peak spectrum if f0 can't be found.
418 *
419 */
420 int xtract_failsafe_f0(const double *data, const int N, const void *argv, double *result);
421
422 /** \brief Extract the fundamental frequency of an input vector using wavelet-based method
423 *
424 * \param *data: a pointer to the first element in an array of doubles representing an audio vector
425 * \param N: the number of elements to be considered
426 * \param *argv: a pointer to a double representing the audio sample rate
427 * \param *result: the pitch of N values from the array pointed to by *data
428 *
429 * This function uses the time-domain wavelet-based method described in Larson and Maddox (2005) and
430 * implemented in the dywapitchtrack library
431 *
432 * xtract_init_wavelet_f0_state() must be called exactly once prior to calling xtract_wavelet_f0()
433 *
434 */
435 int xtract_wavelet_f0(const double *data, const int N, const void *argv, double *result);
436
437
438 /** \brief Convenience function to convert a frequency in Hertz to a "pitch" value in MIDI cents
439 *
440 * \param *data: not used
441 * \param N: not used
442 * \param *argv: a pointer to a double-precision floating point value representing a frequency in Hertz
443 * \param *result: a pointer to a double-precision floating point value representing a "pitch" in MIDI cents
444 * \return if *argv value causes a *result within the range 0..127, XTRACT_SUCCESS will be returned, otherwise XTRACT_ARGUMENT_ERROR
445 *
446 */
447 int xtract_midicent(const double *data, const int N, const void *argv, double *result);
448
449
450 /** \brief Extract the number of non-zero elements in an input vector
451 *
452 * \param *data: a pointer to the first element in an array of doubles
453 * \param N: the number of elements to be considered
454 * \param *argv: not used
455 * \param *result: the number of non-zero elements in the array pointed to by *data
456 *
457 */
458 int xtract_nonzero_count(const double *data, const int N, const void *argv, double *result);
459
460 /**
461 * \brief Return XTRACT_SUCCESS if the 'current' value is considered a peak
462 *
463 * @param data a pointer to an array containing time series as provided by *result from xtract_last_n() where the Nth value is considered the 'current' value
464 * @param N an integer representing the number of elements in the time series
465 * @param argv a pointer to a double representing the threshold, whereby the current value will be considered a peak if it is above the average of the last N values (*data) by the threshold
466 * @param result a pointer to a copy of the current value if the current value is considered a peak
467 *
468 *
469 * @return XTRACT_SUCCESS if a peak was found or XTRACT_NO_RESULT if not
470 */
471 int xtract_peak(const double *data, const int N, const void *argv, double *result);
472
473
474 /** @} */
475
476 #ifdef __cplusplus
477 }
478 #endif
479
480 #endif
481
482
483