如何指定正确的音频格式来从麦克风捕获音频?
我正在使用 JMF 框架从麦克风捕获音频数据。
我尝试通过此代码找到麦克风的音频设备:
AudioFormat audioFormat = new AudioFormat("linear", 44100, 16, 2);
Vector<CaptureDeviceInfo> deviceList = CaptureDeviceManager.getDeviceList(audioFormat);
问题是我真的不知道这是否是正确的音频格式。我如何确定应指定哪种音频格式来查找音频设备?
I'm using the 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
getDeviceList() 方法的 CaptureDevideManager Javadoc 指出:
“获取与能够以指定格式捕获数据的设备相对应的 CaptureDeviceInfo 对象的列表。如果未指定 Format,则此方法将返回所有可用的 CaptureDeviceInfo 对象的列表。捕获设备。”
只要传入一个 null 就可以了。
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.