O'Reilly logo

openFrameworks Essentials by Denis Perevalov, Igor Tatarnikov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Capturing sound from a sound card's input and measuring its level

openFrameworks has an opportunity to capture live sound from a sound card's input, such as a microphone or a line input.

Note

The code in this section will work properly only if your computer has a sound input. Most probably, your laptop already has a built-in microphone. If your computer has no sound input, you can use an external sound card connected via USB or any other type of connection.

To enable sound capture and measure its level, perform the following steps:

  1. Add the declarations of a new function and a variable to the ofApp class:
    void audioIn(float *input, int bufferSize, int nChannels);
    float soundLevel;

    The first line declares the audioIn() function, which will be called by ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required