Shadertoy Audio Analyzer Shaders

Greeting to all creators
How can we convert Music inputs from Shadertoy to audio analyzers in SparkSL?
Shadertoy uses one vec4 channel as input for entire music analyzation but in SparkAR we can not connect audio bands to a texture input and beside if we do, it can only take 1 audio band, how can have multiple audio band inputs?
Thank you for your help and if you can send me a converted sample so that I can fully understand.

vec4 soundWave = iChannel0.sample(vec2(abs(0.5-uv.x)+0.005, uv.y) ).rrrr;

This is what happens when we connect audio analyzer patch to a music input
instead of having multiple bars going up and down based on amplitude, it just appear and disappears!

You will need to create a texture from the audio analyzer frequencies. It’s not a full FFT analysis though - you only get 8 frequency groups in spark, unfortunately.

Here’s a project that does it: Audio Analyzer Visualizer

And some more context:

You mean I have to build the audio visualizer from scratch using SDFs inside SparkAR?
Isn’t there any way that we can connect a vec4 (RGBa) channel that is coming from shader to audio analyzer frequencies?

Yeah, Spark doesn’t auto generate any rgba channels from audio analysis like shader toy does.

1 Like

how about the manual way?
can we somehow make The Spark AR generates RGBa with adding some more lines of codes inside the shader?
and for this specific shader, only R channel reacts to changes of audio frequencies and other channels are unimportant.

You can see how to generate a visualizer texture in that project I linked to, but you’ll find the real problem is the lack of data we get from spark. I think FFT in shadertoy is probably something like 256 frequencies, but spark only gives us 8. You could interpolate between those values but it won’t be nearly as exciting as the shadertoy shader