ref: ed80243aefbb12d789fde6fb1bb4312c3d92867b
parent: d726526738c6c9f0dac04d673ec77e64695f9af8
author: Paul Brossier <piem@piem.org>
date: Thu Dec 6 08:17:47 EST 2018
[awhitening] use shortest length available (closes gh-216)
--- 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];