Draw a moving playhead over a waveform

gavspav's icon

I've drawn a waveform in a gl window using a patch I found here on the forums.

The waveform represents a buffer which I am playing using groove~

What I would like to do is draw a moving playhead over this waveform.

Here's my first attempt but noob alert - it ain't pretty!

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

Can anyone point me in the right direction for a cheap solution?

Exit Only's icon

cant see the patch at the moment, but did you try the line $1 message?

I would take the sync output of groove~ into snapshot, multiply it by the 'total time' output of info~ and then into a 'line $1' message ->waveform~

gavspav's icon

Hmm waveform~ draws to the patcher window. You can't display it in a GL context can you?

My patch is basically what you describe but using linesegment and ji.gl.sketch.

But the results are rubbish!

Exit Only's icon

ah i see. i missed the gl part. :

gavspav's icon

Next attempt. Getting closer now but I could still use some help!

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

It uses the patch from the following thread.Thanks Graham
https://cycling74.com/forums/jit-gl-graph-for-a-waveform-display

seejayjames's icon
Max Patch
Copy patch and select New From Clipboard in Max.

closer, a few changes, but still the main issue remains :/

gavspav's icon

Think I must have been losing the plot when I posted this.

Drawing a playhead marker is alot simpler than this - just using jit.gl.sketch and a variable position does the trick.