Hi, first post here, so I hop I won’t do anything wrong and if I do, please just tell me… (and english as a second language, so i try to explain what I have in mind…)
So, I’m trying to visualise sound in a grid, by changing the size of squares according to the bass, treble and mids levels. This works so far, but of course it always just shows me the current level in all fields of the grid.
but what i want to to, is basically divide the song in as many steps as I have fields in the grid and get the level for every of these steps. But I’m completely lost, I don’t even know what to search for and if anyone could point me in a direction I would be super glad.
This is the code I used to draw the fields:
function draw() {
background(0);
var spectrum = fft.analyze();
var bass = fft.getEnergy("bass");
var treble = fft.getEnergy("treble");
var mid = fft.getEnergy("mid");
for (var x = 0; x <= width; x += width/10) {
for (var y = 0; y <= height; y += height/10) {
//BASS
var bassAmp = map(bass, 0, 512, 0, width/10);
noFill();
stroke(255);
rect(x,y,bassAmp,bassAmp);
//TREBLE
var trebleAmp = map(treble, 0, 512, 0, width/10);
noFill();
stroke(255);
rect(x,y,trebleAmp,trebleAmp);
//MID
var midAmp = map(mid, 0, 512, 0, width/10);
noFill();
stroke(255);
rect(x,y,midAmp,midAmp);
}
}