simple microphone volume


whats the simplest bit of code to just get the volume levels off the microphone?


Here is a list of my devices

I open a device like this:

ofSoundStreamSetup(0, 2, deviceid, this, 44100, 256, 4);  

devices 3, 4, 5 open ok & I get messages back into audioReceived.

However in my audioReceived function I have…

    printf("audio received %i %i\n", bufferSize, nChannels);  
    for(int i=0; i<bufferSize; i++){  
        printf("audio (%i) = %f\n", i, input[i]);  

For device 5 I get audio = 0

For devices 3 &4 I get …

Does that look right? Do you know why the - minus numbers?


Hey Chris,

The numbers are minus because they are floats representing an audio signal. Values can go from -1.0f to 1.0f.

Cards 1-2 (output) and 3-4 (input) are the same card…just reported as different devices.
The digital output won’t be sending anything so zero is fine. It’s card and OS dependent how you might set up the digital output.

You can reduce the MIC input by running a function on the input values. This could be as simple as multiplying it by 0.5f (halving the input) or something more complicated.

Hope that helps!