Generating texture from Sound

Started by andre111, November 21, 2014, 14:13:40

Previous topic - Next topic



I'm pretty new to LWJGL/OpenGL/OpenAL/... but I'm currently trying to create a small programm which can display shaders from

I got all of the basics working, the shaders get loaded and compiled and can be used. I also got adding basic textures working.

But the main reason I wanted to create this programm is to have sound visualisations calculated by shaders. The shaders on shadertoy can do this because they get a texture supplied which has at y=0 the "spectrum as grayscale values" (don't really know the correct term for that) and at y=1 the "waveform". Just write a simple shader to see the texture if you don't know what I mean.

Don't forget to set channel0 to a music clip:
void main(void)
	vec2 uv = gl_FragCoord.xy / iResolution.xy;
	gl_FragColor = texture2D(iChannel0, uv);

Is there a way to generate this kind of texture based on a current music clip that is played?


As far as I know, OpenAL does not feature frequency analysis of waveform data.
You need to process your pulse-code-modulated data via a fast fourier transformation yourself before feeding that data to OpenAL.
There is also a Java library for that: