Forums > Jitter

Problems with OpenGl (probably only with my brain)

Apr 21 2006 | 4:01 pm


I was hoping someone could help debug my MAx/MSP/Jitter patch…

Thanks for helping! This instument is comprised of 32 sine waves, each of which moves indepentently. The sine waves are all overtones of the lowest sine. I’m trying to represent each overtone (sine wave) with a gl sphere. Each sphere takes x, y, and z values from the same numbers that govern each sine wave’s panning, frequency, and amplitude respectively. I’m really just trying to visually represent what is going on musically. Originally, I was using 32 instances of gl.gridshape. The animation was working well, but my framerate was quite low (~10-15fps) on a very fast machine. With the advice of Andrew, I converted the patch so that it uses only 1 gridshape object in combination with a matrix. I believe I’ve assembled the patch correctly, as I can see my 32 spheres moving (very choppy) through space. However, I must have gotten off track somewhere because now, my whole system bottoms out, with nearly 0fps and frequent crashing. I’ve really tried to debug this thing myself, but I just can’t figure it out. Any thoughts/advice are GREATLY appreciated!

Oh, by the way…Andrew’s patch from Jitter recipes Book 1, patch 1, runs perfectly on this machine…~100fps with 10 dim (10 spheres), ~75fps with 32 dim.

The attached folder contains all patches necessary…the .mxb you’ll want is Instrument1.mxb (and possibly Instrument1-no video.mxb).

If you can’t access the zip file via this posting, please download from

I really do appreciate your help with this…this is my first experience with Max/MSP, and with Jitter…I value your experience and expertise.

My thanks,


Apr 21 2006 | 4:35 pm

Hi Paul, I’ve had a look at your patch (instrument1) but there seems nothing
wrong on my machine. I’m running the patch at 90fps with audio turned on,
and my cpu is at 50% and I don’t even have a really fast computer:-)
(pentium m1.86, nvidia 6800). I suspect there is something else going on
with your system. Sorry I can’t be more helpful.

Best, Thijs

Apr 21 2006 | 5:45 pm

The problem here is that every 10 ms you are sending a massive amount of
setcell messages to your jit.matrix. For this sort of thing, using
jit.poke~ would be the most efficient option. The other possibility
would be to pak all your sphere data into a list and use 3 jit.fill
objects to load your matrix. But since you are working with audio here,
jit.poke~ will be the ideal solution. Here is an example of what one of
your modules would look like:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 215 234 20 196617 z;
#P comment 213 171 20 196617 y;
#P comment 212 105 20 196617 x;
#P newex 233 192 58 196617 cycle~ 0.8;
#P newex 339 197 41 196617 sig~ 0.;
#P newex 233 232 116 196617 jit.poke~ mymatrix 1 2;
#P newex 233 130 52 196617 cycle~ 2.;
#P newex 339 135 41 196617 sig~ 0.;
#P newex 233 170 116 196617 jit.poke~ mymatrix 1 1;
#P newex 232 64 52 196617 cycle~ 1.;
#P newex 338 69 41 196617 sig~ 0.;
#P newex 232 104 116 196617 jit.poke~ mymatrix 1 0;
#P comment 381 70 179 196617 set which ball you are addressing here;
#P connect 9 0 7 0;
#P connect 6 0 4 0;
#P connect 8 0 7 1;
#P connect 5 0 4 1;
#P connect 3 0 1 0;
#P connect 2 0 1 1;
#P window clipboard copycount 13;

Hope that gets you started in the right direction.
Andrew B.

Apr 21 2006 | 8:13 pm

Thanks Andrew,

I incorporated jit.poke~ in place of all of the setcell messages…it works better this way, but I’m still looking at a frame rate of about 10fps, even with only 1 sphere/1 dim…

I’ve updated the zip file here:

(use Instrument1.mxb)

Thanks again for your help,


Apr 21 2006 | 8:30 pm

Hi Paul,
Try removing the number boxes,trigger buttons, and snapshot~ objects
that aren’t necessary.
This will probably give you a good performance boost.

andrew b

Apr 21 2006 | 10:24 pm

and replace those 32 send~/receive~ pairs with plain send/receive.
here that alone almost doubled the framerate.


Apr 22 2006 | 12:04 am

Apr 22 2006 | 1:27 pm

Thanks! Your advice is greatly appreciated.



Viewing 8 posts - 1 through 8 (of 8 total)

Forums > Jitter