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();
}
Since it's really my first time trying to make sound with P, I really don't know what I'm doing. I just copied some code from the example files (those in bold), but the error I get is the following:
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!
Basically, I want to learn this (pretty new). I have 18 yo, and I'm about to enter the university. I'm debating myself with if I should study computer eng. or software eng. or digital arts.
What I mean, do I need to study deep engineering stuff (at the uni), or can I learn all of this by myself (and some courses and books, of course). Also wanting to learn MAX/MSP, PD, and all those cool programming stuff (oriented to the arts).