Forums > MaxMSP

### simple, historical reasons behind R-L event ordering

Dec 01 2013 | 7:23 am

Hi

Ta ta

Dec 01 2013 | 9:27 am

I hereby revoke my right to castigate lazy posters!

http://cycling74.com/forums/topic/why-do-i-need-to-follow-right-to-left-rules-in-max/

Sorted thanks

Dec 02 2013 | 11:55 am

The simplest example in the universe for why right-to-left is absolutely necessary in Max.

```<code>
-- Pasted Max  Patch, click to expand. --

</code>
```
Dec 02 2013 | 12:50 pm

this does not yet explain why max is not left-to-right. it only shows why a method of order is required.

Dec 02 2013 | 1:32 pm

The related thread I refer to does a pretty good job of describing the historical reasons – "Max was [just] born this way" – I’m less concerned about whether it’s up/down, left/right, front/back precedence.

Thank you, I feel suitably armed to address any naive questions that may arise.

Brendan

 just looked at Peter’s patch, haha, none-more-simple!!

Dec 03 2013 | 5:24 am

No, the example, together with left-inlet-hot, requires right-to-left.

To paraphrase someone less reserved than myself, "Tout logicien de Max qui n’a pas ressenti – nous ne disons pas compris, mais bien ressenti – la nécessité du right-to-left est INUTILE."

;-)

Dec 03 2013 | 8:56 am

xD
i’d say that if the outlet were justified going from the left, i mean, everything could be left-to-right. Il est nécessaire d’avoir un ordre, pas forcément right-to-left plus que left-to-right :)

Dec 03 2013 | 9:25 am

it is possible at any time to write abstractions and externals with a reversed order.

no, wait, dont tell that your students, because they will ask "why" again.

Dec 03 2013 | 10:07 am

"Users of Max are often surprised by the right-to-left order in which multiple outlets of a single box are customarily fired. This is done because a box’s "main" inlet (the leftmost one) is used to trigger outputs, and the other inlets are almost always used only to set internal state in the box. For a calculation to work correctly, the leftmost inlet must therefore be triggered after all relevant messages have been sent to the other inlets. If one accepts that the first inlet should be the "hot" one, it follows that it should be the last to receive a message, and if a single object is furnishing two or more of the messages, the right-to-left order will be the correct one."

Dec 03 2013 | 10:12 am

What confuses me is that I recall someone (David Wessel?) mentioning that ‘back in the day’ Max didn’t have hot and cold inlets. They were all hot.. which made patching more complicated. Did I mishear him? If that was the case, then I assume right-left preceded cold-hot because order is more fundamental. Or maybe he was just referring to specific objects?

I also seem to recall that the original terms weren’t hot/cold but I can’t for the life of me remember what they were called…

Dec 04 2013 | 6:25 am

I feel that asking "in Space, which way is Up?" is akin to the sub-text question "why right-to-left and not left-to-right?". Symbolically, it is clearly Euro/Latin-centric, but for me, the cold-hot formulation works best as an explanation.

Thank you everyone.

Brendan

Dec 04 2013 | 10:53 am

Nothing wrong with asking which way is up in space… Kinda like how a mirror always flips your left hand and right hand, but never your head and feet. It’s asking which way is north that creates the problems in space. :)

Dec 04 2013 | 2:07 pm

What confuses me is that I recall someone (David Wessel?) mentioning that ‘back in the day’ Max didn’t have hot and cold inlets

There is some documentation of this in Miller’s early ICMC papers (for instance). As I recall, "back in the day" Max objects only had one inlet, and you had to set internal state with specific messages (and there was a standard syntax for two-value messages). A lot of fairly simple things were much more complicated.

@Vichug: No, left-to-right order breaks my example patch because of left-inlet triggering. It is NOT a question of "any old order will do." What my example patch was demonstrating was exactly what Miller said (in Metamax’ quote). Furthermore, the inlets after the left inlet are not only typically used to set state, they are often used to set state once, and one time only (or at sporadic intervals, but in any case should not need to be updated every time the left inlet is triggered). So, for flexible patching, you don’t want to have to rely on other inlets being triggered in a synchronized fashion.

Insisting that left-to-right order would in anyway be a viable option for Max is simply… what’s the French word for déraisonnable ?-) But wait…

Actually, on second thought, yes, left-to-right firing would have been a possible design choice. But it would have required that the right-most inlet be the "primary" (and hot) inlet for objects. And that the right-most outlet be the "primary" outlet. And that when adding a new inlet or outlet to an existing object (as has happened to several old favorites), that the addition is at the left of the object. And pretty much all the rest of the Max world would be mirror-imaged.

Which brings us to the question, what’s the French for "boîte des vers"?

Dec 04 2013 | 2:24 pm

@Roman: I never had a problem explaining to students that right-to-left order was a convention as opposed to a hard-and-fast rule. It is not something hard-wired into Max. It is something every object (and every abstraction) has to implement on its own. It’s possible to break the rule, and some objects of impeccable pedigree do break the rule (uzi, for instance).

