Forums > MaxMSP

Buffer and UMenu SOS Help!

March 29, 2013 | 8:27 am

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.

Attachments:
  1. Untitled1.maxpat

March 29, 2013 | 10:54 am

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


March 29, 2013 | 1:16 pm

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

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

– Pasted Max Patch, click to expand. –

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).

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! :)

– Pasted Max Patch, click to expand. –

Hope this helps!


March 29, 2013 | 1:49 pm

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.)


March 29, 2013 | 1:53 pm

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 :( )


March 29, 2013 | 2:07 pm

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.


March 29, 2013 | 2:09 pm

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


March 29, 2013 | 2:13 pm

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 :(


March 29, 2013 | 2:29 pm

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].


March 29, 2013 | 3:58 pm

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:

– Pasted Max Patch, click to expand. –

See the AKG 414 for a working example.


March 29, 2013 | 7:20 pm

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…)


March 29, 2013 | 7:53 pm

Tried to append…not working :(

Attachments:
  1. Untitled4.maxpat

March 29, 2013 | 9:08 pm

sprintf or combine should get you there.

– Pasted Max Patch, click to expand. –

March 29, 2013 | 9:48 pm

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)


March 30, 2013 | 12:15 am

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

– Pasted Max Patch, click to expand. –

March 30, 2013 | 10:12 am

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?


March 30, 2013 | 10:28 am

NOW ITS WORKING!!!

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

THANK YOU SOOOOOO MUCH GUYS!!!!


Viewing 17 posts - 1 through 17 (of 17 total)