tape player with pause: sfplay~ or groove~?

k9's icon

i am trying to make a simple "tape" player -- an audio file player that I can pause and resume. I have tried out a few approaches and am a bit stuck, because I found conflicting feature sets in several objects. here is what I want to do:

- loadbang-load 8 samples, each about 3-11 minutes long (buffer~ or sfplay~)
- make sure they have loaded completely, alert the user (me) visually if something went wrong (only buffer~seems to do this)
- play the samples, starting playback manually (groove~, sfplay~)
- pause the samples in arbitrary places (sfplay~ only?)
- resume where I paused. (sfplay~ only?)

Am I right to assume that I am stuck with sfplay~ if I want the pause/resume function? or can I do it with buffer~/groove~?

thank you!
K9

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

May not be the better design because I just start with Max but this seems to work :

k9's icon

wow, I like the "snapshot~" solution for groove~.

Very elegant!

Thank you very much!

k9's icon

again, thanks Stephane, that made the whole thing a bunch easier.

Now I am struggling with a new question. I'd like to press a button that simultaneously toggles resume/pause and jumps back about 1-3 (randomly?) seconds before resume, effectively cheesily scratching the file.

I tried info~, got out the ms length of the file. tried to divide 1.0 (the length of snapshot) by the number I receive), multiply that number by the number of milliseconds I want to subtract from the result of snapshot before I send that to groove~as a resume message.

I tried a lot of different things in the enclosed patch, but simply nothing happens... so I am hoping for some help, please...!

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

Thank you!

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

This one is giving me a hard time ! In fact, I discovered that the 'loop min' inlet on the groove object didn't play any role in my previous patch. I suppose this worked only because when you send [groove~] a '0. ' speed message to stop it and then play again by sending a '1.' message it just starts from the last sampled played. So sorry for the misleading solution, I did it very quickly and didn't take the time to test all.
Here's what I got to work, seems a bit of a hack to me. It probably needs trimming but after a long struggle with that now I feel like diving into the swimming pool, because 96° F is real hot for the shade !
Some comments from wise people ?

k9's icon

Thanks a lot Stephane, I will look into this. I guess I should clean up the patch in order for more people to look at it..;)

Stephane Morisse's icon

A cleaner version with a bit of trimming and more logical layout (that is... to me). Interested in some comments. And random gap (1 to 3 sec) before resuming.

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

`