[Sorted] zl weirdness

Learn about building and using Max for Live devices.
Post Reply
drewbixcube
Posts: 298
Joined: Sat Sep 02, 2006 2:37 am

[Sorted] zl weirdness

Post by drewbixcube » Sun Feb 14, 2010 7:36 am

I'm running into an oddity in my patch, surrounding the zl join object. Basically, I'm observing a button matrix and converting the xy coordinates into MIDI notes. I know this isn't a difficult task for most of you, but I thought there was no better way for me to learn than to dive right in.

Now, on to the oddity. The matrix I'm observing sends out a list in this format:

1 7 7 1 - Converts to MIDI note 63 on
0 7 7 1 - Converts to MIDI note 63 off

I've got the conversion part down, but I want to also trigger a velocity value with the note on data. To do this, along with the conversion, I route the list to an unpack so I can do what I wish with each individual value. The first number in the list above is the note on data. 1 = note on, 0 = note off. I send this from the appropriate outlet of the unpack to the left inlet of a select 1 object. The left outlet of the select 1 object is then routed to the left inlet of a message object (100). The left outlet of the 100 message is then sent to a zl join object, along with the right outlet of the select 1 object which is sending a 0.

In short, observing the output of the zl join should create a new list:

63 100 - note on
63 0 - note off

However, this is not the case. For some reason, the 0 is being triggered with the note on message (1), and the 100 is being triggered with the note off message (0). At first I thought it had something to do with the select object, but after observing the output at each stage, I found the switch taking place after the data is passed to the zl object.

What's even more strange is if I create separate unpack objects (one for the xy conversion and one for note on/off velocity value) the behavior goes back to normal, or at least what I expect to be the normal operation.

I could just accept this oddity and be happy with a working patch, but it's driving me crazy that the different routes are sending the exact same information and outputting different results.

Any ideas?
Last edited by drewbixcube on Fri Feb 19, 2010 5:58 am, edited 1 time in total.

hoffman2k
Posts: 14718
Joined: Tue Jun 15, 2004 6:40 pm
Location: Belgium
Contact:

Re: [Help] zl weirdness

Post by hoffman2k » Sun Feb 14, 2010 8:07 am

drewbixcube wrote:I'm running into an oddity in my patch, surrounding the zl join object. Basically, I'm observing a button matrix and converting the xy coordinates into MIDI notes. I know this isn't a difficult task for most of you, but I thought there was no better way for me to learn than to dive right in.

Now, on to the oddity. The matrix I'm observing sends out a list in this format:

1 7 7 1 - Converts to MIDI note 63 on
0 7 7 1 - Converts to MIDI note 63 off

I've got the conversion part down, but I want to also trigger a velocity value with the note on data. To do this, along with the conversion, I route the list to an unpack so I can do what I wish with each individual value. The first number in the list above is the note on data. 1 = note on, 0 = note off. I send this from the appropriate outlet of the unpack to the left inlet of a select 1 object. The left outlet of the select 1 object is then routed to the left inlet of a message object (100). The left outlet of the 100 message is then sent to a zl join object, along with the right outlet of the select 1 object which is sending a 0.

In short, observing the output of the zl join should create a new list:

63 100 - note on
63 0 - note off

However, this is not the case. For some reason, the 0 is being triggered with the note on message (1), and the 100 is being triggered with the note off message (0). At first I thought it had something to do with the select object, but after observing the output at each stage, I found the switch taking place after the data is passed to the zl object.

What's even more strange is if I create separate unpack objects (one for the xy conversion and one for note on/off velocity value) the behavior goes back to normal, or at least what I expect to be the normal operation.

I could just accept this oddity and be happy with a working patch, but it's driving me crazy that the different routes are sending the exact same information and outputting different results.

Any ideas?

Maybe its just me, but without a patch it'll be hard to help. I'm guessing its a problem with message ordering.

drewbixcube
Posts: 298
Joined: Sat Sep 02, 2006 2:37 am

Re: [Help] zl weirdness

Post by drewbixcube » Sun Feb 14, 2010 9:39 am

Not a problem. Here's a stripped down patch that illustrates my dilemma:

http://www.mediafire.com/?hu2zh0kgyu1

hoffman2k
Posts: 14718
Joined: Tue Jun 15, 2004 6:40 pm
Location: Belgium
Contact:

Re: [Help] zl weirdness

Post by hoffman2k » Sun Feb 14, 2010 9:56 am

Yeah, definitely a message ordering problem. You have 1 toggle triggering 4 things at once. In order to get correct results, you need to trigger them right to left.

<pre><code>
----------begin_max5_patcher----------
879.3ocyYtsaaBCGF+5jmBKj1MaoY9HG1caO.qR61poJRhaJcDSTvQqqU8ce
XCzPanwFB0EE03fID93Ge+OX5iSm3sH6ddtG3afq.Sl73zISzSolXR01S71D
e+xz3b8WySv+a1h67lUtKI+dodZIHEjVOqX+lr8xTtTeH3pY2FKWdahX8063
KkkmRBjNGNCf8wpABdNaF.ENGB9c0wT9yH+2Vd4A34Mq3um2cxJ8IuPPWf8q
O62jIjh3M5iv666RhSA+HKcUycmm7fd2HXw48YMmHpkLRM2SSmpda14BlDvB
0q1gC0HbPDkHArHyvIQHU7YQrX8QiswrnwIx1K1Fu7O.X4qSyskYoY6Ju7gy
wTBhDLq3SLZDDq9PHCFEVvsFXqETSgZFiCCTCQHM2sA0GOzp2D+AC5M77730
7iHMpc3hLSpxgpHV+SFw1FQPCHPvCmyyruCYNYFUiF+.yln1MKCHZnCnWIn6
.wObH7JrOXux.BDh+P.D+QJPPPXeymPggmW9D33LgRNOEf5baQUPgDnsKTl4
LI0k5aGNjwIb5Rc9Sju8cpnMZj1P4Cof6xRDcuWarNDiRKGHVTd5MMTgiSC0
W5dF4RnTGogsqG6VYRz3jIeFD1cpvJWOFUGfQH8mJ3QZd4O0GpT4UvvylJez
s+JyVuNk22NbCqZqq9cKAv1c7btPFKSxDMOQM.CsYsxFYOa4WnorzE.7ouVU
CmcYGX6thqkqw80zvz4WXndtl.1PFFAGv1aNMWflqFEDoAC9Hvz7pGMNqDqu
1A+p3Bl2eBTFLEbbOdVDtvnCIXNcPlO5PPVS01CbtLayFtp4qWwyelI4fKEe
8xatoyzrZU2kzDwfmxOgBdm7S5SlWZh30ORUsfUy+Rpjmse2x5.+5GhI3flW
wykIhmc.WcnwzFeoaSVshKZhmMIq1VzgnrRDuw8nNoIjAModBWtTSVfIrawT
Q6e.ho6bNWQXCJh4bEYxI496ZFMRNUQTjERJxoRRsbOiRh4VyM1lT.pG7gK4
DzFME9hf.iZhB0+ienDcMWRQY35sNW0RrHZrypsPXuKpEaSXAxswEXnsZB4N
OnUUq6XrJoXEVE2GIvfxU9dXqgvCZjfPmdWkYYIAryTjukJxgtLKUDws9dSc
6fcqSBEYa8.G5tsImkZck8VSEa7zz+SAvX8v
-----------end_max5_patcher-----------
</code></pre>

Gregory Taylor
Posts: 268
Joined: Tue Sep 01, 2009 3:11 pm

Re: [Help] zl weirdness

Post by Gregory Taylor » Sun Feb 14, 2010 11:44 am

Yep. And I think that a look at the Max tutorial 5 (just the basic one, not data or anything fancy) might help you avoid this kind of problem in the future. If you don't know why you made the mistake, you'll make it again. :-)

j250x
Posts: 54
Joined: Sun Oct 01, 2006 1:42 pm

Re: [Help] zl weirdness

Post by j250x » Sun Feb 14, 2010 2:34 pm

Something I didn't realise for ages with Max is the significance of message ordering. The trigger object is the most important thing in the world. Always think about the order in which things are going to happen, and whether each object will have the right information at the point at which it does it's calculation.

drewbixcube
Posts: 298
Joined: Sat Sep 02, 2006 2:37 am

Re: [Help] zl weirdness

Post by drewbixcube » Sun Feb 14, 2010 4:24 pm

Ah, I see. Thanks for the input. I'll spend some more time with the tutorials. I'm off to figure out how to trigger led messages now. ;)

Post Reply