开发者

How to specify the right AudioFormat for capturing audio from the microphone?

开发者 https://www.devze.com 2022-12-20 09:35 出处:网络
I\'m using the 开发者_C百科JMF Framework to capture audio data from the microphone. I try to find the audio device for the mic through this code:

I'm using the 开发者_C百科JMF Framework to capture audio data from the microphone.

I try to find the audio device for the mic through this code:

    AudioFormat audioFormat = new AudioFormat("linear", 44100, 16, 2);
    Vector<CaptureDeviceInfo> deviceList = CaptureDeviceManager.getDeviceList(audioFormat);

The problem is that I don't really know if that is the right audio format. How can i figure out which audio format should be specified to find the audio device?


The CaptureDevideManager Javadoc for the getDeviceList() method states:

"Gets a list of CaptureDeviceInfo objects that correspond to devices that can capture data in the specified Format. If no Format is specified, this method returns a list of CaptureDeviceInfo objects for all of the available capture devices."

Just pass a null in and you should be fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号