demosound.maxpat

kp*'s icon

So max has changed quite a bit since I last used it, and I was never very good in the first place (haha) ... But I am trying to figure out something I came across in the help files.

In the dac help patch there is a little patcher that allows you to select a waveform, noise, or even a sound file for playback. It is an amazing little pea-shooter. It took me forever to find it but you can get to it via the filebrowser & it is called demosound.maxpat

So I made a copy of this to see how it is done. I tried ripping it apart to make it into a patcher I can see, all the objects, the connections. But so much is either hidden or encapsulated that I am just mystified at what the hell I am even looking at.

See, as almost perfect as this thing is, it is a helpful and the sounds it slurps down into it's menu are all the c74 test sounds, /Applications/Max.app/Contents/Resources/C74/media/msp

anton.aif, jongly.aif, vibes-a1.aif, cherokee.aif, rainstick.aif etc.

So you might imagine, what I would love is to make one change and actually use this tight little sound generator in a few of my own patches. I would rather point it to a directory and have it slurp down all those files instead, that is my own sounds rather than the C74 test sounds. I think I already know how to do that .... But I don't see where to plug in. There are lots of interface items and modes I never learned leaving me unable to grok what the demosound patch is doing and where to hotwire it. I am also afraid that, chops being what they are, even if I get it unrolled, I won't be able to get roll it back up that tight again. But considering how messy all my other patches are, I suppose that matters less.

kp*'s icon

here is a slurp down all the files in a directory thing ... though the flaw here is that it will also load non-soundfiles. but seems to work. I am sure there is a better way.

No filename
No file type

Source Audio's icon

what you uploaded is not usable, what is it ?
part of that demosound.maxpat you are talking about is
embeded bpatcher with no name to make your investigations easier ....
You can drop audio file or folder with audio files
on it (contains dropfile) to populate umenu, or choose Browse... to select single Audio File
directly.
Dropfile has no filetype set in that bpatcher, (probably a mistake)
so it will list any kind of file if folder gets droped and produce error if you
select or drop non audio file which sfplay can't cope with.
Beside that it is 1 channel sfplay inside, what if you want to play stereo files ?
-----------
to edit it, you have to copy it, paste into new patcher, De-encapsulate,
edit, apply patcher arguments (like start in presentation mode),
save as maxpat, replace original one with it, by choosing it in bpatcher inspector,
and at the end embed it into main patch.
All clear ?

What do you want to do better ?
For use in different patches it makes no sense to add absolute path to a folder.
If you want to customise it, then you can remove the initial path,
and force droping of file or folder for playback.
replace this :
prefix C74:/media/msp/, insert 0 Browse..., insert 1 <separator>, symbol $1
with this
clear, prefix <none>, insert 0 Browse..., insert 1 <separator>, symbol $1

remove @file anton.aif from patcherargs

and set types fold AIFF WAVE for dropfile
------------
But I would rather suggest, forget that demosound,
and make simple patch with read or drop file or folder to populate umenu ,
insert 2 channels sfplay~ with modout 1 set to play mono/stereo files to both channels.

kp*'s icon

Hi. Thanks for taking the time. I think you misunderstood my query.

What I posted isn't the demosound.maxpat patcher. I assumed that everyone who has max installed already has it. What I posted was an example of loading all the files in a folder into a menu that can then be used by sfplay. It isn't perfect or finished, it is an example of what I am trying to insert into the demosound.maxpat patcher.

>to edit it, you have to copy it, paste into new patcher, De-encapsulate,
>>edit, apply patcher arguments (like start in presentation mode),
>>save as maxpat, replace original one with it, by choosing it in bpatcher inspector,
>>and at the end embed it into main patch.
>>All clear ?

This is literally what I am asking for help with. I tried doing it but de-capsulating things just throw a ton of objects around the patcher. There was literally not a single patch chord. I have no idea why this is, it is some kind of mode I am unfamiliar with, coming from like, Max 5. There seems to be something invisible that I can not make visible.

>>What do you want to do better ?
>>For use in different patches it makes no sense to add absolute path to a folder.

I want to keep it exactly the same but I want it to ask me for the folder and not use the hardwired /Applications/Max.app/Contents/Resources/C74/media/msp directory.

>>But I would rather suggest, forget that demosound,
>>and make simple patch with read or drop file or folder to populate umenu ,

I could do that but then I would not understand how demosound was made & I would lose all it's other functionality. Of course I could try to replicate all of that but I can't learn from the bpatcher if I can't see it's contents. I tried including everything in presentation. I tried unhiding everything. I can't seem to get past the interface elements and actually see the patcher and the patch chords.

kp*'s icon

demosound.maxpat
Max Patch

