Tutorial: MAX Patch for Paths, Objects, and Observers

13 replies [Last post]
mchenetz's picture
mchenetz
Offline
Joined: 09/17/2009
Tutorial: MAX Patch for Paths, Objects, and Observers

 <pre><code>
----------begin_max5_patcher----------
1682.3oc6as0aaaCE9YmeEB94TCwa5ReqaCXOsKXcXuzVDnXw3vUIQAIZ2zU
z+6i2jhrirL8rsjAxBPiDo3kO8wy24bHUy2tY1764OQqm68VuO3Ma12tY1Lc
UpJlYKOaddxSKyRp0MadNstNYEc9slmInOIz0WSEd07Ltmeyi3qEYTg3qkTy
3Oet2mrO5Adgnl8O5G.7W3aqtXcNqP1G8LAetRyHoqEXqkkpmU98+8aHsyXY
hX4irhU2UQWJLSZbLTN7dnfH0ERn52ffE9aAkhjbMTl+tJVRl2OvyRmqd52u
4F0ut8bQMfwlZvACQMP+QiZJneQhmWvLYrMzExGnvzXSMgCPM.ej1rAi0TDI
VyMQiO2Hw1i6mYt09uihg.8xPndXnnAYnHsYC12vPfKICsOg0Jtf6o3o6TRL
QUxxOWO99evwNvSVUF..m.YVYEqP3sRxQ4qEsz3+ciE+dHA7.jPP.VaqDosU
BCmDaEqS3Q25.MDwf5FcBG+JyELzAalW0dfGJylPS36+2A7avfCSSii+2k77
bZg3E7z6os0c+pkRuPUFv4uH.PBhBtUdGg.iw.0cQvPLQdGXGPd1bVihcHsP
rV+ACunJu8QX+7UFgE4fSbKg4ClBB62tulVsgdUQZCkgMDh6PZHezT39prhW
RqDe0aSR1Z5X61BE3.+XbaEdQyLPGmSBWUqri9ljp1AumG2afvGx3Ihm4pxj
J4HHnU2QKRtOitisygLnf8PXjgHLShB1bLQAZBizgvpS1PSuKQHpX2KyB946
psTikaTu7RqA9CMU2Te2WoLdwpAHnsZaNOU91pEIMVLaOVrhOqFqt5nWL.7T
59dLq3AtFG8M47pTZ09545Blgr6sq0kTZZFKee8tVPK2KloOUxKTNpTKvK16
jK95VFFa+ZKMR2e2yGjSaLM6muXBoboiYYuucOxqDttDyJ1vpYCLZpkP6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TwarK9NGYsDzkPwiarXjKw8Pia
bucnf8fIEvAtiIjQYfQZSMjOrszoh1.WQ6w3iz3UDCLBXbbaoSDsXWx8B6Op
q2XWxyQ8Wh3wrdGBMbFrqeacoSEsHWQ6QvfAXi0IPeIHD0V5TQqKVm3viMJi
ga8QF21VvqJdpvMxU3BNlvLlbzr1BxnNfylwfKgYviaXFh+EXIG36qIMTLo6
Ztt3oxgtDVDiOANTV3627u7tCw3D
-----------end_max5_patcher-----------
</code></pre>
 

carloskleiber
Offline
Joined: 12/11/2009

...just the reference to the tutorial in the blog (as it is somewhere deep down in the guts of this site already;)

http://www.max4live.info/content/tutorial-max-live-paths-objects-and-obs...

thank you for this site, Michael, this is definitely the place to learn about the live.objects and live API

...oh and since I am a perfect noob even the right copypasting of the code above gave me a hard time. So, message to other noobs, make sure to copy including all from (pre) to (pre)!

carloskleiber
Offline
Joined: 12/11/2009

Hello, Mike,

thank you for your answer on the other thread. I'd like to ask a few questions about the objects that you present in this tutorial.

I don't understand the difference between live_app and live_set. I understand these are locations to the live.path object, but not what they represent.
I don't understand what is view. Is live_app view a name, or two names? What do you control when you control "view"?
I assume either with live_app or live_set you can do something general to all live sets, right? Like, for example each set at opening has an extra audio track, with resampling selected as input. Can you show how to do this?

I am not sure to understand the difference between addressing ClipSlot or a Clip. I guess it has to do with addressing a coordinate or a clip with a specific content, but how can you define a clip itself just by appending "clip" on the message?

I am sure I'll come up with more questions in a short while. Sorry if some of these are stupid, but the whole concept is a bit philosophical comparing to what I am used to:)

mchenetz's picture
mchenetz
Offline
Joined: 09/17/2009

@carloskleiber

Traversing the LOM can be a little confusing at first... The way I like to explain it to people is like this...

Think of the LOM (Live Object Model) as a File Directory on a computer.

In any given filesystem you have directories and files and other things, but we will stick with directories and files.

In order to execute an application that you want, you need to go to a specific directory and then run that application. The Live Object Model works in the same way. You go to a certain path and then do, "something" within that path.

Lets take something like Microsoft Office as an example...

