How to replace "noise" with "music"?

Hi everyone!

I really love sketches like these two:


They are based off the noise function in processing, but I would like to try and change them to work off music files.

Using Minim to play an audio file, I’ve tried swapping “noise” in the line to the output of an audio file, but can’t get the syntax to work- it keeps generating various errors. Here’s what I tried:
Original-
“vertex(x,y-i+ (noise(x*.01, (frameCount*.01), i*.01 )300))"
My attempts-
"vertex(x,y-i+ (player.left.get(x
.01, (frameCount*.01), i*.01 )300))"
"vertex(x,y-i+ (player.bufferSize(x
.01, (frameCount*.01), i*.01 )*300))”

Does anyone know how I can do this, so that the sketch generates similar patterns based on an audio file rather than noise? Or is this simply not possible?

Here’s more of the code from that sketch:

void draw()
{
background(255);
noFill();
stroke(0,100);
for(int i = 0; i < 100; i+=1.5)
{
beginShape();
vertex(0,height);
for(int x = 0; x < width; x+=5)
{
//noise always return a number between 0,1
vertex(x,y-i+ (noise(x*.01, (frameCount*.01), i*.01 )*300));
}
vertex(width, height);
endShape();
}
}

What errors are you getting?

Can you post what you’ve tried, in the form of a MCVE?

Thanks for getting back Kevin.
Here’s what I tried, with the errors that each variation produced.

import ddf.minim.;
import ddf.minim.analysis.
;

Minim minim;
AudioPlayer player;

float y;

void setup()
{
size(1028,500);
y = height/2;
smooth();
minim = new Minim(this);
player = minim.loadFile(“MUSIC FILE.mp3”);
player.play();
}

void draw()
{
background(255);
noFill();
stroke(0,100);

for(int i = 0; i < 100; i+=1.5)
{
beginShape();
vertex(0,height);
for(int x = 0; x < width; x+=5)
{
//this line below produces the error “the function left(float, float, float) does not exist”-
vertex(x,y-i+ (player.left(x*.01, (frameCount*.01), i*.01 )300));
//this line below produces the error “Error on “)””-
//vertex(x,y-i+ (player.bufferSize()(x
.01, (frameCount*.01), i*.01 )*300));
}
vertex(width, height);
endShape();
}
}