We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello i have a web page where there is a procesing code using minim library. The problem is that i have the sound when the page have load, but no graphics, here is the code :
import minim.js;
Minim minim;
AudioPlayer player;
int y;
int x;
int num=1024;
void setup()
{
size(1280, 720,P2D);
background(255);
minim = new Minim(this);
// specify 512 for the length of the sample buffers
// the default buffer size is 1024
player = minim.loadFile("01 Main Title.mp3", 1024);
player.play();
}
void draw()
{
y = 0;
x=0;
for (int i = 0; i < num; i++) {
noStroke();
float son=(player.right.get(i)*100)+(player.left.get(i)*100);
float m = map(son, 0, height, 0, 200);
fill( 20,son*1.5,2,150);
rect(x, height/2, 1, 0-m);
strokeWeight(1);
stroke(255,255,255,150);
line(x, height/2+m, x+1, height/2+m);
// fill(0);
//point(x, height/2+(m*8));
y+=3;
x+=1;
}
}
and here is the web page with it : http://nexus-graphism.com/processingtest02/
If someone can help please ! Thanks a lot.
Comments
I don't think Minim library was converted to JS yet! (~~)
First I'd heard of it, but looks like someone has had a shot (and like @uani says, the sound does work).
Do the visuals work if you remove the sound-related code?
Actually, the error in the JS console on your page says
Uncaught TypeError: Cannot call method 'get' of undefined
, and a quick search inminim.js
doesn't show theget()
function. It looks to me like the Minim API hasn't been fully implemented in JS.Thank you, i'll look after the get(). Or i'll find another library witch is full supported if such a thing exist.
Maybe using HTML5?
http://www.html5rocks.com/en/tutorials/webaudio/games/