Patcher Switcher

DaBigBoy01's icon

I have a group of controls inside of a bpatcher. Is it possible to duplicate several of these and create a switcher?

For instance, I'd like a GUI with 4 envelopes but a button that can select "ADSR 1, ADSR 2," etc.

Source Audio's icon

what means select ?

bring to front, allow editing and send values ?

or only recall values ?

bpatcher has offset control ...

if that helps

DaBigBoy01's icon

What I'd like to do is create a group of ADSR envelopes and create some sort of a umenu/button that will activate an envelope. I could do the same thing for oscillators, etc.

Source Audio's icon

Again, what means to activate ?

in what form are that envelopes ?

Lists with values ?

no matter in what form something is, you would either use something like

live.tab, umenu etc to "activate" something.

In case it is 4 different lists for adsr~ you will simply recall them.

In case of 4 live.adrs~ objects, you can either switch 10 outputs,

or output of connected adsr~ object, as well as input.

or in case of 4 oscillators, choose which one to use...

using for example selector~, matrix~ etc

Wil's icon
Is it possible to duplicate several of these and create a switcher?

Yes it is possible.

[thispatcher]


Wil's icon

put this inside your bpatcher(s)

make inlets and outlets for the bang and unpack

easily get size and coordinates for bpatcher to use in scripting

you can have 1000 bpatchers with same coordinates

connect to [thispatcher] to hide and show


Wil's icon

will send example tomorrow

Wil's icon

here is way to switch between differsnt bpatchers

only show 1 at a time

saves screen space

different ways to route

this uses matrix~ so you can only use with 1 instrument -

you can take out the matrix and connect to 4 different instruments

3_bs.zip
zip



DaBigBoy01's icon

Thanks very much! So Matrix and selector objects are what I need.

Wil's icon

Don't forget about matrixcntl and crosspatch!

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

DaBigBoy01's icon

The only that I'm having a problem with is that I built the text file for the col object, but the data won't save. I save it every time to my desktop where my synth is located, but every time I save and close the text file, the data is lost.

DaBigBoy01's icon

Check that I think it finally started to save the data

DaBigBoy01's icon

Thank you - I've been able to get your patcher switcher code to work.

In Presentation mode, am I supposed to move all of the bpatcher windows to the same coordinates or is there code that can force them all together? Because right now in presentation mode, the windows are still right next to each other, if that makes sense.

Wil's icon

It works here

Screen Recording 2024-11-24 at 9.28.16 PM.mov

check info tab and make sure each bpatcher is scripting name didn't get erased - adsr_1 adsr_2 adsr_3 adsr_4

//

I am having a ton of bug problems with Max 9. bpatcher scripting name randomly disappearing is one of them

-along with bpatcher contents magically offsetting to strange fantastic location

-bpatcher inlets magically not receiving any information

//

-- no one has mentioned that weird 'out of bounds' not snapping patch back when patch is locked (not a bpatcher thing this one)

//

oh and preferences default patcher size 'small' still opens medium

//

I should move bugs to a bug post

-


DaBigBoy01's icon

It works via the program you sent me - something's wrong with the code that I built into my project. I'll check it out

DaBigBoy01's icon

bpatcher scripting names are still there - "adsr_1", adsr_2", "adsr_3", "adsr_4. They match the names that are referenced in the script messages

Wil's icon

post your patch if you need assistance

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

Attached is a copy of what I've got.

Wil's icon

can you send env_for_bpatcher.maxpat?

DaBigBoy01's icon

Yes, sorry! Here you go!

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

DaBigBoy01's icon

and ADSR_Switcher.txt is just this:

1, 1. 0. 0. 0.;

2, 0. 1. 0. 0.;

3, 0. 0. 1. 0.;

4, 0. 0. 0. 1.;

Wil's icon

simple

you changed the coll and deleted the first line 0, 0, 0, 0,

you added a + 1 from live tab to compensate for that

