Problems with OpenGl (probably only with my brain)

Paul Riker's icon

Hi,

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.

My thanks,

Paul

Thijs Koerselman's icon

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

Andrew Benson's icon

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:

Max Patch
Copy patch and select New From Clipboard in Max.

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

Paul Riker's icon

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,

Paul

Andrew Benson's icon

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

f's icon

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

#|
fredrikolofsson.com klippav.org musicalfieldsforever.com
|#

grg's icon
Paul Riker's icon

Thanks! Your advice is greatly appreciated.

Best,

P