问题描述
我一直想知道如何在Android中通过USB捕获音频输入。
我的方案是通过外部硬件接收音频,并通过Android应用程序播放收到的音频。 这种传输是通过USB完成的。
有没有办法使用Android SDK / Android NDK这样做。
任何建议都会对我有所帮助。
任务完成 Right by time I am able to interact with Hardware using CDC class and also able to play some random noisy audio through USB in my app. Neither I am able to get clear sound by that approach, nor there is consistency within the transmission of audio.
Right by time I am able to interact with Hardware using CDC class and also able to play some random noisy audio through USB in my app. Neither I am able to get clear sound by that approach, nor there is consistency within the transmission of audio.
谢谢。
此致,Vivek
1楼
大多数现代Android设备都可以充当USB主机。 因此,您可以连接例如USB麦克风以捕获音频。 Android还包含对usb_audio类的支持。 使用它可以访问设备上的音频。
由于您已经尝试过通信设备类(CDC),因此您了解Android的USB主机功能。 现在,您需要确保外围设备已实现USB音频类(音频源部分),并使您的应用程序使用音频类来获取音频。 解释得很好,因此将所有信息复制到这篇文章是没有意义的。 如果您已经在使用音频类,那么该页面可能会解释您遇到的一些问题(例如使用错误的格式)。
USB音频类规范可在上找到。 这些问题是Audio类非常大,Android可能不支持所有内容。