Add audio to animation which volume changes according to values?

Hi guys!
I managed to create an animation composed by a left side and a right side: it represents the right and left hemisphere of the brain.
Data are coming from arduino on two channels (one for left and one for right hemisphere): the animation basically increasse the opacity of the side which values are higher.

I would like to add a sound which changes its volume too: so for example, if the signal is higher toward left we increase the volume and if it is higher toward right it decreases. Any ways to do something like this?
Thanks in advance

here’s an example

play with the values in the constant “input_from_arduino”. If left is higher, volume increases and vice versa

We use a Shuffle to convert the two input channels to samples, then use an Analyze CHOP to get index of the sample with maximum value. We use that output to set the volume, using a Lag CHOP to make volume fade in/out over 1 sec

change_volume_based_on_input.tox (14.9 KB)

Hi, thank you so much!
I’ll try to do this asap, thanks again