jit.gl.graph for a waveform display

BenCello's icon

Hi Jitters !

I'm trying to have something like a waveform display but rendered in a 3D GL environment. I'm using a jit.buffer~ to read a buffer then a jit.gl.graph to render it.
Of course, I'm drastically downsampling (100).
However, I still get a huge number of points to graph because I'm graphing a growing buffer (from 0 to 20 minutes).

My problem is that as soon as I turn the jit.gl.graph on, my CPU jumps to more than 115% (dual core is wonderful ;o) when it was around 35% before.

I can't get why. Is it because of the huge number of points ? Is it because a CPU-expensive option of jit.gl.graph is on ? Is it simply because of the way jit.gl.graph is working ?

Does somebody already tried something like this ?
Do you have an idea for rendering a waveforme in 3D/GL without jit.gl.graph ?

Cheers

oli larkin's icon

hi ben,

>I can't get why. Is it because of the huge number of points

i think so. Maybe you could try graphing 1000ms of the buffer at a time, as it records, and move the drawing position of the jit.gl.graph.

oli

BenCello's icon

Hi Oli ! (nice to hear from you btw)

I thought of that but the display is supposed to give a way to browse in the whole buffer and select some interesting parts of it. Pretty much like waveform~ does but with a lot of additional info already displayed in 3D/OpenGL (mostly with jig.gl.sketch) along a timeline.

So this won't really reach what I would like to achieve...

Thanks anyway I'll keep looking for workarounds.

Cheers

oli larkin's icon

maybe you could try rendering to a texture (if a 2d waveform is acceptable)

oli

Graham Wakefield's icon

Here's how I used to do it, using jitter matrices. Made to be a near-to drop-in replacement for scope~. Course, now I would do it using GL render to texture (on the todo list). But this might be helpful to somebody.

Save as jscope~.maxpat:

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

Save as jscope~.maxhelp:

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

Graham Wakefield's icon

Oh, just realized that you were looking for something more like waveform~ than like scope~. Nevermind!

Graham Wakefield's icon

Maybe this will help, at least to start with. It displays a buffer~ in OpenGL (using jit.gl.mesh).

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

BenCello's icon

Hi !

hehe ;o) I did a scope too years ago now...
But the last patch you posted is very efficient, jit.gl.mesh seems to be a very good way to explore for what I'd like to do.
Thx a bunch
I'll keep you posted !

cheers

BenCello's icon

Hi !

Thank you very much for the visualisation with jit.gl.mesh. I've adapted it to my system and it works perfectly !

It now takes a few CPU % to visualise the buffer on top of my timelime in jitter.

Really Great !
Thank's again

PS : I'm not posting the patch. It's not that I don't want to share it, it's just because it doesn't work alone (without the complex system around) and if I make a "standalone" version of it, I'll get a patch very close to the one already posted. So it won't add anything new !

Tim Canfer's icon

Hi all - the jscope~ is great, has anyone had much success with attempting a jitter spectroscope...?

I only ask cos...

If anyone can help I'd appreciate it...

observer's icon

Hi all have you a method to draw playheads in the graham wakefield patch! i've tried with jit.gl.sketch with no results,

Rob Ramirez's icon

i would start with something like "jit.gl.gridshape @shape plane @transform_reset 2 @scale 0.01 1 0".
it can be animated using, e.g. the normalized position output of groove~ --> scale 0. 1. -1. 1. --> position $1 0 0

observer's icon

Thanks a lot, it's really what i wanted, there's just one problem, when moving the shape sometimes a glitch occurs, but i think there's no way to menage it...
Using more jit.gl.gridshape and different colors we can make multiple playheads, Awesome.

Rob Simmons's icon

Hi,

I know this may be a basic question but how do I change the colour of the visualised wave in Graham Wakefield's patch? I have been trying all the methods I can think of and find but it does not change the colour.

Thanks :)

slo ~|•'s icon

@Rob,

I get a different color for the waveform by changing the @color attribute in the jit.gl.mesh object at the bottom.

Rob Simmons's icon

Hi SLO,
Sorry, should have specified, I meant the jscope patch. I can't seem to get the colour to change reliably. I have used jit.hue but this doesn't work very well and misses out some of the colour spectrum. Is there a more effective way of doing it?

slo ~|•'s icon
Max Patch
Copy patch and select New From Clipboard in Max.

Ah, of course. :-) Graham's jscope~ is outputting a 2 plane matrix while for colour the jit.pwindow (or jit.window) needs 3 planes (RGB) of 4 planes (RGBA). Only one of the planes from jscope seems to have data, so I created 3 channels of it and scaled them to produce different colours.

Rob Simmons's icon

Hi Slo, apologies for the delay. That worked great thanks!

redhexagonal's icon

hey - this is nice to avoid the glitches that waveform~ seems to have when processing a buffer.

But how can I visualise only the first channel of a two channel buffer?

David Castillo's icon

I am a complete novice to all things Max so I apologize in advance for the newbie nature of this post.

I recently saw Graham's oscilloscope in-action through Seth Shafer's wonderful demonstration videos of the Intellijel Shapeshifter (https://youtu.be/jlnj4HwHMlk ) and was impressed by the quality of its waveform display compared to other digital oscilloscopes I've seen. I am wondering if it's possible (and somewhat easy) to translate Graham's code into a Max for Live device?

Any help, or a point in the right direction is appreciated!