Playing sound with Minim
in
Contributed Library Questions
•
3 months ago
So I'm trying to play a sound with the Minim library. I've downloaded the lib from the web, not using the one from Processing.
This is my code (most of it is just some simple visuals which work nice, but I can't get the sound :(
- Minim minim;
- AudioPlayer player;
- float w=4;
- float a=0;
- PImage gin;
- float p=180;
- void setup()
- {
- minim = new Minim(this);
- player = minim.loadFile("l1.WAV");
- size(777,777);
- background(0);
- smooth();
- gin = loadImage("gin.jpg");
- }
- void draw()
- {
- stroke(255);
- strokeWeight(1);
- if (!mousePressed)
- {
- background(0);
- imageMode(CENTER);
- tint(255,p);
- if (mouseY > 400)
- {
- p=p-0.5;
- }
- else
- {
- p=p+0.5;
- }
- image(gin,400,400);
- stroke(random(255));
- line(400,400,mouseX,mouseY);
- if (mouseY < height/2)
- {
- player.play();
- strokeWeight(random(1,7));
- stroke(random(1,128),0,255,random(0,128));
- line(800,0,random(800),random(800));
- line(800,0,random(800),random(800));
- line(800,0,random(800),random(800));
- line(800,0,random(800),random(800));
- line(800,0,random(800),random(800));
- line(800,0,random(800),random(800));
- line(800,0,random(800),random(800));
- line(800,0,random(800),random(800));
- a=0;
- }
- else
- {
- strokeWeight(random(1,7));
- stroke(255,0,random(0,128),random(0,128));
- line(0,800,random(800),random(800));
- line(0,800,random(800),random(800));
- line(0,800,random(800),random(800));
- line(0,800,random(800),random(800));
- line(0,800,random(800),random(800));
- line(0,800,random(800),random(800));
- line(0,800,random(800),random(800));
- line(0,800,random(800),random(800));
- }
- }
- else
- {
- strokeWeight(abs(mouseY-pmouseY)/4);
- rectMode(CENTER);
- rect(400,400,800,800);
- fill(0,0,0,a);
- a=a+1;
- line(mouseX,mouseY,random(800),random(800));
- line(mouseX,mouseY,random(800),random(800));
- line(mouseX,mouseY,random(800),random(800));
- line(mouseX,mouseY,random(800),random(800));
- line(mouseX,mouseY,random(800),random(800));
- line(mouseX,mouseY,random(800),random(800));
- line(mouseX,mouseY,random(800),random(800));
- line(mouseX,mouseY,random(800),random(800));
- line(mouseX,mouseY,random(800),random(800));
- line(mouseX,mouseY,random(800),random(800));
- /* if (mouseY < height/2 )
- {
- strokeWeight(w);
- stroke(random(255),0,0,255);
- line(400,400,mouseX,mouseY);
- }
- else
- {
- strokeWeight(w);
- stroke(0,0,random(255),255);
- line(400,400,mouseX,mouseY);
- }*/
- }
- p=constrain(p,0,180);
- }
- void stop()
- {
- player.close();
- minim.stop();
- super.stop();
- }
Cannot find a class or type named "Minim"
I'm a noob at this moment, so I don't know how to solve it. Any idea? Thanks!
1