aboutsummaryrefslogtreecommitdiff
path: root/xtract/xtract_scalar.h
diff options
context:
space:
mode:
Diffstat (limited to 'xtract/xtract_scalar.h')
-rw-r--r--xtract/xtract_scalar.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/xtract/xtract_scalar.h b/xtract/xtract_scalar.h
index 4461623..8e24284 100644
--- a/xtract/xtract_scalar.h
+++ b/xtract/xtract_scalar.h
@@ -434,6 +434,19 @@ int xtract_failsafe_f0(const double *data, const int N, const void *argv, double
*/
int xtract_wavelet_f0(const double *data, const int N, const void *argv, double *result);
+
+/** \brief Convenience function to convert a frequency in Hertz to a "pitch" value in MIDI cents
+ *
+ * \param *data: not used
+ * \param N: not used
+ * \param *argv: a pointer to a double-precision floating point value representing a frequency in Hertz
+ * \param *result: a pointer to a double-precision floating point value representing a "pitch" in MIDI cents
+ * \return if *argv value causes a *result within the range 0..127, XTRACT_SUCCESS will be returned, otherwise XTRACT_ARGUMENT_ERROR
+ *
+ */
+int xtract_midicent(const double *data, const int N, const void *argv, double *result);
+
+
/** \brief Extract the number of non-zero elements in an input vector
*
* \param *data: a pointer to the first element in an array of doubles
@@ -444,6 +457,20 @@ int xtract_wavelet_f0(const double *data, const int N, const void *argv, double
*/
int xtract_nonzero_count(const double *data, const int N, const void *argv, double *result);
+/**
+ * \brief Return XTRACT_SUCCESS if the 'current' value is considered a peak
+ *
+ * @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
+ * @param N an integer representing the number of elements in the time series
+ * @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
+ * @param result a pointer to a copy of the current value if the current value is considered a peak
+ *
+ *
+ * @return XTRACT_SUCCESS if a peak was found or XTRACT_NO_RESULT if not
+ */
+int xtract_peak(const double *data, const int N, const void *argv, double *result);
+
+
/** @} */
#ifdef __cplusplus