Sounds are a necessary part of many interactive and entertainment projects. They increase the level of immersion and add feedback to the interactions. Also, sounds play a central role in sound art projects. In this chapter you will learn how to play sound samples, synthesize new sounds, and get sounds from the microphone. Also, you will learn how to get information from sound using its spectrum and use it for controlling visualization parameters:
- Playing sound samples
- Generating sounds
- Using a microphone
- Getting spectral data from sound
Codes and executables for Windows, openFrameworks 0.074, Visual Studio Express 2010 C++: Download
Consider a ball bouncing on the floor. Let the ball jump in the left or right direction after each bounce and let’s play a sound sample at each bounce, with the speed (and hence a tone) of the sample depending on the ball position. Over time, some random sequences of samples with different tones will be played. It is a piece of computer-generated music, based on physical modeling.
This example plays several looped samples, slowly changing its volumes.
The volume changing is implemented using Perlin noise.
This example synthesizes PWM-sound. The mouse position change parameters: x – frequency, y – PWM-value.
Image to Sound
This example transcodes central horizontal of the image grabbed by webcamera to sound.
This example records and plays short sound sample. Press “1” for recording, and press “2” for playing.
This example draws points cloud and plays music track. Also it analyzes music spectrum and use this data for controlling the radius and shuffle of the cloud.
Music track “surface.wav” by Ilya Orange (soundcloud.com/ilyaorange)