Using sprintf or alternative to continuously change file name

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

The following patch isn't anything much, but it's the most basic form of what I'm trying to do. It basically works the way I want it too, and I think I know how to make it automated and go in a loop, to keep recording and save a .wav file every time it's triggered.

But I don't want the file to be overwritten, and want to get multiple files. Something like soundbite1.wav, soundbite2.wav

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

I think sprintf can do what I want for that, but I don't understand how to do it.

This patch appears to show how it's done, but I can't get it working the way I want it to or understand it either.

If anyone can just explain how sprintf can be used to create a new .wav file every time it's triggered, I would greatly appreciate it.

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

Something like the following patch should get you back on track. The important part is the %03ld which specifies an integer with up to three padded zeros.

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

Maybe this?