-
Book Overview & Buying
-
Table Of Contents
OpenFrameworks Essentials
By :
Real-time analysis of sound lets us create audio-reactive visuals. It is an important part of any video synthesizer. Here, we consider the simplest case of analysis—getting the level of sound and using it to control a parameter of our project.
We consider two ways of getting a sound: by playing an audio file and by capturing a sound from the sound card's input.
openFrameworks has a powerful class for audio file playback, called
ofSoundPlayer. It loads an audio file of various formats, including MP3, WAV, and AIFF, plays it, and controls its basic parameters, such as volume, pan, and speed.
Let's use this class to play an audio file by performing the following steps:
Add the audio player object definition to the ofApp class:
ofSoundPlayer sound;
Load an audio file and set up its parameters by adding the following code to setup():
sound.loadSound( "skvo.wav" ); sound.setVolume( 0.8 ); sound.setLoop( true );
The...
Change the font size
Change margin width
Change background colour