how to pack values for a [line] msg?
i want to use a line object to play through a sample file…
i know that line needs a msg with three values
(startpoint, endpoint duration)
lets say i want these values generated randomly…
how do i have to pack those values that the msg will be set up properly?
[pack $1 $2 $3] -> ($1, $2 $3) -> [line] ?
i use this [sprintf %f, %f %f]
:awaits method that uses 60% less resources:
do the below
----------begin_max5_patcher---------- 1911.3oc6bt0aaaCEG+4jOEbZaXa.1Nh2zk.TLLf0c4g0AzMr8PbPgrLssVk E8jnahWW+tOJRYa0DIYIGat3jFjpDwPS8W+3gmygTT88mel0H9srLKvkfq.m c16O+ryTEkWvYEmel07faCiCxTUyJjOeNKQX0S+2DraEpxuZEeYJHHdJOMRL adFXFKkcc4pExi4o5Kk8.6d.X9g0+F35hZNIc5ncVojkyiRhYBkjfaKjuTrt T60sGOQLIHjkWFpTYYQ+ipLHZv5ptHPDNKJY5aRYgBsFHtt4WajMRIAhu5rx RIZr51mO5u56PrJcARBlqt.V+DK9cLQTX.3UrkLq7Z7gyOO+PuVx7D1Mx1+d HOaQZj7lC7kSfCG1S9Cj7eXqpXDtRFAalG5ZJVsfoggk0l65JPklTThBTHul .Ew9HAp4rrrfor6QpW+xe6k+dkfAc7ACFB01P4GIJv.8qwBx1rVPBvH43J.z 11dfbTlU6GdQ5HgFEjL0pGvZRLOPTwuzB.RU.zi1jkE0yvVVYLQcfyblVXMT H1MYaQoGIzTWDg7xCFl7ua9dcMhiRXg7kIppQWe2kxxjsRfHhm7lJqw8hg36 Yi8Q4gG7f9N1dp.ETaeu5inzxORGiuTUrjx2Na6vfd53ITUfDn1j10qzkthd 4V7gJc0JK4Rc+XWC28CAu3EfhgM8g8FlfA8AnxEhpzf.0PJCaSIngTFptRGf tzJROvWkW.11UmdfJ3GlV8.Prug8MYOn2Fu6OPOTH5.GR9W6kaJnCVAFYq36 B8vnbVgajU3iDqjQaj2scHPWk4L5N.4564hqiFaBtoB60BzPjnwiJ6nb5Abz Q3bqgLFNEg7wlxgTxzW5PhkntFjqWKsf7TivnMlFNF9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7c u566oV1C0PfqJLNuFLiEuXR9XkuNSpSfLjA3phWDmq+lKqr6kbh66Btc9W5I Dk2cVY+Hxra2gcuKQvFaezr4UDqwnmFFPilpr2jzwwszAX0vhrO1KQSS3RXD GE91xnsxMKOtTZFPRiuHONala8rHoq+j61s0B1oZV0Hw67BNpzVd4eLP0i7K 5x0a1K4vrMhaLKSDkr4Ur3pMcnkpyVstFOyiFufKcNTHAv0U141VEk+9gsSI Q85llvH6ATY+hNM8sm7P05iN5QaSGZ9qI0dPODxM+GkO6PnV3NTa9d61zDDs KM4XdMg2klLrkFsEVZX68abJjLffH9d4qguK5iKxD5F9v0M4.qaRajc2TMwF pFP6nEuVvpyN.ZE1BsB6fVw5YtSTRN+kRiVb1APqnCLWKHIwoLWyO6Ap07WY rcOlqipsX.F1ENv2i5aC6c+hdn5FdD7UTxwf+88U3eHFygZyXN28ZPGRuvqk O6AJ16DmrZ0Z13V2gMUKIx9wuht5RmcHD6g1qUgeph+iQnzYOTw11TOglqyF 0RIgLmjNBg5I22sCoQ2NxS9v4+GPrg1S6 -----------end_max5_patcher-----------
‘NEVER do this’ haha
answer me this pid. i have a granular patch with absolutely tonnes of these things going off all the time, continuously, and it runs like clockwork. so where is this ‘ever growing amount of resources’ actually going? just checking activity monitor for max, all values are constant and don’t seem to be increasing at all.
now i’m not saying you’re wrong, as i don’t know the ins and outs of Max’s symbol tables and the like, but for every ‘no don’t do this’ post i usually find i’m doing exactly that, with no problems at all.
enlighten me :)
oh, maybe ignore me then – i have no great way to ‘enlighten’ when max says one thing and we have to try figure out the other. wait till someone cleverer posts…
The efficiency of sprintf depends on what you’re doing with it. Every unique symbol in max is stored in RAM, and never free-ed until you close max. So if you’re using it for general formatting of input values, you’re likely going to be adding a large number of unique symbols to RAM, which in theory could begin to waste your memory resources – I don’t know if this applies in the same way to floats and integers………….If you’re using it for message parsing to grab file names or something similar, it’s a more appropriate object to use because you won’t be generating symbols very often.
So for general purpose things like formatting for line/line~ it’s not the best object to use.
-edit: With sprintf, if you’re using it to format the same things over and over, then it doesn’t really matter that it’s storing into RAM, as you’ll be replacing the same symbols over and over, not adding to it. The reason it does this is to speed up processing of things if done a second time, so in MikeS’s patch, it might be totally appropriate, if it’s not causing problems then why change it :) That’s not to say that there aren’t multiple ways of doing just about everything in max/msp, none of them are "best" in every situation. –
Since coffencigs is wanting to control audio playback, line~ is far more appropriate to use than line. You want to be controlling audio-rate processes at audio rate most of the time, or you’ll end up with clicks and glitches.
The pack>message>line~ method is a perfectly good way of doing it; simple and it works. If you want to be really pedantic, you could say that it’s inefficient because the message object will have to visually refresh often, wasting resources. However this is not something to worry about unless you start running into cpu-limits. I think also, that if you put it in a sub-patch/made it not visible in some other way, then it being a GUI object wouldn’t matter, as it wouldn’t have to refresh.
My advice is to just use pack>message>line~ and not think about all these little worries until you think they might be causing a problem, which is unlikely to happen. If you don’t like message, you could do it like this:
----------begin_max5_patcher---------- 571.3ocyWtrbaBCEFdM7TnQqc6fDWBzGjtoSlNBP1QofjGPdpaxj7rWcAZv0 1APlP6Fwfj3n++ON5H3YeOXt3HsEB9B3a.Oum887Lco6vq6dOXM4XQEo0LMX gntlxkvM1wjziRS+kGZHRlf2OvVAW1xdhpGDg+bPW26anspG2L0u2PKj10NJ IQME.JPOSPPWC39tmhenlwqnRiDP8ghHKdfw2MHL3r.aXLWRP5VL5z.INH6i TunXkFKHxe7Sn3gFfSpMF.9UZSIgSf5gdw2W2r4FAFkW5FqBSS09J9taCUHy iFGqaCCcfTQqEoZkjF4HrZp1FEMz1YNX6vk11pkLm17ZeXqEklPhmggwuigs VEiLWhSNywsrcFqNLxCP.9BHH3cQP2X1XH+0dpUH5EhSpfa.vsUBhRd26Brn +TIgyRQpXb5qvEkXHasjH7H4HW.PY2HexI7ctgGEYUpaY2qbmMyIX9bH0INX yN93wv0JuFjZOCI61puFM7nHWnWx+0zalmy3dRT7+JLbkRMOUAZn6VpZMo1Z M1RNQQyGOgNgGMYVTprm7CvVv1EBKcIMHrEKicLM5brfcCKKIRjf74AjwKE2 AjPGxSPNADytmKehsYoMG79W++fQ959OEYshCME8wsSQ.zeLPIsUx31eg3s4 nNIE7lIefUVR4C+vrZV4dAiK6jvUd8MGEELhhBWUEkMAEo+brUTRgSPRq6qs zo.oUUQISPQ3SR++nUT7DUz5wH7D2r4JiT27h+uArTs4j. -----------end_max5_patcher-----------
you can not do it with pack, because you need "float, float float"
i usually put a [t l 0] between my lists and line
Maybe I’m misreading your post Roman, but are you saying that pack doesn’t work with floats?
It works with pack and floats :) I’m not sure why you need a [t l 0] before line? That would truncate any input floats to int.
usually you want to set a line before starting it, right?
maybe i am mistaken, but when i hear something about "line format" i am
thinking of the MSP line~ object, where "float, float float" would the normal
way to trigger it.
and consecutive messages are not to be packed into a list ;)
I’ve overlooked the fact that [message] will screw with the comma. You need to do it like my example, which I think is pretty much what Roman was suggesting as well. Sorry for the confusion :)
Cheers for clearing that up Raja – I thought it would work!…………..I mis-understood Roman’s reply and double-checked the ($1, $2 $3) way with it outputting to the right inlet of another message, which of course screwed with the comma – making me think it wouldn’t work with line/line~…………….I’m silly :)
How does this [t l 0] method work?
It works the same way as my example in my first post, except you’re always sending a value of 0 as a start value for line, while my example has a variable start value.
gotcha, i’ll see what difference it makes to my patch
----------begin_max5_patcher---------- 354.3oc2T9saBBCFE+5xSQSulYJUTm6t8bLMKEnSqCZIPIiMiu6i9AnnQQbI yK7lR5o+46b9UZ25fHA5RQNA+B9MLBs0Ag.Iq.poOhjvKCi44vzHJwW5fMD2 5gLhRCHmlIUlV0OzJSt7GgcDO1HZirpHQWXhEFXmZUS4lv0R0p2yDglZmvlV slpUBeF6aaYzQT7xlkHifZV4iml0slJdBTSxqYRdL4PYkp1p5Y0143XabGZj KRBDY2T3XMp0RluSE0Ii.TBSB3pUj844LHvi8rM1S.DLg1GBl9fhf4igieuq S.+GTBvlYS87qC.18..W3hO+SLEuXgaUK8lvi2kvS+LAtQLmV+BgWuTw+VuZ 32gKvNRhkpSeeDLkU+XXkqKxBaiv9xiO3rHQtQp3FoV0YVyNZNqkQQBU2mGS jQo5peXZLAd4YO5FrmFfiN02+2dxevdhc27zzA6ow+QOU0Ymyufj4fKT -----------end_max5_patcher-----------
The comma in a message box is just shorthand for separating things. In the discussed case of line~, it is used to send an 0, followed by a list of value time pairs. This is no different from starting your list of pairs with 0 0.
Forums > MaxMSP