Skip to content

Commit

Permalink
Correct reference to wrong input array length
Browse files Browse the repository at this point in the history
Leads to an assertion error when the input audio length is not also a power of 2
  • Loading branch information
tristanbay authored and kevinstadler committed Jun 22, 2024
1 parent 23108c9 commit 26e6146
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/processing/sound/FFT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.:
Expand Down

0 comments on commit 26e6146

Please sign in to comment.