Adding to sample based on value

Hi everyone,

I’m having something that I think is a simple problem, but I can’t figure out how to get it to work.

I have chop A with 5 samples, all the value of 0.

Then I have a constant that can have the values 0-4. Whenever the value of the constant changes, I want the sample of A that corresponds to the value, to be set to 1.

So for instance, chop A is 0, 0, 0, 0, 0

When the constant changes to ‘2’, chop A becomes 0, 0, 1, 0, 0
Then when the constant changes to ‘4’, chop A becomes 0, 0, 1, 0, 1.

I hope that makes sense. Any help is appreciated.

One approach would be to first fan, then shuffle your constant CHOP. Something like this:

base_int_to_multi_sample.tox (430 Bytes)

You could also do this with a CHOP execute to change the values in table which you then convert to a multi sample CHOP channel.

Some CHOPs such as the Pattern CHOP have a ‘sampleIndex’ and ‘chanIndex’ member available that are often useful for this sort of thing. Something along the lines of this could be used…

1 if me.sampleIndex == op('constant_val')['val'] else 0

sample_index.tox (510 Bytes)

Great, thanks for the replies. I had gotten it working with a chop execute, but didn’t know about the Fan chop, that’s exactly what I need.