let mySound;
let fft;
function preload() {
mySound = loadSound("/sound/sketches/hack-comp.wav");
}
function setup() {
createCanvas(500, 200);
fft = new p5.FFT(0.8, 128);
fft.setInput(mySound);
startButton = createButton("start");
startButton.mousePressed(start);
stopButton = createButton("stop");
stopButton.mousePressed(stop);
}
function start() {
mySound.loop(0, 1, 1, 0, 4);
}
function stop() {
mySound.pause();
}
function draw() {
background(50);
fill(255);
noStroke();