Read CHOP Array inside GLSLPop

Hi!
I’m trying to read a multi channels LFO CHOP inside a GLSL POP passing throw an Uniform Array but I don’t understand how to do.

If i write this:

float lfoValue = lfo[0];

it seems I get the first value of the array. But if I change the index to “1” I receive the error “array index out of range ‘1’”.

I think the solution should be simple but I still don’t find what is. :slight_smile:

testArrayGLSLTOP.toe (4.4 KB)

Hi there,

The ‘type’ parameter of your glsl array is set to ‘float’. Which mean it only takes the first channel of every sample. If you set this to vec4, it will take the first 4 channels. This is the maximum amount of channels to read into 1 variable (there is no such thing as a vec5, vec6 etc).
In your case I would use a shuffleCHOP to transform your chop into 1 channel with 10 samples. This way you can read them like lfo[0] to lfo[9] as a float.

Hope this helps.

Cheers,
tim

It really helps! Thanks a lot Tim!

1 Like