I use socket to send some voice data to another PC and I encoded my data before sending it using ALAW with this "setup":
AudioFormat.Encoding.ALAW,
8000.0f // sampleRate
8, // sampleSizeInBits
1, // channels
1, // frameSize
8000.0f, // frameRate
false); // bigEndian
The problem is, it generates a small (but quite annoying) noise at receiver side when I don't speak anything at the microphone. When I speak, the noise is almost gone but not entirely.
When I change to ULAW (exactly same "setup") the noise doesn't exist at all, the sound is very clear.
Is there anything I can do about that? Is there any recommended setup to use along with ALAW? I really need to stick to ALAW because ULAW causes me some mess in the code (and too much modifications would be necessary).
Side note: I printed the buffer and without speaking to microphone it has lots of 8,-1,8,-1,8,0,8,0 type of pattern. I tried to force all 8 to become 0 but still not big difference. I tried that because with ULAW there are many 0's when I don't speak instead of 8's as for ALAW. This pattern that I'm talking about is from the (convert ALAW to PCM) PCM before being sent for playing by sound card. I took conversion algorithm from here if it is important: ALAW PCM Conversions