I am trying to encode pcm raw data as uLaw in order to preserve the bandwidth needed for voice data transmission.
I met the UlawEncoderInputStream class on this page , but no documentation !: (
The constructor accepts the input stream and the maximum pcm value (whatever that is).
public UlawEncoderInputStream(InputStream in, int max) {
After looking at the code, I suspect that I should calculate this "max" value using the supplied function: maxAbsPcm . The problem is that I really don't understand what I have to pass into it! I write my raw pcm to a file on the SD card, so I don't have one resident continuous memory data array to transfer this.
public static int maxAbsPcm(byte[] pcmBuf, int offset, int length) {
Another problem I use with this code: I'm not sure what values ββto write for the header for the uLaw data. How to determine how much less byte data after encoding with uLaw?
I listened to one of the (potentially) ULaw encoded files that I created in the VLC media player (the only player I have that will try to read the file) and its sounds are disgusting, broken and ticklish, but can still make out the voice.
I am writing my wave header using code similar to the class I found called WaveHeader, which can be found here !
If anyone has thoughts on this, I would be very grateful to hear them! :)
Thanks a lot dexter
source share