This project has moved and is read-only. For the latest updates, please go here.

Hissing sound when volume low with Volume Sample Provider

Nov 5, 2013 at 6:40 PM
I have integrated the Volume Sample Provider code into my Custom Panning Provider class. When the volume is lowered through the UI, I adjust the volume to the left and right channel before I make the panning adjustments.

This method seems to work, but when we lower the volume, I hear a hissing sound. How can we eliminate that?

I basically do the following code:

this.sourceBuffer[n] *= LeftVolume
this.sourceBuffer[n+1] *= RightVolume

Where in my case, left and right volume are the same values (somewhere between 0.0 and 1.0) and after I adjust volume factor, I make a panning adjustment based on either or not the original audio stream is stereo or mono.

Thoughts?

Paul
Nov 6, 2013 at 10:31 AM
is the audio in the source buffer definitely stereo?
Nov 6, 2013 at 2:00 PM
I found my problem. When I looked at the panning code for a mono stream, I was doing the same volume code to the current element and the next element, even though I was advancing through the buffer one element at a time:

the following code segment:
this.sourceBuffer[n] *= Volume
this.sourceBuffer[n+1] *= Volume 
became this:
this.sourceBuffer[n] *= Volume
and the hissing went away.

Thanks for the tip....

Paul
Nov 6, 2013 at 2:18 PM
On another note, anyway to apply volume settings to a WaveProvider buffer?

Paul
Nov 6, 2013 at 4:23 PM
Just noticed the VolumeWaveProvider16, which works with 16-bit PCM, which is what we are using. Does it work with both mono and stereo streams?

Paul
Nov 8, 2013 at 8:24 AM
yes, should do, although it will hard clip any samples that go above maximum.
Nov 8, 2013 at 10:30 AM
thanks....our volume setting is always between 0.0f and 1.0f (floating value anyway), so we never go above that anyway and do not have to worry about any hard clipping.

Thanks
Paul