The convention makes a whole lot of sense once you grasp (Boulez’ ressentir) the implications. And, every time an object breaks the rule, the Max world becomes a little more complicated (because there’s one more exception to learn).

So, the number one reason to adhere to right-to-left order in your own abstractions is so that when you try to use one again two years after you wrote it (or maybe two days after you wrote it), if you break the order convention you’ll spend another two days trying to figure out why it’s not working as you expect (or maybe you’ll spend another two years figuring it out).

Right-to-left firing makes life easier. Really. You just need to grasp it.

Dec 04 2013 | 3:39 pm

(i meant a mirror image of max indeed :) btw it should probably be possible to make this happen, with some jitter and a, uh, top down mouse… or somehting…)
(and interesting about those messages for setting internal values ! it’s good to learn some things have actually improved with time !)
(and, well, "boîte des vers" ?.. )

Dec 05 2013 | 3:59 am

The closest French phrase is probably "boîte de Pandore," but I wanted to avoid some associations with Pandora’s box. There is an English phrase "opening a can of worms" for starting something the you think is harmless but turns out to have innumerable, unforeseen, concomitant problems.

Dec 05 2013 | 8:50 am

from Gregory Taylor’s interview with David Wessel
(http://cycling74.com/2005/09/13/an-interview-with-david-wessel/)

In this 1999 interview with Gregory Taylor, Wessel talks about his musical background, his relationship with French composer and IRCAM founder Pierre Boulez, the origins of Max, and some perspectives on his current work.

. . .

What attracted you to Max?

Well, see, I was already interested in this notion of doing some kind of interactive improvisatory thing with a computer where the computer would be able to play lots of notes – multiple events and gestures – that I could control in some way. So I had made these things in this MIDI LISP environment a long time ago. I wrote a paper about it I’ve got somewhere…

When Max came along, it was just a lot more efficient implementation that I was able to work with. I didn’t have these problems with garbage collection and so on since I had this patching concept from the Music V-X world already. But it wasn’t about sound at that point – it was just about events flowing around. And it was early, too – I can remember the way the right to left order thing happened. It’s probably hard to imagine, but at first, Max didn’t have any notion of eager and lazy evaluation; if you put anything in any inlet of the plus object, you’d get an addition. You had to build all this stuff around your objects to keep things from getting weird. You’d really be careful about when you excited an object because any inlet would make it fire and then…well, Miller got the idea that making only one inlet – the left one, the one that made it fire.

(laughing) We just spent some time in MSP night school learning how to make it fire on both again.

. . .

Dec 05 2013 | 9:03 am

panier de crabes ?

Dec 05 2013 | 9:59 am

that miller puckette quote is also what i would think.

the first in/out is usually the most important, the most frequently used, and the one that triggers.

so if for example a [line] object were designed to output the ramp on out2 and the "ready" flag on out1, you would have to make a diagonal connection to next object below line. :)

and of course if there is a tendency for which out comes first, it makes sense to also use this order for 2 connections coming from the same out, as this now fits to the way how inlets are ordered.

Dec 05 2013 | 10:06 am

I never had a problem explaining to students that right-to-left order was a convention as opposed to a hard-and-fast rule. It is not something hard-wired into Max. It is something every object (and every abstraction) has to implement on its own.

uno momento.

are you saying that if i connect a [button] to both inlets of a [gate], the order the messages are sent is controlled by the [button]? and it could be reversed by writing a custom left to right button external? thats hard to believe.

Dec 05 2013 | 1:22 pm

No, the order of patch cords attached to the same inlet is handled by Max. An object doesn’t actually know which patch cords are attached to any of its outlets or where they go, or even if it has any patch cords at all! For that matter, "patch cords" are really just a fiction for the benefit of the UI (and, you, dear programmer, worthy reader). What Max is really maintaining is a list of target inlets for each outlet, or something along those lines.

But it’s up to the object to fire its outlets from right-to-left.

This is all in the SDK, if you just take a look at it.-)

To return to my notein/noteout example: when notein receives MIDI data (handled internally by Max), it then looks at the data, checks if it’s interested in the current MIDI channel, and if so, starts firing:

1) It serves the rightmost outlet with the MIDI channel number, telling Max "send this number out of this outlet." Max then handles the right-to-left for the individual patch cord connections.

2) When (1) is finished, notein serves the middle outlet with the noteon velocity, telling Max "send this other number out of this other outlet." Max does its thang.

3) When (2) is finished… hopefully you’re getting the idea by now.

Yes, it would be possible to write a custom notein that handled its outlets in some other, arbitrary, idiotic order. (That assumes you could get through to the MIDI API, which I don’t think is exposed to external objects. But in theory.) You could certainly write a coll or ffb~ that did a weird outlet-firing sequence.

What David W. left out of his memoirs was that the initial implementation of right-to-left was buggy (not badly, but it didn’t always work as advertised), and it took a while after Max was out in the wild (i.e., being sold by Opcode) before DDZ got the last quirks sorted out.

Dec 05 2013 | 2:16 pm

okay thats what my picture was about until now, phew. :)

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

Forums > MaxMSP