Problems with OpenGl (probably only with my brain)
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 http://www.sharp9.com/DL/Effluvium.zip
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.
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.
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.
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:
Thanks again for your help,
Try removing the number boxes,trigger buttons, and snapshot~ objects
that aren’t necessary.
This will probably give you a good performance boost.
and replace those 32 send~/receive~ pairs with plain send/receive.
here that alone almost doubled the framerate.
fredrikolofsson.com klippav.org musicalfieldsforever.com
Thanks! Your advice is greatly appreciated.