In order to execute the application Word in office you may have to go to c:\program files\Office and then execute the program, "Word"

or on a mac it would be /Applications/Office and then execute the program, "Word"

But, if you were trying it from a different directory it may not work because you are not in the correct directory.

Again... The LOM works in the same way. You set a path that you want to do something with and then use, GET, SET, and Observe to do something at that level (The same as a directory in a filesystem).

The LOM starts out at a high level. The things you can get with Live_App are things like the actual Live application version number and very high level applications specific information.

The next thing you can set a path to is your Live_set. This refers to the current live set that you have loaded. Then there's the live_set view and so on...

When you get down to clipslots and clips, here are the differences... Clips are the actual physical midi and audio snippets contained within the clipslots. The Clipslots are the holders of the snippets. So, When you perform an action on the clipsslot, then you are doing something with the way the clipslot operates. When you perform an action on a clip, you can actually manipulate how the audio and midi snippets are played.

I hope this helps you and others.

I am definitely working on more information to help in these areas.

Mike

crampe
Offline
Joined: 12/16/2009

I just understood something,it's basic but it's for sure a very important detail for beginners like me, so...
When refering to the LOM for your task, you have to keep in mind that we can:
- set, get, and observe "Properties"
- call "Functions"

I was trying to ask live.object the "get_major_version" but it tooks me a while to understand that this "get_" was different from the one which tells "get" to a message box.
Thanks to Mike's videos and patch tutorials I figured it out.
Hope that helps.
Jul

[Edit]
One more thing. The "color_index"property (wich we can find in Mike's Live Clip Tutorial's patch) has changed to "color".

Anonymous

<< The "color_index"property (wich we can find in Mike's Live Clip Tutorial's patch) has changed to "color". >>

good call, I was wondering indeed:)

Thank you Mike for the extensive explanations, and thank you crampe for the precisions.

crampe
Offline
Joined: 12/16/2009

I'm glad it helps.

carloskleiber
Offline
Joined: 12/11/2009

Last anonymous post was by me actually, sorry it did not show..

Which way do you guys (and especially Mike) suggest for uploading pictures here? I'd love to ask concrete questions and a simplepicture could help so much...

mchenetz's picture
mchenetz
Offline
Joined: 09/17/2009

You can attach a file to a new post under the file frop down undernath the text box. Once the file is attached, it provides the URL under the file. Copy the url and click on the picture icon in the forum. Paste the URL into the URL box in the picture menu.

Mike

carloskleiber
Offline
Joined: 12/11/2009

I'm sorry I don't understand. If you are leaving out HTML knowledge that for you is basic please be patient and don't;)

mchenetz's picture
mchenetz
Offline
Joined: 09/17/2009

@carloskleiber

You would have to create a new, "Forum Topic". Only the main topic can have attached files. Believe me, I am working on better forums. When you create a new topic, you have the ability to attach a file. Once the file is attached you can copy the url that is provided underneath the attached file and paste it into the picture button and add it to the text editor area of the screen by placing the cursor on the editor part of the screen and then clicking on the picture button in the top right hand side of the editor menu. paste the url you just copied into that picture button menu under url. It sound complicated and it will be better shortly. The key is you do no have the ability to add attachments on a reply. It has to be a new topic.

Mike

carloskleiber
Offline
Joined: 12/11/2009

Ah, I got it! Well, it is better already than URLs to other locations with only the shortcup showing in the posts. I'd hate to always have to open external tabs and I am sure other people would hate it, too. Also it is an annoying process to upload and unreliable on long term. If you exceed some upload limit all your pictures dissapear and stuff.
I really hope you find a way to bring in this goodie, even with super limited file sizes. Most of the times a simple little picture makes all the difference. Of course, it is also the fact that I am spoiled with the reaktor forums;)

Anyway, thank you for the explanations, I'll use the possibilities in the future.
cheers,
gergely

Soupsounds
Offline
Joined: 05/02/2010

Its a fantastic tutorial and helped me understand M4L better. One thing I haven't get grasped is the "get" command produces a print of the status of say a channels Mute or Solo status. How do I actually get a number "0" (off) or "1" off for the mute status.

This is my current sticking point in creating my first useful M4L patch.

Any help gratefully accepted.

mchenetz's picture
mchenetz
Offline
Joined: 09/17/2009

So you should have a message that goes to a Live.paths, left input that has something like, "path live_set tracks 0" which tells the live.path which track to monitor. That live PAth's middle out (most of the time) is connected to the right input of the live.observer object. The Left inlet of the live observer should have the word, "property" followed by the attribute you want to monitor. For example mute, would have a message box that contains the words, "property mute". Now, if you trigger the first message box with the path statement and then the second message box with the property statement, then you will be observing the parameter mute. Once that is triggered then it will continue to monitor that property until the device is terminated or you tell it otherwise. THe output will come out of the the left output of the live.object in the for of a 1 or 0 for on or off.

I hope this helps. You can also download the patch from the paths, objects and observers lesson and it will show you more.

Regards,
Mike