demosound.maxpat for all the world to see, though if you have maxing installed you already have it.

kp*'s icon

Rolling a quick and dirty one from scratch ... just the soudfile player from scratch... I suppose I could use the bpatcher as is for the other elements and add a sfplay on my own.... But this

1. uses drag and drop. I'd rather use "open" and not go back to the finder
2. Isn't quite intelligent enough to only open sound files and load those into the menu. It loads everything into the menu, regardless of whether it is an actual playable sound or not ...

autoloader2.maxpat
Max Patch

Source Audio's icon

the answer is allready posted in my first post.
bpatcher can either be embeded or not.
embeded one can't be De-encapsulated in original patch and then
encapsulated again, because it won't become bpatcher again but simple patcher,
which would hide gui objects.

kp*'s icon

I tried copying the bpatcher but that did not help. I need to review. There is something about bpatchers I am not getting. I'll go through some toots again.

Meanwhile I got autoload to work as a dialog too.... perhaps obsessing over taking apart this original demosound and learning from it is not mission critical.

No filename
No file type

Source Audio's icon

procedure to edit embeded bpatcher

1- get out of presention mode, select bpatcher using ctrl or right click
and choose in popup menu
Object > New Patcher With Contents of Embedded patcher
You get new patcher with editable bpatcher contents.
2- make sure to use patcher inspector to activate
Open in Presentation attribute, as is in original.
3- make you edits
4- save that patch somewhere
5- go back to main patcher, select original bpatcher and open it's inspector
6- untick Embed Patcher in Parent and choose the edited patch
7- tick Embed in Parent again
8- save the main patch
here short moovie - I saved edited patcher as temp.maxpat

bpatch-edit.mov
video/quicktime 3.47 MB

I did edit the original as I proposed in my first post.

Source Audio's icon

And you have to set filetype to both dropfile and umenu in case you want to drop stuff
same as in demosound patch.
If you want dropfile to accept only folders set types fold
umenu - set types that you want to accept, like WAVE AIFF

One should loadbang or do so before finalising the patch message
clear, prefix <none>
to umenu in order to clear prefix allready used.
You don't want any leftovers stored in the patch, right ?

P.S.
instead of dropfile for the folder with audio files, you can use opendialog fold
and pass the path as prefix to umenu
(set to accept audio file types)

kp*'s icon

Thank you. I will see if I can replicate your steps. I think I was not only messing up in my fondling of the copied b patcher, I had no menu at the bottom and for the life of me could not figure out (without the menu) how in gods name to get out of presentation mode. I finally found it. & low and behold the thing became a patcher. Ugh. This is way different from what I was used to many versions of max ago.

Thanks...

kp*'s icon

The confusion as to what is due to being a bpatcher and what was hidden because of presentation mode really had my head turned around.

Source Audio's icon

I don't use presentation mode myself, only in very rare cases.
I position my gui same for editing and for final look exactly the same, and use
bpatchers when lot of stuff arround gui elements needs to take place,
or pack them into patchers, the old way

By the way what are this NO FILE NAME and NO FILETYPE things that you post ?
One can't download them or even get a link.

kp*'s icon

>>And you have to set filetype to both dropfile and umenu
Okay. I see this in the inspector. I set the drop file to fold & filetypes in menu to AIFF WAVE
I was trying to do this in patch itself. Max 8 does a ton of stuff now in the inspector.

>>One should loadbang or do so before finalising the patch message
>>clear, prefix <none>
>>to umenu in order to clear prefix allready used.
>>You don't want any leftovers stored in the patch, right ?

I don't quite follow this.

>>instead of dropfile for the folder with audio files, you can use opendialog fold
>>and pass the path as prefix to umenu (set to accept audio file types)

I got this too. Thanks.

kp*'s icon

>>By the way what are this NO FILE NAME and NO FILETYPE things that you post ?
>>One can't download them or even get a link.

They are supposed to be patchers... but I am not sure why it is coming out that way. I never saw that on here before. Odd.

kp*'s icon

Some have come out just fine. Others not. I am just dragging and dropping max patches as I always do. Not sure why that is.

Source Audio's icon

you should rather unlock max patch, select all and copy compressed
from the edit menu.
then paste it here.

and about message
clear, prefix <none>
when you store max patch it stores prefix passed to umenu, as well as items that
got autopopulated with the patch.
That should be cleared.
clear wipes the menu items and prefix <none> removes last used
prefix path, leaving umenu in clean, unpopulated state.

kp*'s icon

see if this works

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


Source Audio's icon

sure, all fine.
You can connect both dropfile and opendialog to same umenu, having both options,
no need for 2 menu objects.
Last passed path populates it.