Posts tagged with “fft”

After making some tests with Java OpenGL (JOGL) in Eclipse, I decided I should try OpenFrameworks again to delve deeper into OpenGL. The main problem with JOGL is that it’s a “layer” on top of the original OpenGL API; some things are different and often more complex in JOGL (for example the need to pass ByteBuffers instead of arrays).

This audio visualization is a simple exercise with FBOs, VBOs and shaders. An audio-reactive particle system (512 quads) is rendered to a FBO and applied as texture to a cube. This cube is then rendered to a second FBO, which is applied as texture to a second cube. There is a slight blur effect made with GLSL shaders. The stripes result from the way the cube was UV-mapped, an unexpected effect that turned out interesting.

At a 640×480 pixels resolution, framerate varies from 30 to 60 FPS in my computer, equipped with a GeForce 6200 (I need to upgrade my PC).

Jaded Afghan is one of the best tracks on their 2007 album This Is The New and also a song well suited to my beat detection algorithm (based on this gamedev.net article — look for “frequency selected sound energy algorithm #2”).

Inspired by this thread (especially comments from Chris O’Shea and Dave Bollinger), this Processing sketch has two modes: capture and render. In capture mode, there’s audio playback, FFT analysis and beat detection — the resulting data is saved to a text file. In render mode, there’s no audio: all data is retrieved from the text file and PNG still frames are rendered. It took approximately 1h30 to render the 6779 frames for this video, at 800×450 pixels, 24FPS. The movie file with audio was assembled in Adobe Premiere.

It’s highly recommended to download the original 170MB Quicktime file — the link is at the bottom of the page, below “Statistics”. A Vimeo account is required, but it’s free.

The song is Second Trace by Filipino band Moscow Olympics, from their recently released debut album Cut The World. Although the band’s musical references are clear (post-punk, shoegaze), their music has that ineffable quality that makes it stand out.

Playing with computeSpectrum() and PV3D 2.0 alpha (Great White). The mesh reacts to sound by having its vertices moved along the Z axis (X and Y coordinates are fixed). Had a problem with FlatShadeMaterial failing to render on regions of coplanar faces; small creases were made in the mesh to fix it.

Sound analysis was made with SoundMixer.computeSpectrum(), FFTMode set to true (a frequency spectrum results in a more interesting visualization) and stretchFactor set to 4. Increasing the stretchFactor value means analyzing a smaller frequency range of the sound —thus ignoring non-audible high frequencies. The 16×16 vertex grid represents the average values of left and right channels.

Music Is Music As Devices Are Kisses Is Everything (5:20) by 65daysofstatic (from the 2007 album The Destruction Of Small Ideas) is the song; a nice fit for this visualization because of the contrasting quiet and loud parts —the visualization of the piano notes in the quiet sections is very clear.