Forums > MaxMSP

Add to the "filepath" without using the "opendialog" object? Possible?

Feb 06 2013 | 4:28 am

Hi all,
Im very new to Max and am having trouble making this work. Im hoping somebody can help.

Im trying to build an drum sampler sound-bank LOADER.
The directory structure is as following:
Folder: ALL_MY_DRUMS inside ALL_MY_DRUMS are Banks 1,2,3
Inside Bank 1,2,3, are folders labeled KICK, SNARE, HAT. Finally inside them are the samples.

So in my patch heres whats going on:
[working] #1. I choose the Default drum sample directory (ex. Desktop/ALL_MY_DRUMS)
[working] #2. I choose a sample library (ex. Bank1)
[not-working] #3. I need the patch to AUTOMATICALY add (ex. KICK) to the filepath that #2 generated without me physically clicking and selecting the KICK directory with the "opendialog" object.

I’ve been trying this all day but cant make it work.
Could somebody help out?

-- Pasted Max Patch, click to expand. --

Feb 07 2013 | 12:51 am

Thanks Nicolas, thats what i was looking for. I got it working as i want it, however i have one problem im not sure if i should worry about…
Its quite hard to explain. Hope you can follow. I attached the updated patch.

At first glance you can see the filepath in the text message reads (Macintosh:/Users/m0dit/Desktop/TestDRUM_library/bank2)
I than begin at the top and choose the sample-library directory, in this case Bank1. (or vice-versa)

As soon as i click Open, the filepath text message changes as it should to (Macintosh:/Users/m0dit/Desktop/TestDRUM_library/bank1) However, looking at the Max Event Window it still prints (Macintosh:/Users/m0dit/Desktop/TestDRUM_library/bank2) until i press the "button" object or the filepath text message.
So it looks like it needs 2 clicks to send the correct info. Is there somethings wrong with my code?

I tried to add 2 "button" objects one after another to send 2 bangs but this does not make any difference…
Why is it doing this? Should i worry about it?

Thanks once again!

-- Pasted Max Patch, click to expand. --

Feb 07 2013 | 4:18 am

i think you’ve just got too many cables going to the wrong places– try this:

-- Pasted Max Patch, click to expand. --

Feb 08 2013 | 3:02 am

Once again thank you Nicolas. This way is definitely easier/ much cleaner. Wish i could have figured it out my self!

I have a final question in regard to playing the files. I cant get it to find the files….
I’ve looked at the help/reference of "umenu" and it shows that it needs a "message" with a prefix & path.

How can i Retrieve the path after its been passed through the "patcher" (ex. prefix Macintosh:/Users/m0dit/Desktop/TestDRUM_library/bank2/SNARE) to put into a message?

-- Pasted Max Patch, click to expand. --

Feb 09 2013 | 1:27 am

I tried it maybe 100 times, it cant find the file. It doesn’t have a path, just the file name.
When i click on a menu item the Max Event window prints: sfplay~ can’t find file WHATEVER.wav
Clicking on the Play button of the playbar prints: sfplay~ no open file

Feb 10 2013 | 1:25 am


I tried the latest patch you pasted. It does work, but only partly. :(
Once the menu is populated the file wont play until i press on the menu and select an item, this is not the big problem however….

The big problem is that once i add a second menu with a second patcher (i change the inside of the patcher) i get an error like this:
sfplay~ cant find file Macintosh:/Users/m0dit/Desktop/TestDRUM_library/bank2/ KICK/Sidestick Deez.wav

But "Sidestick Deez.wav" is not in the KICK directory. Its a SNARE directory file…..
So the path is working ok. But for some reason its looking for the first menu files. I really dont understand it.
I uploaded the patch.

-- Pasted Max Patch, click to expand. --

Feb 11 2013 | 2:12 am


The KICK and SNARE problem that i described (i don’t think you understood exactly what i was saying) BUT somehow miraculously, i re-opened Max + the patch and it worked. I did not edit anything. Not sure what happened there. And the [trigger] works! Thank you!

However, now gotten to this point a new problem/query has come up.
I know previously i said that this was going to be it, but i need your help again! I’m almost embarrassed to ask. You’ve helped me so much. :)

Ok. ultimately i want to play the KICK, SNARE, HAT etc on a midi keyboard. (each on their own keys) I’ve set up midi. It works. It plays which ever sample i select. One at a time. And the sample spans out on 127 keys.

What i cant figure out is…….. How do i assign a note position (ex. C3 – integer 60) JUST for the SNARE. Then assign a different note(ex. D3) just for the HIHAT patcher/menu.

I was thinking to use the [noteout] object and specify channel, velocity and Pitch BUT [noteout] does not have a Output data slot.
Also i tried taking a [number] object with the value 60 and plugging it in before the menu. But of-course it does not work. It doesn’t understand midi, i don’t think. So, im stuck. I searched everywhere!, i cant find anything specifically about this.
Could you shed some light please?

Feb 13 2013 | 3:38 am


Before i only really searched through google, i didnt use this sites search. Theres definitely alot more results on here.

I’ve checked out the objects. [groove~] and [wave~] are really buffer-based so there not much of use to me, i dont think (have i missed something?) [poly~] is a good and quite confusing object! But I dont really think its necessary in this case….

I found a couple sampler threads and they use the [route] object. This seems a good way to go. I’ve incorporated [route], it works in terms of what midi key plays the sample. But all the threads i’ve found use a buffer and open 1 file at a time. They dont use [umenu].
When i link [route] to a [umenu] every time i press the midi key it plays the next sample (it goes through ALL of the samples without me selecting). I’ve checked the help/ref files and it doesn’t mention anything about this.
Is there another object to help? I dont really understand why its doing this….


Feb 13 2013 | 4:11 pm

Send the output bangs from [route] or [select] (you can use either in this case) into message boxes which contain the corresponding [umenu] file choices, numbered starting at 0. example:

[notein] –> [select 60] –> message box with "2" –> umenu

this will make midi note Middle C select the *third* entry in the umenu (counting 0, 1, 2)

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

Forums > MaxMSP