Hello Guest

Generating texture from Sound

  • 1 Replies
  • 3209 Views
Generating texture from Sound
« on: November 21, 2014, 14:13:40 »
HI,

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

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:
Code: [Select]
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?
« Last Edit: November 21, 2014, 18:03:58 by andre111 »

*

Kai

Re: Generating texture from Sound
« Reply #1 on: November 21, 2014, 22:06:11 »
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: https://sites.google.com/site/piotrwendykier/software/jtransforms