Following this tutorial, I tried to reproduce it in React JS to get an audio visualizer as in picture below.
Here is my try, for this project I used react-p5
and p5.sound
:
import Sketch from 'react-p5';
import 'p5/lib/addons/p5.sound';
Looking at the official repo documentation, everything seems correct to me:
this.fft = new window.p5.FFT();
var wave = this.fft.waveform();
console.log('wave ', wave);
So why my variable wave
returns in console an array of 1024 elements of the same value (0.0039215686274509665
)?