Depends on how sound would interact.
As for how deep the rabbit hole is, adding a new slider (and variable it can control) should be 3-4 lines of code. “Scaling the radius” = multiply the radius by the new variable (which should have a value that varies from 0 (which will mean no rainbow, just the changing color) to say 10, meaning at most it’ll multiply the radius by 10 (which means it’ll be 7ish at most). Hue is a value that loops at 1 (so at 1.01, it’s like .01 again), so it’ll make 7 bands of rainbows. Below 1, it’ll stretch out the rainbow, making wider bands of colors.
So let’s figure out to add sound to this:
The expansion board returns a few sound related variables, including an array of 32 values that condenses the sound it hears. (Think of the classic sound bars, you’d have 32 of them)
It also returns the loudest frequency it heard.
So the easy way: adjust radial length to be influenced by the loudest sound. Now your rainbow circle will pulse depending on the music.
More involved: we didn’t calculate the angle only the radius, we just did a full circle. What if we did? The formula for the angle is atan2 ( y / x ) [corrected from atan]
[Note there was a bug in PB for atan (aka arctan) fixed in most recent firmware, so make sure you’ve updated]
So dividing the circle’s angles into 32 pieces, we could adjust the radial length by the value of the matching bucket… And now it’ll make 32 rainbow arcs that change according to the sound it hears.
I’ll post the code for this in a few days, give the folks who want to learn PB coding some time to try it themselves.