Looking for help in performance

Dec 18, 2012 at 12:49am

Looking for help in performance

Hello everybody,

I’m working on a patch to visualize MIDI notes received from outside Max.
This is what I did:

– Pasted Max Patch, click to expand. –

It uses cycle~ and jit.poke~ to generate a nice “wobblying” mask for vertical bars generated with jit.fill

It works pretty well, but I think it’s quite CPU-heavy. If I try to set up a “multichannel” version, in which the MIDI section of the patch goes into a poly~ object and every MIDI channel generates different colors, I notice a dramatic framerate drop with three or four active MIDI channels, so it reduces its potentiality for my purposes.
So I was guessing if there was a more efficient way to obtain this visual effect, for example generating the “spectrogram” in pure Jitter, without the need to use fft, or if there is some bottleneck in the “MIDI to jit.fill” part, which I don’t see.

Any help is appreciated

#65731
Dec 18, 2012 at 10:30am

I tried your patch but [p spectrogram] isn’t outputting anything. One possibility though: make sure you don’t have graphic objects updating in realtime in your poly, including jit.pwindow’s. That’s a classic framerate hog. See also http://cycling74.com/forums/topic.php?id=44165

#236796
Dec 18, 2012 at 12:26pm

dtr, thanks for the reply. The jit.pwindow’s you see in this patch are only for clarity’s sake here int the forum.
But you pointed out a most likely issue: I’m using multisliders in order to convert the MIDI notes in a jit.fill-savy form.
Here’s the MIDI part of the patch, I put some message boxes to show the format needed by jit.fill:

– Pasted Max Patch, click to expand. –

Can I format the messages in that way, avoiding multisliders?

P.S.
@dtr, I tried again the patch I posted, and I can see the [p spectrogram] output… do you see any errors in Max Window?

#236797
Dec 18, 2012 at 12:44pm

> @dtr, I tried again the patch I posted, and I can see the [p spectrogram] output… do you see any errors in Max Window?

Strange, it didn’t work on my macbook pro but it works on my desktop. Perhaps my audio settings were conflicting.

> Can I format the messages in that way, avoiding multisliders?

Why not send setcell messages directly to jit.matrix bars, bypassing the jit.fills altogether?

#236798
Dec 18, 2012 at 2:00pm

that was really simple! Here’s the re-arranged patch:

– Pasted Max Patch, click to expand. –

But now there’s a new problem: when I play any note, a bar appears at the beginning of the jit.pwindow… I can’t understand from where it is generated.
Scratching my head…

#236799
Dec 18, 2012 at 2:32pm

I don’t see any superfluous bars.

I do see that you don’t need to bang barsresampled. It will already output automatically when it receives the bars matrix.

#236800
Dec 18, 2012 at 3:26pm

All right, the last correction needed was to set the bars matrix size to 128, not 127.
Now I don’t see any superfluous bar, either!

Thanks dtr for your suggestions! Now I’ll test this patch in a poly~ and hope for better performances!

#236801

You must be logged in to reply to this topic.