ofDoc > sound > ofSoundStream

ofSoundStreamfile

Functions

ofSoundStreamclass

Gives access to audio input and output devices.

ofSoundStream controls access to your computer's audio input and output devices. For example, you could use an ofSoundStream to get live input from a microphone, or generate sound in realtime for your computer's speakers.

A typical openFrameworks app will use just one ofSoundStream, and you might not even need to use this class directly at all if you don't need to query things like the sample rate or buffer size. In order to start receiving or generating audio, your ofApp should implement either ofBaseApp::audioIn() or ofBaseApp::audioOut() respectively, and then call ofSoundStreamSetup(). You can find examples of this in either the audioInputExample or the audioOutputExample.

Starting a stream with 0 input or output channels will prevent audioIn() or audioOut() from being called, respectively.

Some platforms (iOS, for example) will expose additional platform-specific sound stream functionality. See the platform-specific examples for demos.

Warning
Be aware that audioIn() and audioOut() will be called on a different thread from your app's update() / draw() thread.

Functions

setup ()
start ()
stop ()
close ()