From 26e6146c3a3f4f3dc266322f14016bf4b14c369b Mon Sep 17 00:00:00 2001 From: tristanbay <85427980+tristanbay@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:16:01 -0700 Subject: [PATCH] Correct reference to wrong input array length Leads to an assertion error when the input audio length is not also a power of 2 --- src/processing/sound/FFT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/processing/sound/FFT.java b/src/processing/sound/FFT.java index beca8ff..0536f3e 100644 --- a/src/processing/sound/FFT.java +++ b/src/processing/sound/FFT.java @@ -136,7 +136,7 @@ public static float[] analyzeSample(float[] sample, int numBands) { // the meat of the matter protected static void calculateMagnitudesFromSample(float[] sample, float[] imaginary, float[] target) { if (FFT.checkNumBands(target.length)) { - FourierMath.transform(1, sample.length, sample, imaginary); + FourierMath.transform(1, target.length, sample, imaginary); FourierMath.calculateMagnitudes(sample, imaginary, target); // there is an argument for multiplying the normalized spectrum amplitude // values by two, see e.g.: