readfolder message problem with polybuffer~

Matthieu Pernaud's icon

Hi,

so I have that 12 slots sampler working quite ok: sampling, playing sounds perfectly.

My only problem is when I use writetofolder and readfolder:

let me explain: that sampler is the engine powering a 4 x 3 midi carpet. You record 12 samples, then you can replay them walking on the carpet.

WHen I save a samples set with writetofolder, the files are stored in a folder with no problem at all, but when I reload them with "readfolder", they're loaded but in the opposite order of what I want: Instead of having my samples from 1 to 12 assigned to my carpet slots 1 to 12, they're loaded from 12 to 1.

I've noticed that clearing twice the polybuffer~ could improve that, but it's still very random... and I need it to be perfect.

any advice ?

Matthieu Pernaud's icon

here is my messy patch, if it can help

5221.tapisrecres.maxpat
Max Patch
Emmanuel Jourdan's icon

Thanks for the example. The problem is that the polybuffer~ gets the name ordered alphabetically so tapis.1.aif is followed by tapis.11.aif, not tapis.2.aif. I attached a way to fix it in the patcher by loading each file individually in the alpha numerical order.

5231.5221.tapisrecres.maxpat
Max Patch
Matthieu Pernaud's icon

ok thanks a lot !

so I guess if I rename my buffer like this: 01, 02, 03, and so on, it will fix the problem as well ? am I wrong ?

Thanks for the trick !

Emmanuel Jourdan's icon

You're correct, but writefolder doesn't write the files with this format. It might actually be easier to save the files directly in the correct format.

Matthieu Pernaud's icon

oh ok I get it.
crazy you need to make such a subpatch just to get the files in the right order... max/msp is really disappointing sometimes, especially when you're more a musician than a programmer.