shithub: aubio

Download patch

ref: e45345d9d7d91266e02d43c5cdf5c7f8aeab03b6
parent: d91566e42c5a61253d27f1b9885bc190f8b6a1fc
parent: dd474317079df5628ff6f5a4d70dad61368720d1
author: Paul Brossier <piem@piem.org>
date: Fri Dec 7 08:16:37 EST 2018

Merge branch 'master' into feature/pydocstrings

--- a/src/pitch/pitchspecacf.c
+++ b/src/pitch/pitchspecacf.c
@@ -92,6 +92,7 @@
   del_aubio_fft (p->fft);
   del_fvec (p->sqrmag);
   del_fvec (p->fftout);
+  del_fvec (p->acf);
   AUBIO_FREE (p);
 }
 
--- a/src/spectral/awhitening.c
+++ b/src/spectral/awhitening.c
@@ -43,7 +43,8 @@
 aubio_spectral_whitening_do (aubio_spectral_whitening_t * o, cvec_t * fftgrain)
 {
   uint_t i = 0;
-  for (i = 0; i < o->peak_values->length; i++) {
+  uint_t length = MIN(fftgrain->length, o->peak_values->length);
+  for (i = 0; i < length; i++) {
     smpl_t tmp = MAX(o->r_decay * o->peak_values->data[i], o->floor);
     o->peak_values->data[i] = MAX(fftgrain->norm[i], tmp);
     fftgrain->norm[i] /= o->peak_values->data[i];
--- a/src/utils/hist.c
+++ b/src/utils/hist.c
@@ -44,6 +44,7 @@
   smpl_t accum = step;
   uint_t i;
   if ((sint_t)nelems <= 0) {
+    AUBIO_FREE(s);
     return NULL;
   }
   s->nelems = nelems;
--- a/tests/src/spectral/test-awhitening.c
+++ b/tests/src/spectral/test-awhitening.c
@@ -41,9 +41,11 @@
   if (!o) { err = 1; goto beach_sink; }
 
   aubio_pvoc_t *pv = new_aubio_pvoc(win_size, hop_size);
+  if (!pv) { err = 1; goto beach_pvoc; }
 
   aubio_spectral_whitening_t *awhitening =
     new_aubio_spectral_whitening (win_size, hop_size, samplerate);
+  if (!awhitening) { err = 1; goto beach_awhitening; }
 
   aubio_spectral_whitening_set_relax_time(awhitening, 20.);
   fvec_set_all(scale, 3.);
@@ -71,11 +73,18 @@
       n_frames, samplerate, n_frames / hop_size,
       source_path, sink_path);
 
+  del_aubio_spectral_whitening(awhitening);
+beach_awhitening:
+  del_aubio_pvoc(pv);
+beach_pvoc:
   del_aubio_sink(o);
 beach_sink:
   del_aubio_source(i);
 beach_source:
   del_fvec(vec);
+  del_fvec(out);
+  del_fvec(scale);
+  del_cvec(fftgrain);
 beach_fvec:
   return err;
 }
--- a/tests/src/test-mathutils.c
+++ b/tests/src/test-mathutils.c
@@ -100,6 +100,7 @@
   window = new_fvec(window_size);
   fvec_set_window(window, "rectangle");
   fvec_print(window);
+  del_fvec(window);
 
   window_size /= 2.;
   window = new_aubio_window("parzen", window_size);