playing multiple audio files from folder

R_Gol's icon

I have a few folders (each on different computer) with audio tracks albums (some containing 5 tracks, some 7 tracks and some more)
I would like to have a patch that can play the tracks within the folder and be able to load all tracks when patch is first opened. how can I do so? using sf-play~ ? or play~ and buffer~ ?

how can I report the numbers of tracks within the folder?


Any examples?
Thanks

Source Audio's icon

example for WAVE and AIFF types.

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

R_Gol's icon

This is great.
What is the simplest way for adding play next, play previous and play/pause buttons?
how can i integrate the playbar object in the patch? or there is better solution?

Source Audio's icon

are you kidding ?
no courage to insert playbar and connect it to sfplay ?
or prev and next messages to umenu ?
If you use playbar, then why do you need pause and resume buttons ?

R_Gol's icon

you right. I manage using prev, next to the unmenu object and pause and resume to the sfplay~ object

Thanks

R_Gol's icon

loading the track names into the unmenu object won't work if I have the patch itself and the cover album in the dame folder. How can I load only the track names and ignoring the max patch itself and the album cover?

Source Audio's icon

What did you do to the patch I posted ?
it had types WAVE and AIFF set, which
makes umenu load only that file types, not maxpat, not apples or sausages

R_Gol's icon

I needed it to work with MP3. I added the MP3 symbol to the prefix message but it is not working. the Audio files itself has no .mp3 at their end

Source Audio's icon

mp3 is compressed file format.
You can add it to the types list, correct syntax is "Mp3 "

you see the space and quotas. because types need 4 chars
but !!!! sfplay can not play it just like that,
all compressed audio format files FIRST GET CONVERTED
to WAVE or AIFF, depending on system,
in max cache folder.
Even worse, files do not get deleted, when not used any more.
So every time you pick mp3 file, it gets converted first.
You end up having both 10 MB mp3 + 100 MB Wave file on disk
instead of only 100 MB wave file.
and it loads much slower because of conversion.
Only object that natively plays mp3 files is playmp3~ made by
Volker Böhm, and is mac only.
--------
In this case it is better to load mp3 files into buffer~
which also converts, but faster and only in RAM.

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



R_Gol's icon

This is working great. Thanks

edit: I tried to add playbar object to control the play~ object in order to play/pause, change file locator in track (jump to different time in track) and change track (next and previous) but it is grayed out. What am I missing?

Source Audio's icon

one can't use playbar for play~.
play, pause, next - previous - that has nothing to do with playbar.

R_Gol's icon

I try the patch with sfplay~ but the patch is crashing when try to use the playbar(edit: when pressing forward or previous arrows of the playbar). What I'm doing wrong?

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

R_Gol's icon

regarding the play~ object - there is no gui for play/pause ?

Roman Thilenius's icon

you can make up one yourself using the "pause" and "resume" messages.

Source Audio's icon

that patch is full of uncontrolled messages causing feedback loops etc.
that is why it crashes.
You managed to remove simple next prev messages,
inserted unneeded counter etc etc
why this ?
all that send and receive objects in such small patch ?
--------
I repaired your patch, I hope you will undersand the difference.

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


but for mp3 fles you should use buffer based approach,
unless you don't mind all that convrsions and bloating of disk space...
--------
what do you mean with GUI ?
a button that shows pause / resume ?

play~ has no position outlet.
you will need different object for that.
I would then prefer groove~ or similar.
If I get time later today , I'll post one example


Source Audio's icon

here is something similar using groove~

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

R_Gol's icon

wow...! your groove example is just great!! thank you very much

what do you mean with GUI ?
a button that shows pause / resume ?

Yes, as you did in the groove example

Source Audio's icon

Buttons in that groove patch do not reflect playing state.
That makes it is easy.

R_Gol's icon

I repaired your patch, I hope you will undersand the difference.

when using sfplay~ patch is still crashing when try to manual change tracks (pressing the forward and backward arrows at the playbar)

Source Audio's icon

I have no crashes at all.
but I used only wave and aiff files as intended.
and did not change anything in that patch


R_Gol's icon

I tried with wav album now and it is not crashing but when pressing backwards it just start the same track from the beginning rather play the previous one and when pressing forward it will skip one track and play the next one after

edit:
see printing at the right hand of screen marked in orange: this what printed when pressing forward arrow

R_Gol's icon

I have noticed that this bug is happening only when the auto next is On, otherwise no issue with pressing backwards and forwards

R_Gol's icon

ok, I think I fixed it as follow:

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

Source Audio's icon

you can use simpler fix

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

it stops play done bang after manual next or prev