VVI-World

Blog of Bouke his Musical Trips

  • Increase font size
  • Default font size
  • Decrease font size

replace(a,b,position)

E-mail Print PDF
User Rating: / 1
PoorBest 

For my JazzMutant Lemur M4L Cliplauncher, I need to change the status of one of the clips when it's triggered from Live. I don't want to update the whole aray (imagine you have a 16x16 grid updates every time) and make things efficient as it can get.

I was reading the JazzMutant Lemur's manual and found one:

replace(a,b,position)
takes an array, and replace the items starting at “position” with b ( b can be an array or a singleton )

Examples:

replace({0,0,0,0}, {12,2}, 0) = {12, 2, 0, 0}
replace({0,0,0,0}, 0.15, 3) = {0, 0, 0, 0.15}
If position is not an integer, the parser converts it using the floor function (next lower integer)

So this is great stuff!

Let's take a look how I can observe whether a pad is hit (I monitor the whole track, since only one clip can be active at the same time). I use this patch to observe track 0 (the 0 is the first track):

ObserverTest
This patch shows how to observe the whole track. Once a clip is started, it should send some message.

Max_message

This is the response from the "print observer_response":
Message -2 means a stop (or empty slot without ARM or OVR enabled) is triggered, so the playing clip is stopping;
Message -1 means that no clip is being activated, this message is always send after an action (or at loadbang);
Message 0 means the top clip is fired;
Message 1 means the next (so the second clip on that track) is fired, and so on...

So the above example is: I started clip 0, waited some time, fired 1, waited some time, clicked the track stop, and the first -1 is the loadbang - an actual status telling you that no clip is being fired.

What can we do with this information? We need a patch that remembers what clip was last started, at the moment it gets a positive number, the lights should blink and go on at -1 message. When a next one is fired, 1 is received, remember the old clip (since that one should go out), blink the new one, remember this one too. At -1, enable the light, and switch the old on off. And forget the old one, keep the new one.

I'll try to create this patch tonight.

 

Add comment


Security code
Refresh

Subscribe to feed

feed-image Feed Entries

My Favorite Links

Cycling '74
Mainsite
Forum
Documentation
LOM

Ableton
Mainsite
Forum

JazzMutant
Mainsite
Forum

Other Projects
THE PROTODECK

Great Tutorials
http://www.max4live.info/

Great Patches
http://www.maxforlive.com/index.php

License

Creative Commons License
Musical Blog & Tutorials by Bouke Groenescheij is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Based on a work at www.vvi-world.com.