but you didn't add + 1 going to sendbox presentation_rect

switcher.zip
zip


Wil's icon

The “some objects start at zero and and I want it to start at one” in Max is mindbllowingly confusing

Most objects start at 0 or 0,0

But we have a habit of labeling 0 positions 1

DaBigBoy01's icon

Oops, that'll do it.

Thanks a lot for your help!

Source Audio's icon

why so complicated ?

you can use same 4 dials for 4 adsr lists

and switch between them.

DaBigBoy01's icon

what is the object "t i i"?

Source Audio's icon

it is trigger objects that outputs input in right to left order.

here is the patch

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

all you need is to see how to store coll in your environment,

or maybe use dict or pattr etc instead of coll ?

no idea, I am not live user.

DaBigBoy01's icon

Thanks very much!

Source Audio's icon

I forgot to add this, just in case you want to

switch some inputs

Wil's icon
you can use same 4 dials for 4 adsr lists

its a very cool auto-save [preset]

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

but can it do this?

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

Roman Thilenius's icon

if all controls will be of the same type, one might also use the same GUI patch over and over again and only change their output scaling, their label, their color, you name it.

my personal guideline is always: split the stuff into three groups (and not only two):
1.) the gui elements themselves,
2.) the logic and math required for the GUI elements,
3.) the targets where they are going to and from where they are possibly remoted from (midi, parameter, presets, DSP...)

new options how to recombine things will magically appear.

Wil's icon

yes. Max is cool~

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

DaBigBoy01's icon

Sorry to come back - but I need a bit more help.

I used SOURCE_AUDIO's patch to create the envelope selector. Selecting an envelope works good, but now I want a live.tab to select an envelope to route my oscillators through. I've tried for a couple of days several different ways - zl nth, matrix, outputting a selector into adsr but none have worked. Looked at the documentation but it doesn't really talk about something like this.

Thanks!

Source Audio's icon

what exactly does this mean:

"I want a live.tab to select an envelope to route my oscillators through"

can you not simply ask - how do I switch 4 inputs to

1 output, or oposite ?

post the patch that does not work,

maybe it is a simple thing to fix it...

Wil's icon

Again. You should post and example patch

Difficult to understand

How many oscillator?

How many envelopes?

What’s the mixtur?

Source Audio showed about the switch

DaBigBoy01's icon

I want something like this:

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

I did see Source Audio and thinking about it now that's what I'm after - I'm just not sure where to attach it in my code.

Source Audio's icon

Sorry, but what you posted has nothing to do with the patch I posted

and does not give any answers about what you want to do.

you reinserted all that green stuff between what I posted and adsr, why ?

That can't work.

and again , now you have 4 adsr envelopes, what is it that you want to do next ?

Your patch tells nothing.

in any case, if you duplicate adsr stuff, you need to rename it

otherwise coll with get overwritten...

DaBigBoy01's icon

Sorry for complicating the question.

That's the new Filter envelope switch that I just wrote(It was more of a test). I know I have to give it it's own coll name. I should've just posted a picture of the Presentation mode instead without it.

So...

You gave me this:

1)

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

And it works great. Then, later(I didn't realize until recent), you posted this:

2)

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

So my question is, where do I insert #2 into #1, so that I can, as you said, create a 4 input, 1 output switch?

Source Audio's icon

if you only need input selector,

this would be simpler

ramptime smooths (crossfades) input switching.

matrix~ could do more by also creating in-out combinations.

P.S. I have initially uploaded wrong screenshot ...

DaBigBoy01's icon

Okay I've come up with something on what I've been trying to do.

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

It works but not quite. The knobs only update when I switch envelopes. It's probably because I don't know where to connect the zl.iter object to.

Source Audio's icon

that last patch makes no much sense.

You modify patch parts that worked to non-working version,

I gues not understanding what they do ...

I am afraid you are not able to explain in simple words what are you trying to do.

It is not easy to provide help like that.

