Does anyone knows why after I apply this algorithm in c++ to reduce the volume of a pcm apears a white noise in the background?
for(int i = 0; i<pcm.length(); i+=2) {
quint16 byte0 = pcm[i];
quint16 byte1 = pcm[i+1];
//merge byte0 and byte1
qint16 n = (byte1 << 8) + byte0;
n *= volume; // multiplier;
//split n into byte0 and byte1
byte1 = (n >> 8) & 255;
byte0 = n & 255;
//save the new values
pcm[i] = byte0;
pcm[i+1] = byte1;
}
After a long time, I come with the solution. The problem was the mode that I was merging the two bites.