pause/resume for groove~ objects?

shaar's icon

hi,

my understanding is that when it comes to buffer~ based sample playback, it's best to stick with groove~ objects if i want the highest quality audio playback and use a wide range of playback speeds.

i'm trying to come up with a way of adding pause/resume to groove~, instead of the standard "startloop" and "stop" messages. so that instead of re-starting at the beginning of the sample after being paused, it continues where it was.

i'm guessing it can be done by somehow saving the playback position of where it was in the file when i hit pause, and then feeding that number to groove~'s first input when i hit resume?

i'd want the loop start and end points to stay the same. let's say i have a 60 second sample, and i'm looping from 10 seconds in that file to 30 seconds in that file. if i hit pause in the middle of that loop, so at playback position 20 seconds from file start, i'd need to feed that info back to groove.

has anyone done this?

thanks very much for any suggestions!

commathe's icon

Try using the sync output on groove~ (the one on the right). If you store the value its at when it stops and then scale that, you should be able to get it to resume playing where you wanted it. I've never tried this, but I think this will probably be the key to what you are trying to do.

Chris Muir's icon

What signal are you using to drive the groove~ ? If you set that to 0 groove~ is effectively paused, then setting it back to 1. will start it up where it left off.

brendan mccloskey's icon

Hi
Chris's suggestion is easiest:

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

commathe's idea is also useful, particularly if you are planning to make dynamic changes to the duration of loops.

Read this thread for a discussion of the various methods/objects for variable rate playback of audio files in Max

Brendan

EDIT: added a de-clicking window (oops)

Mr. Banshee's icon

On a similar topic, i was wondering how you can trigger the sample so it starts at the beginning of the sample each time. i'm sure this is easy, but the heat is on way too high here and my brain is melting.

Chris Muir's icon

groove~ takes a float for position. You can start at the top by sending in a 0.

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

i'm still tasting purple and watching the walls melt around me...but i think i did it right:

Mr. Banshee's icon

...and by the way, THANK YOU Chris!

shaar's icon

thank you very much guys! this is really helpful.

brendan and chris, your solution seems perfectly fine. i had a patch like that before, but in my version i couldn't change the playback speed while the player was paused because it would then start again (something involving bangs).

brendan, what problem did you think there might be with making dynamic changes to the length of the loops with this method? it seems to be fine. i can tweak the playback speed and loop start/end times both while playing and while paused.

since really all we're doing is setting the playback speed temporarily to zero, that shouldn't effect loop selection, right?

thanks again

brendan mccloskey's icon

Hi shaar
I guess I was thinking more along the lines of a 'stutter' effect, where the loop is shorter and repeated. This was not mentioned in your OP, so forgive me for clouding the issue (I'm obsessing about granulation and stuttering effects) - glad to hear you got this working ok.

If you are using more 'textured' or pitched soundfiles, with shorter loop sizes (< 500ms eg) you might need to use the sync outlet of [groove~] to apply loop windows to hide the sample discontinuity clicks. That's all. But if what you have is working fine, then......result!

Brendan