zl.iter makes no sense, and zl.slice 1 is connected wrong.

DaBigBoy01's icon

I'm not sure I can explain what I'm asking for further - The patcher switcher you sent me is good but I want a separate live.tab to select the active envelope.

-One live.tab menu controls the Envelope window that I'm looking at.

A separate live.tab menu selects the active Envelope my Oscillator uses.

At this point if I post any more pictures or code I'm going to cause even more confusion.

DaBigBoy01's icon

I'll try this one more time in hopes that it can at the slightest clear any confusion.

This is an example GUI of what I want.

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

DaBigBoy01's icon

I really hope that explains it.

Again - the patch posted is just an example of the GUI I'm looking for.

One live.tab selects the active ADSR envelope for the sound.

The second live.tab selects the envelope I want to look at.

I know how to patch the second live.tab thanks to the code you gave me, but I don't know how to insert the first live.tab menu.

Wil's icon

this is the only thing missing

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

DaBigBoy01's icon

Thanks for that, that was what I needed.

The only thing now is that the coll list doesn't update until I select a different envelope. It doesn't update in real time.

Here's my updated patch:

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

Meaning, the coll object doesn't save the dial values until I select another envelope. meaning, when I first open up the patch, the values of the dials are different than what it should be in the coll object.

Wil's icon

If you don't know what you are doing

and you cannot explain what you are doing

then no one can help

YOU DO NOT NEED 2 COLLS

YOU DO NOT NEED 2 SETS OF ADSR CONTROLS

IF YOU DO NOT UNDERSTAND THAT

THEN WE CANNOT HELP

I sent simple trigger

You added a coll between what I sent

That make no sense at all

Proves 100% that you have no idea what you are doing

ADSR and ENVELOPE are the SAME thing

Look at the ADSR help file - what is th [t 1] doing?


***School time

I get paid a f6^%#@Y%ing lot for this

Envelope is a general term that describes how a sound evolves over time

0 = no sound

1= max volume

0 to (anything between >0 && <= 1) to 0 = envelope

ADSR is just one very tiny common version of all the billions of possible envelopes

In classical orchestra for example, you can have basses start n (niente) crescendo for 10 minutes to f (forte) and dim. to n again over 30 seconds. that would be 10 minute and 30 second envelope that does not exactly fit the ADSR model.

Attack = 0 to 1 over 600000ms

Decay = 1 to 1 over 0

Sustain = 1 to 1 over 0

Release - 1 to 0 over 30000

Wil's icon
One live.tab selects the active ADSR envelope for the sound.
The second live.tab selects the envelope I want to look at.

Do you want 2 copies of the same envelope system?

One is functional ,

One is for looking at?

Wil's icon

If you don’t know what you are doing then simplify

Make 1 envelopes

Make 1 oscillator

Make them work perfectly together

Then add more

Then You will see about having second envelope is a problem

Wil's icon

Actually when I don’t know what I’m doing which is 90% if the time , I throw all the shitty files in the trash and start over

Post a 100% working patch with 1 osc and one env

End lesson

Source Audio's icon

Let me chime in shortly, I am sure it is missunderstanding or bad explanation.

what if the goal is to select one of 4 adsr presets to really use in signal path,

and to use another selector that edits adsr lists and displays them ?

If so, you must disable automation for editor selector - the yellow one

and also the 4 dials !

(set parameter mode to hidden and disable mapping)

but automate and make mappeable the blue one.

Wil's icon

Not 100% misunderstanding

I saw the share of controls he wants to use

//

Like this:

Even simple folks in the country understand if you drop and egg on the kitchen floor

Newton - egg fell down

Boltzmann - that egg is not coming back

... need cleaning supplies

these are classical theories that can be understood - math might be difficult but doable

//

But if you want GPS

Need Einstein General Relativity

Not a good idea to jump into General Relativity without understanding classical physics

//

Based on OP shared posts

Not ready for SOURCE AUDIO

Need to understand classical music