Controlling volume in ofSoundStream for each channel separately

Hi.

I am sending sinewaves to 6 audio channels with the ofSoundStream class. My question is, how to control the volume for each ofSoundStream channel ? Is this possible?

I looked over the docs and the ofBook’s sound section - there wasn’t any references to volume control.

The only volume control I found was using the ofSoundPlayer class.

Is there a way to send ofSoundStream data directly to the player and control the volume there? If so, then do I need to create a ofSoundPlayer for each channel ?

Or is there a smarter, better way of implementing this feature ?

Edit

I looked the sound/audioOutputExample , but it did not work as expected, no sound came from the speakers. soundPlayer example worked.

OF v0.9
Visual Studio

Thanks in advance!
Jaan

you just need to multiply the wave, the values in the output buffer, by a value between 0 and 1 which will work as a volume parameter. you can do so per channel just by using different volume factors for each channel

1 Like