This project has moved. For the latest updates, please go here.

increase volumne of PCM file into byte array

Jan 26, 2014 at 1:51 PM
Dear Experts,

I have a PCM file Byte array , 16 bits , 8KHz sample rate , signed , Mono. I need to increase the volume of this data eg by 3 times current volume. My approach is :
1- convert this byte array of single ( samples are 16 bits so each 2 bytes will be one "Int16" number

2- multiply this value by 4.
4- covert this number back to bytes
5-save to byte array.

Is this approach the correct & fast one . or you have another ideas.

Jan 26, 2014 at 6:54 PM
Your multiplier in step 2 is wrong... You'll want to calculate a 4.5 decibel increase to come up with the correct one. You only have to calculate it once.

Try looking on $SEARCH_ENGINE for "PCM amplitude to decibels" for the appropriate formula.

I'd also recommend looking at WaveBuffer for a simpler way to do steps 1, 4 & 5.
Jan 26, 2014 at 9:21 PM
Dear ioctlLR ,

Great and simple. Thanks man. really appreciated.