I have an mp3 audio file and I want to get the same picture as below.
In reality I'm not interested in doing a plot but just in having this data format and do some manipulation on it.
The code I have so far is this:
var fft;
var mySound;
var width;
function preload() {
mySound = loadSound('applause.mp3');
}
function setup() {
createCanvas(600, 350);
mySound.play();
fft = new p5.FFT();
}
function draw() {
background(200);
var spectrum = fft.analyze();
beginShape();
for (var i = 0; i< spectrum.length; i++) {
ellipse(i, map(mySound.currentTime(), 0, mySound.duration(), 50, 250), spectrum[i]*0.3, spectrum[i]*0.3 );
}
endShape();
}
Answers
What code have you got so far? What does your data look like?
I have an mp3 audio file and I want to get the same picture as below. In reality I'm not interested in doing a plot but just in having this data format and do some manipulation on it. The code I have so far is this: