Hello folks! I am looking forward to integrating PycoGL to animate visuals with Strudel as demonstrated in https://www.youtube.com/watch?v=M7U3vGOQsTc . I'm not familiar with strudel or hydra, so perhaps what I'm trying to do is already possible. Please let me know how to achieve this effect.
Here is what I propose:
// Setup a canvas and start the animation frame loop
await loadShader`
in vec2 fragPos;
out vec4 fragColor;
// The modulation targets
uniform float iColor;
void main() {
vec3 col = 0.5 + 0.5*cos(iColor+fragPos.xyx+vec3(0,2,4))
fragColor = vec4(col, 0)
}
`
$: n("bd")
// Update the shader uniform when the track play a note
.shader({uniform: "iColor"}
In the code linked in the video's description, I found how to get the track events using this.onTrigger
. However, how do you send the values to the process running loadShader? Is there an example where events from one track are sent to another track?
Then I would like to set different value per notes, for example with an array like uniform float rotations[4]
. In the demo I used two strategies:
- seq, to set a new value for each event by incrementing an array position counter.
- pitch, to set a value per pitch by assigning a new array position for each note value as they come.
Lastly, the values need to be processed to achieve a smooth effect. For example, I hard-coded the following function to prevent sudden jumps, but perhaps this should be user-defined using regular Strudel signal functions:
const decayModulation = (decay) => {
let val = 0;
let desired = 0
return {
get: (ts) => {
val += (desired - val) / decay
return val
},
set: (v) => { desired = val + v },
}
}
I think having this capability integrated in Strudel would be great, and I'd be happy to do the work. However, I'm not sure how to proceed, so please let me know if this makes sense!
Cheers,
-Tristan