how to parse line~ formatted output of function?

Jun 10, 2008 at 1:26pm

how to parse line~ formatted output of function?

I’m using ej.function.js and mxj~ curve instead of function and line~ (but they are similar) and I need to operate on the list before it reaches mxj~ curve. The second outlet of ej.function.js (and function) outputs a list in ‘line’ format, which is this: initial value, THEN a list of three more values. With function, it’s a list of just two values: destination, time. With ej.function.js, it’s a list of three: destination, time, curve factor.

How do I separate the initial value, which is output as a separate event, from the (second) list? I want to preserve that initial value, but operate on the second value in the second list (time) while preserving the order of events, etc. when sending to mxj~ curve.

Thanks!

#38320
Jun 10, 2008 at 1:30pm

Part of what makes this difficult for me is that the list won’t always have the initial value, then a list of three. That’s only if function has a single line. If there’s more than one segment, there will be that number of lists of three values, but only one initial value for the entire event.

#133378
Jun 10, 2008 at 2:11pm

maybe i’m not following something as my solution seems a bit too easy!

but have u tried using [zl slice 1] then taking the rest of the list from the right outlet so that u can process further…

hth,

j

#133379
Jun 10, 2008 at 2:20pm

On 10 juin 08, at 15:26, matt wrote:

> I’m using ej.function.js and mxj~ curve instead of function and
> line~ (but they are similar) and I need to operate on the list
> before it reaches mxj~ curve. The second outlet of ej.function.js
> (and function) outputs a list in ‘line’ format, which is this:
> initial value, THEN a list of three more values. With function, it’s
> a list of just two values: destination, time. With ej.function.js,
> it’s a list of three: destination, time, curve factor.
>
> How do I separate the initial value, which is output as a separate
> event, from the (second) list? I want to preserve that initial
> value, but operate on the second value in the second list (time)
> while preserving the order of events, etc. when sending to mxj~ curve.

You don’t need to do anything specific, when ej.function.js is in
curve mode, it outputs triplets that will be properly interpreted by
curve~ (or [mxj~ curve] I think). Have a look to the curve supbatcher
in ej.function help file.

Cheers,
ej

#133380
Jun 10, 2008 at 2:20pm

Thanks.
Yes, [zl slice 1] cuts off the first value of the list but has no effect on that ‘initial value’ that seems to come as a separate event, but which I need to preserve.

raw output is pre-manipulation from ej.function.js. the two look like this in the Max window where the ‘Object’ is a [print] with the appropriate name:

Object Message
sliceL 0
raw 0
sliceR 340.375 0
sliceL 340.375000
raw 340.375 340.375 0

#133381
Jun 10, 2008 at 2:30pm

Thanks, Emmanuel, but I am trying to scale the time value of each segment in the ej.function object. I had some help in another thread but thought I could clarify/simplify a bit and work on a more specific problem but it seems like we’re back to my overall ‘problem’, which is to multiply the ‘domain’ of each segment (up to 43), on the fly. I got that far with some help from Martin Robinson but when I tried incorporating it with a waveform object that lets me select a specific range of the sample, things didn’t work as expected and I noticed the manipulated list (in Martin’s solution) had a slightly different format from the raw list which may be resulting in the ‘pitch’ of playback not remaining constant, i.e., getting higher as the area of selection decreases or the position in the buffer gets closer to the end and getting lower as the area of selection increases of the position in the buffer gets closer to the beginning.
anyway, i might as well just post the whole patch. it’s not my ‘production’ patch but it includes all of the vital parts to making it work the way i want. i really appreciate anybody taking a look!
in this patch, you should be able to use the multislider, which updates dynamically to display the number of modifiable ‘domain’ values, 1 for each segment, to increase or decrease the time value, while creating new functions to loop through the sample and using the waveform object to select the portion of the sample to play back. if you want to observe how it’s supposed to work, without the ‘domain’ modifier functions, connect ‘route function0′ directly to mxj~ curve. you can also sub. curve~ for mxj~ curve (but linearity won’t be total at 0.0 curve factor).
now, to the one or two people still reading, you can observe the output of the raw and processed list in the Max window under ‘raw’ and scaled.

#133382
Jun 10, 2008 at 4:49pm

right that explains the problem better…

havent had time to look at ur big patch, but i got another idea that might be useful:

[function] second output > [route list]

left output of route object is the function value time list.
right outlet of route object is the function int.

or u can check the attached patch (if the C74 server is feeling friendly!).

j

Quote: cebec wrote on Tue, 10 June 2008 15:20
—————————————————-
> Thanks.
> Yes, [zl slice 1] cuts off the first value of the list but has no effect on that ‘initial value’ that seems to come as a separate event, but which I need to preserve.
>
> raw output is pre-manipulation from ej.function.js. the two look like this in the Max window where the ‘Object’ is a [print] with the appropriate name:
>
> Object Message
> sliceL 0
> raw 0
> sliceR 340.375 0
> sliceL 340.375000
> raw 340.375 340.375 0
>
>
—————————————————-

#133383
Jun 10, 2008 at 5:15pm

That does work, thanks!!! And it’s simple!

I’ll continue testing and refining and get back to this thread with any further questions.

#133384
Jun 10, 2008 at 5:30pm

route is one of those objects that can be [ab]used in more ways than one… happy patching!

j

#133385

You must be logged in to reply to this topic.