"If .. Then" type functions?

Feb 13, 2012 at 6:01pm

"If .. Then" type functions?

Trying to build a scene looping patch – the ‘loop length’ bit is still not quite working (see here – http://forum.ableton.com/viewtopic.php?f=35&t=176480 … But should be soon – for the next bit -

How can I get Max to select for integer numbers? To make an expression something like –

If Newscene >= EndScene then set Currentscene=Masterscene

– Pasted Max Patch, click to expand. –
#61755
Feb 13, 2012 at 6:07pm

[if $i1 >= $i2 then $i3]

provides 3 inputs, where third is your currentscene (or masterscene, i´m not sure what should becomes what).

#222940
Feb 13, 2012 at 6:11pm

Nice one thanks, will try it now

#222941
Feb 13, 2012 at 6:19pm

xidance probably has the best solution for you there.

But I’ve found (for the way I think about things, anyway) sometimes it’s easier to implement/easier to understand what you did later (depending on the situation) if you use [>=]

EndScene into right inlet
NewScene into left inlet

so then, when NewScene >= EndScene, it sends a 1

so I would do either a toggle to trigger the next thing or a [sel 1] to send a bang to trigger the next thing

But like I said, only sometimes it’s easier (for me personally).

#222942
Feb 13, 2012 at 6:23pm

Alright, thanks, great, got this working with

[if $i1 >= $i2 then $i3 else $i1]

But… I’ve just realized I need to do something else to properly reset it… I need something more like

if $i1 >= $i2 then [SEND RESET MESSAGE TO START OF CHAIN] else $i1

How can I do that?

Please take a look at this patch – problem bit is on left with notes!

– Pasted Max Patch, click to expand. –
#222943
Feb 13, 2012 at 6:26pm

[if $i1 >= $i2 then out2 reset else $i1]

provides 2 inputs and 2 outputs, sending “reset” (or whatever) to output #2.

sorry don´t have time to look at the patch right now.

#222944
Feb 13, 2012 at 6:27pm

AH ok thanks I’ll try that

#222945
Feb 13, 2012 at 7:02pm

Use gate 2 1. You can execute whatever logic you want in the two outlets.

I find that if-then is not a great solution for most things because it is so limited, and IMHO, I avoid it in all but the simplest cases.

#222946
Feb 13, 2012 at 7:07pm

Ok I got the IF bit working, not sure the best way to reset this patch though to make it ‘loop’ – much obliged if anyone can help.

– Pasted Max Patch, click to expand. –
#222947
Feb 14, 2012 at 12:14am

Ok well, figured a more elegant way of getting this working would be to just make it look ahead for the next ‘master’ scene – if it’s there and it receives another ‘next scene’ command, it loops back to the start…

I’ve got the ‘look if next scene=master’ bit working, but I’m such a noob at this I have no idea how to set up the loop back to start bit, any advice very welcome!

– Pasted Max Patch, click to expand. –
#222948
Feb 14, 2012 at 2:08am

what peter talks is true, [if] is like a habit from old days. in max you’re more with gates/switches/routings (or even splitters) and logic/math-operators. i think they are also processed much quicker internally even though you’d sometimes need three+ objects instead of one [if].

#222949
Feb 14, 2012 at 7:18am

Ok, thanks… if anyone can give me a tip on resetting the above scene ‘looper’ I’d much appreciate it. It’s nearly there now, just need an elegant way of getting it back to the master scene once it ‘sees’ the next master.

#222950
Feb 14, 2012 at 5:47pm

Ok, in the end I went for a system that would just look for ‘mstr’ in the next scene and then loop on the next ‘scene advance’ command… it’s not quite as dependable if I use my MIDI controller but its seamless for my drummer to loop through scenes, so it’ll do for now.

What it could really do with is something that looks ahead x scenes, spots the next master scene, and then sets a loop length based on that. But no way I know how to write that one! This’ll do for now – working code! :D

Here’s the current version in case it’s useful to anyone:

– Pasted Max Patch, click to expand. –
#222951

You must be logged in to reply to this topic.