Minim.js, I have Sound but no graphics !

edited April 2014 in JavaScript Mode

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);


  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);;


void draw()
  y = 0;

  for (int i = 0; i < num; i++) {

    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);
    line(x, height/2+m, x+1, height/2+m);

    // fill(0);
    //point(x, height/2+(m*8));


and here is the web page with it :

If someone can help please ! Thanks a lot.



  • 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 in minim.js doesn't show the get() 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.

Sign In or Register to comment.