Playing and capturing music



Playing mp3 files

Audio Player View

Synthclipse is equipped in an Audio Player which makes possible to play MP3 files. Played music can be accessed in shaders from a texture containing wave form and frequency content of the instantaneous audio signal (Just like in the Shadertoy). The texture should be of type sampler2D and it should be marked with the Music Uniform Control command:

uniform sampler2D MyMusicTexture; //! music[]

The texture has dimension 512x2 pixels. Its first row consists of a frequency content and the second row consists of a wave form. So to access the frequency you should sample it like this:

float frequency = texture2D(MyMusicTexture, vec2(x, 0.25)).x;

// where x should be between 0.0 and 1.0.

and to get the wave form, like this:

float waveForm = texture2D(MyMusicTexture, vec2(x, 0.75)).x;

// where x should be between 0.0 and 1.0.

For a simple audio shader example go to the main menu -> Synthclipse -> Fragx examples and select Synthclipse / test-music.fragx.

Audio Example

Capturing Line-in / Mic-in

Synthclipse is also capable of capturing line or microphone in instead of playing mp3 files. To capture such input go to the Audio Player View, stop the music (if anything is playing) and press the Record audio input button. In Choose Input Device dialog choose desired device and press the OK button. Now you can access Line-in / Mic-in audio signal from shaders just like in case of MP3 files - using an audio texture (see section above).

Recording Dialog

Shadertoy audio shaders

Moreover Synthclipse makes possible to import, create and playback Shadertoy audio shaders. Such shaders do output a wave audio signal instead of generating images. The audio shaders have .sau extension and must be explicitly attached to a main (*.stoy or *.fragx) shader using the Audio command. To get impression what the Audio shaders are try to import this great shader by nimitz: Music Toolbox