Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I get a SourceDataLine or TargetDataLine in μ-law format?

0
Posted

How can I get a SourceDataLine or TargetDataLine in μ-law format?

0

TargetDataLines are supposed to act as a “direct” way to communicate with the audio hardware device, i.e. your soundcard. When your soundcard does not support μ-law directly, the TargetDataLine won’t either. The way to go is to open a TargetDataLine in pcm format and route it through a format converter. See doc of AudioSystem to get converted Streams. The converted stream you get provides μ-law samples then. There is no drawback in this approach: all PC soundcards that I know of deliver only PCM, so it has to be rendered to μ-law anyway in software. Whether in the soundcard’s driver, the operating system layer or in the application (your java program) doesn’t matter. You get maximum portability when only using pcm for TargetDataLines.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123