Buffer and UMenu SOS Help!

snaper's icon

Hy,

I need some SOS help, Im stuck :(

I have a UMenu with a prefix folder, where are audio files.
The audio files after selecting them will be loaded into a buffer. Everything works fine, except that I would like to use the files withoutthe .WAV extension.
If I remove the extension from the file, the buffer object can't load them (cause it thinks they aren't wav files).

My question is that how to add the an extension to the the file, after reading the patch and filename from UMenu.

5322.Untitled1.maxpat
Max Patch
snaper's icon

Maybe I wasn't clear enough.
I want visible the filename without the extension.

laonikoss's icon

Are you on Mac or on Windows? And which version of Max are you using?

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

Here's a solution that works on Mac (Max 5.1.8 and later):

I had a folder in which half the files had an .aif extension, and the other half didn't have an extension at all. When loaded on the [umenu] it was possible to load all the files on the [buffer~] normally, no problems (even the ones without extension).

If you're on windows, though, you might have problems, as windows relies on extensions to recognise filetypes and this may affect Max/MSP (pure assumptions, though, because I've never worked Max on windows).

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

If this is the case, then this might be a solution: essentially you leave ALL the files in your folder WITH their extensions (assuming all files are .wav files). The patch below removes the extension from the filename before populating [umenu] so that it looks neat, and when you select the file from [umenu] it puts the extension back so that it's possible to load them onto [buffer~]. I'm sure there's an easier way to do this (I'm only starting to learn [regexp]) so I'd be happy if someone offered a more elegant solution! :)

Hope this helps!

snaper's icon

Im on booth :(

Is it possible to add the extension after loading? (Or during loading)

If I removes the extensions its OK (the patch works, thank you sooo much), but there will be still wave files inside the folder. I want load files without extension, then add the extension to them :(
(I want to hide the file-types from the endusers.)

snaper's icon

So.

There will be a UMenu, where users can select the cabinet IR-s.
But, AMPEX.WAV looks sht, that is the reason why I wants to remove the extension from the file, then load the folder into the UMenu, then load each file into a buffer (not every file in the same time, just the selected one).
And during this liading, I would like to add somehow the extension to the file.

Is it possible with a banged filetype message to the buffer? When loading, band with the WAV type message? (Its not working anyway :( )

laonikoss's icon

Did you try the first example? On Mac if you remove the extensions from the files in the folder, you can still load the files without extensions and it works fine.

snaper's icon

OK, now I see, that part to might help me.
How to avoid dropfile? I've a fixed folder....

snaper's icon

Yeah, tried, but the device should work under windows too :(

In the other hands, is there any way to modify the second patch?
What if I know that every file is WAV, so I dont need to store the extension :(

laonikoss's icon

Did you try the patch on windows and it didn't work? (I don't know if it works on windows because I don't have windows.)

Also, on the second example, the files on the computer have the extension, but when they are loaded on [umenu] they have no extensions as menu objects. So, on the Max/MSP patch it will not look "like shit" - why does it matter if the files themselves have or don't have the extension on the computer?

You might also want to look into the following objects: [sprintf], [regexp], [append] and [folder].

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

If I understand correctly, you could also use two Umenus, one like you already have and then another with the full sample names (hidden from the user). Like this:

See the AKG 414 for a working example.

snaper's icon

Laonikoss :

Sorry, I wont be rude or something like this.

The deal is that this device should be an "IR based colorization unit" :D with lot of IR files. I wont allow users to see that the files in the IR folder are actually WAV files.

Mark :

The problem with your idea is that if I load the patch in different platform, the order of the files could be different.

There must be a way to add extensions to the loaded files, but can't find it in the manual :(
(Or declare somehow the filetype for the buffer...)

snaper's icon

Tried to append...not working :(

5327.Untitled4.maxpat
Max Patch
Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

sprintf or combine should get you there.

snaper's icon

Oh, Thank you very much!!!

My last question. This is really really the last one.
How can I set the path of my folder.

Now this is the path :

DRIVE/PATCH/IRFOLDER

Is there any way to set it like this is the patch :

/IRFOLDER

(The folder will be in the sam folder like the patch)

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

sprintf to the rescue again. Put this in your top level patch:

snaper's icon

Thank you very much!
The only problem with this that if I save your patch into the folder, it shows me the full path, like "DRIVE/etc/etc/"

If I put this into my patch, it shos only : /IRFOLDER

Why?

snaper's icon

NOW ITS WORKING!!!

I forget to mention that I used a sub-patcher window!!!!

THANK YOU SOOOOOO MUCH GUYS!!!!