Polybuffer~ issue : files can't be found (@embed 1)

coralie's icon

Hi,
A similar question has been asked before, but I am running through a different problem with [polybuffer~].
I am using 4 of them. The "readfolder" message, followed by the search path, doesn't seem to work. I have consequently used the @embed 1 attribute to have my folders stored at start up.
This works for 2 of my folders. Not for the two others.
I have tried to test this option with a new patch that contains only one [polybuffer~]. I have the same issue.
The console displays the following error message: Max can't find each of the sound files in the folder.
I probably saved my first patch several times and added more [polybuffers~] progressively, but I can't explain what's wrong.
Does anyone have an idea?

Thanks!

Source Audio's icon

is there anything in the name of the folders that breaks the path ?
You can test that first simply using dropfile,
drop the folder and look at the output.
If that is working as expected, then I would rather remove
embeding and store path to folders in a text file
which anyway makes more sense if patch gets used on other machines
having different paths etc

coralie's icon

Hi,
Thanks a lot. Your answer was helpful. But this is still a mystery to me.
The "readfolder + path" message works if I apply your method (using the path from the dropfile object). BUT, I get the following error message when I JUST replace the name of the folder by another name in the path, by typing the name. If I use dropfile again to copy paste the file path, then, Oh, miracle, it works (and I don't think "toto" is a very complex folder name. No typo involved).
Previously, I either got "couldn't find file" reopening the patch with a [polybuffer~] and an "@embed 1" attribute, or "toto" is not a folder using the "readfolder" message and an absolute path (the folder I tested that option was named "toto".
My file names were written with the following syntax: 01_A_FileName_0.wav 01_1_FileName_1.wav etc.
In one case, they were properly reloaded, in another they were not. The folders were named BLABLA1, BLABLA2...
Out of 4 folders, I had no issue reloading 2 folders, and issues with 2 others. All names were formatted exactly the same.
I had used dropfile before, and the folders were loaded properly. So there doesn't seem to be any issue with the folder or file names.
I have used [dropfile] to find the absolute path, copy paste it. I have removed all _s but I haven't removed spaces. My files have been correctly loaded and they could be loaded automatically at start up.

So, although I have no clue about why it didn't work, now it seems too. I now need to find the correct relative path. If ever you have an idea about that, that would help. Although I am used to patching quite a lot, there still are things like file paths that are alien to me. Don't know why.

Thanks!

Source Audio's icon

Relative path to what ?
The patch, or Max app or Standalone ?
There are several ways to get the path of all of that.
here few examples

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

and yes somethings one can't explain why things don't work even that by all logic
they should.
May also be a bug of some kind in polybuffer

coralie's icon

Well, for the moment, a relative path to the patch, and eventually, to a standalone. I'll look into it. I definitely think there is a bug implied.
I have deleted all _ and spaces from the file names, and it seems to work with the embed method. Only, I need to test it from someone else's computer, and then from the standalone.

Source Audio's icon

To work on other computers ...
I would really advice in using absolute path to the patch
or standalone, and combine root path with folder names
to load samples using readfolder message.
That is a safe way which never failed for me.
What one can't have under control is if users make folders
that have slash or colon in the folder name.
Once I had a customer that prepended a space in front of HD name
on Mac.
Max was not able to cope with that, space was removed from max path creation,
resulting in nothing found.

coralie's icon

Hi,
Thanks for the patcher. I am a little confused with the different options that are displayed. I have trouble understanding the difference between the app and the standalone. I'm sorry to ask you to be more specific about it, but my issue is that I am working on a Mac, and my customers use PCs, and need a standalone. I cannot compile a standalone for PC, therefore I am not able to test the PC standalone option. Would you have the kindness to give me more precisions about your patch?
Thank you so much.

Coralie

Source Audio's icon

i'll be glad to help you about that.
How do you plan to deliver software to PC users ?
In fact one could put together windows strandalone on mac ,
it just needs some tools and a bit of knowledge.
---
In the patch I there are different ways of getting path to itself,
while programming in Max it is folder where patch is, in case
of standalone, it is folder where standalone resides.

On windows there are not that many restrictions as on mac,
so one has more freedom where to read or write files.
Do you want the samples to be in the same folder as Application ?
On windows no problem at all.
Windows standalone usually gets compiled into a folder named same as
executable - like Samp-Player, and in that folder
Samp-Player.exe, Samp-Player.mxf file and resources folder is included.
One could use that root folder to load samples.
------

Iain Duncan's icon

Hi Coralie, while not a standalone, I recently did a windows release from my mac for an external, and I highly recommend setting up a windows virtual environment. You can do this with a free copy of windows now, there are various windows images meant specifically for testing software on windows, or you can use a full windows install and not activate, which Microsoft tolerates for testing. I did not hit any issues doing that. I used Parallels, which is a paid product and is apparently the best working host on Mac, with very easy sharing between the windows and mac operating systems, but you can also use free hosts such as VMWare. hope that helps.

iain

coralie's icon

Hi Source Audio,
The standalone will be integrated in a simulation environment for medical use. The data will come from a server using nodes.js. Responding to this data, the standalone will do its job (play sound files, interact with the user with a sound synthesis engine.
So we have a global program which is quite powerful, into which the standalone is integrated. No direct interaction will occur with it. Everything goes through the simulation program.

I will have 4 sound files folders embedded in the main folder from which the standalone will be compiled.
If I deliver the root folder and the patch that includes the module that will generate the path to load the sound files, they can compile the standalone.
I guess I need to know how to name the folders correctly.

I Iain,
Thanks for your advice. I am pressed with time, so right now I cannot set this solution, but it will certainly be useful to me later.

Source Audio's icon

post the 4 folder names, and amount of samples that will be in the folders.
Also audio file type, wave, or something else .
I will make loader patch for the files if you want.
I have a question : is buffer based playback really needed ?
Could you also go with sfplay and preloaded list of samples ?

Source Audio's icon

P.S. I have mac and windows here ,so making a test for you would be easy

coralie's icon

Well, that's why I'm running into so much trouble: I chose polybuffer~vs. playlist or sfplay to save CPU. I wouldn't have had so much trouble otherwise. But in fine, with a standalone, I am not even sure it's worth it. I could easily program another module with sfplay. But I need to be done today, and only have 1 or 2 hours of work ahead. Still, if it doesn't work, that will be my option.

So: The folder names are PATIENT01, PATIENT02, INTERNE01, INTERNE02.
PATIENT01 and 02 contain 50 wav files
INTERNE01 and 02 contain 97 wav files

Thanks a lot!



coralie's icon

I would name the executable "AudioSimulation"

Source Audio's icon

try this

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

It must work no matter what system or if it is a patch or standalone
just make sure that thispatcher object is in the root of main patch.
Rest could be inside a subpatcher if needed, like this :

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

I know it makes one a bit nervous when time is tight.
I am anyway sitting in front of Max today, so just post about anything I might do for you

Source Audio's icon

in case you want to switch to sfplay

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

coralie's icon

Hi again,
I have tried your solution, in a small patcher. Unfortunately, I still get the same error message as before, the same as when I used a simple "readfolder" message:
polybuffer~: /PATIENT01 is not a Folder

The buffers remain empty.

I got exactly the same problem before. Note that I haven't compiled the app. I have tried to check what was going on sending a bang to the sprintf objects. The sound folders are in the same folder as the patcher.


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

coralie's icon

Here is the path :
"Macintosh HD:/Users/coraliediatkine/Documents/SOUND IS MORE/CLIENTS_PROJETS/InSimo/Max_Patient/PREINTEGRATION/REVISION/Revision1_250720/"

coralie's icon

Maybe something to do with lower _ ?

Source Audio's icon

this error is because you tried it on not saved patch, or ?


when one makes a patch from the page it is not stored anywhere, and so has no path
Once stored to HD:

it gets the path right

coralie's icon

Oh, it worked. I had deleted the "patient01, patient02.... " message. My mistake. I'll make another try, but it seems fine to me.
I'll let you know, but thank you a 1000 times!

coralie's icon

It worked!

Source Audio's icon

good news, if anything else ...
There is one thing I would add to windows standalone.
If one activates *"Can't close Toplevel Patchers" in standalone inspector
windows standalone can't store selected audio driver settings.
Same if window flags noclose is set to thispatcher.
Solution I found to work is to quit app using sequence :
1- turn dsp off
2- set windowflags close to this patcher
3- quit app using
;
max quit

message
---------
This is patch I use to unlock patch for editing or lock it for compiling.
instead of quitting max using menu or shortcut (which I disable anyway)
I send quit message as you can see here