p5.js-sound icon indicating copy to clipboard operation
p5.js-sound copied to clipboard

Odd behaviour using low bin count for fft.waveforms

Open paulcanning opened this issue 4 years ago • 1 comments

I am messing about with FFT and drawing a line for the waveform data.

Using the sample code, I changed the number of bins to 16, the lowest setting. And it displays this odd behaviour, despite using map() to adjust the coords.

Screenshot 2021-03-14 at 15 19 41

Why does it suddenly "step" like that?

CODE

    beginShape();
    for (let i = 0; i < waveform.length; i++){
      let x = map(i, 0, waveform.length, 0, width);
      let y = map(waveform[i], -1, 1, 0, height);
      vertex(x, y);
    }
    endShape();

paulcanning avatar Mar 14 '21 15:03 paulcanning

@paulcanning https://editor.p5js.org/ajaymati1000/sketches/FueE4hqMj works fine for me. Or am I missing something?

Ajaya1000 avatar Apr 14 '21 05:04 Ajaya1000