Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

convert pcm to ulaw

843802Jun 15 2009 — edited Jun 26 2009
Hello,

I know there is a lot of topics on this matter and I have read them, however I still dont get it..

I need to convert audio data from microphone to ulaw(g.711) encoded data that can be decoded on a gsm mobile phone.
This works using JMF when I use ULAW_RTP format, but I need to get it working purely with Java Sound.

At the moment, I create a targetdataline with this format:
PCM_SIGNED 8000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian

Then i convert like this:
AudioInputStream ais 
ais = AudioSystem.getAudioInputStream(AudioFormat.Encoding.ULAW, new AudioInputStream(targetDataLine)); 
Which gives this format:
ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame.

Which i would think was correct, but this just sounds like a lot of noice with very poor speech on the gsm device even though we agreed on using ulaw format.

What did I miss?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 24 2009
Added on Jun 15 2009
2 comments
1,241 views