shithub: aubio

Download patch

ref: e4f142c3109be03c707aec0081c4008f2b5813e8
parent: d25bd12025e5ae9589fd68c9d020b0947facbe24
author: Paul Brossier <[email protected]>
date: Fri Oct 16 17:56:26 EDT 2009

src/onset/: use samplerate

--- a/src/onset/onset.c
+++ b/src/onset/onset.c
@@ -37,6 +37,7 @@
   smpl_t silence;               /**< silence threhsold */
   uint_t minioi;                /**< minimum inter onset interval */
   uint_t wasonset;              /**< number of frames since last onset */
+  uint_t samplerate;            /**< sampling rate of the input signal */
 };
 
 /* execute onset detection function on iput buffer */
@@ -89,7 +90,7 @@
 
 /* Allocate memory for an onset detection */
 aubio_onset_t * new_aubio_onset (char_t * onset_mode, 
-    uint_t buf_size, uint_t hop_size, uint_t channels)
+    uint_t buf_size, uint_t hop_size, uint_t channels, uint_t samplerate)
 {
   aubio_onset_t * o = AUBIO_NEW(aubio_onset_t);
   /** set some default parameter */
@@ -97,6 +98,7 @@
   o->minioi    = 4;
   o->silence   = -70;
   o->wasonset  = 0;
+  o->samplerate = samplerate;
   o->pv = new_aubio_pvoc(buf_size, hop_size, channels);
   o->pp = new_aubio_peakpicker(o->threshold);
   o->od = new_aubio_onsetdetection(onset_mode,buf_size,channels);
--- a/src/onset/onset.h
+++ b/src/onset/onset.h
@@ -52,7 +52,7 @@
 
 */
 aubio_onset_t * new_aubio_onset (char_t * onset_mode, 
-    uint_t buf_size, uint_t hop_size, uint_t channels);
+    uint_t buf_size, uint_t hop_size, uint_t channels, uint_t samplerate);
 
 /** execute onset detection