From 1e35340b12588e2245c6fd893bdbf78be50d87c7 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 16 Nov 2025 14:32:13 +0100 Subject: [PATCH] [specdesc] fix definition of rolloff (closes gh-318, thanks to @Polochon-street) We now return at least the first bin, and at most the last bin number, to prevent returning a value greater than the length of the norm vector size. --- src/spectral/statistics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spectral/statistics.c b/src/spectral/statistics.c index 4fd66c00..d3033643 100644 --- a/src/spectral/statistics.c +++ b/src/spectral/statistics.c @@ -199,6 +199,6 @@ aubio_specdesc_rolloff (aubio_specdesc_t *o UNUSED, const cvec_t * spec, rollsum += SQR (spec->norm[j]); j++; } - desc->data[0] = j; + desc->data[0] = MAX (1, j) - 1.0f; } } -- 2.11.0