micpool's picture

I'm stuck again. I have processed incoming OSC to produce a list of 6 cue IDs and a list of 6 Boolean values

I want to produce a list of the 2 cue IDs which correspond to the TRUE values in the second list.

I can't work out which nodes would allow me to do this.

Thanks

Comments

Mmm. Yeah unless I'm

Bodysoulspirit's picture
Submitted by

Mmm. Yeah unless I'm overseeing a simpler method with built-in stock nodes, you have to convert the booleans to integers, sum the integers to know how much ones there are, then cut the list of integers and feed that to a Get Items From List node. See joined composition.

I'm really only starting to dig into custom node creation, so no real memory management & optimisation yet, but joined is another composition with a custom node that outputs the indexes of the true booleans in a list. Just connect that one to a Get Items From List You have to have the custom node in a folder called "Modules" alongside your running composition, or install that node in the Vuo modules folder in application support if you wanna use it system wide.

mic

micpool's picture
Submitted by

mic

Thanks for your solution.

Sorry, I probably didn't explain what I was trying to do fully.

List 1 is a list of all current ids which can have any number of items

List 2 is a list of a value for each of the cue ids in list 1

The list I need to produce (List 3) is a list of all items of list 1 whose value in the corresponding position in list 2 is equal to a test value.

List 1 and 2 have the same count of items and any number of items of list 2 can have the test value.

BodySoulSpirit

micpool's picture
Submitted by

BodySoulSpirit

Thanks for your solution which is brilliantly simple. I've learnt some very useful things from it.

However, I have come across a rather bizarre problem which I don't understand.

When the list of positions in 'Get items from list' is an empty list, there is still output from that node, and the output is not valid. Is this a Vuo bug?

Yes I'm seeing it that too.

Bodysoulspirit's picture
Submitted by

Yes I'm seeing it that too. Seems to be related to the nodes calculating the integer positions list because if I simply try with a share list, even set to an empty list, it works.
For now, until a team member answers, you can try to use my custom node if possible, doesn't seem to be affected.

Thanks Michele

micpool's picture
Submitted by

Thanks Michele The problem with this solution is that with repeated operations, which are needed to have this behave responsively to changing incoming OSC, your counter will continue to increment. This can be solved by substituting with count within range which is about as far as I got with a solution that is similar to yours.

As far as I can see it still doesn't work when repeatedly fired. The enqueue is problematic, in that to work it would need to know how many true values there were, otherwise it will contain duplicates which is easily fixed, but also the values in the queue will ripple upwards which changes the order of the list continuously.

Thanks very much Michele

micpool's picture
Submitted by

Thanks very much Michele

That seems to be a good robust solution. I can't break it.

Attached is a zip file with a QLab test workspace and a Vuo composition which receives OSC from QLab and processes it using both the methods in this thread. Yours in Green, BodysoulSpirit's' in orange.

Interestingly both show exactly the same results for the positions list , However when audio cues have been run and stopped, BodysoulSpirit's shows a different list output. If all cues are stopped together it actually shows a list of 3 empty items. I've played with this all morning and can't work out what the difference is.

Thanks for the help you both have given with this.

Having said I couldn't break

micpool's picture
Submitted by

Having said I couldn't break michele's solution, I now find I can. The first version of my app output whole second timers only and so I was running the fire periodically node at 2 events per second. I had tested this version on a 2008 MacBook Pro running 10.11, a 2012 MacBook Pro running 10.10, and a 2018 Mac Mini running El Capitan. I then added the ability to display 1/10 seconds so had to increase the fire periodically node to 20 events per second (0.05). I tested this on the 2008 MacBook and it ran fine.

However when I tested it on the 2018 Catalina Machine the fire periodically node was dropping events like crazy which meant that Michelle's solution which requires precise synchronisation of data through a chain of update and clear nodes went completely haywire. I don't know if this is a Vuo thing or a Catalina thing and don't have the time or the inclination investigate further. However I wanted to tidy up the app so it would at least run on that machine, just not updating the time (effectively the 1/10 seconds) on the dropped frames.

I decided to look agin at Bodysoulspirit's matrix multiplication solution again , and managed to get it to work. It would appear that the 'Get Items from List'Node is behaving differently when presented with an explicit empty list, or a list of integers which changes to an empty list. although I don't understand the difference.

This works because it checks to see of the list produced by the reverse node is populated and if it isn't sends an explicit empty list of integers. It doesn't make any sense to me, that this should work but the original didn't but I have filed it as a bug report to see if this is intended.

Thanks both for your help again,

Mic