windows Python中的麦克风访问
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/193789/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Microphone access in Python
提问by UnkwnTech
Can I access a users microphone in Python?
我可以在 Python 中访问用户麦克风吗?
Sorry I forgot not everyone is a mind reader: Windows at minimum XP but Vista support would be VERY good.
抱歉,我忘了不是每个人都是读心者:Windows 最低为 XP,但对 Vista 的支持会非常好。
采纳答案by Cody Brocious
Best way to go about it would be to use the ctypes library and use WinMM from that. mixerOpen will open a microphone device and you can read the data easily from there. Should be very straightforward.
最好的方法是使用 ctypes 库并从中使用 WinMM。mixOpen 将打开一个麦克风设备,您可以从那里轻松读取数据。应该非常简单明了。
回答by Jeffrey Martinez
I got the job done with pyaudio
我用pyaudio完成了工作
It comes with a binary installer for windows and there's even an example on how to record through the microphone and save to a wave file. Nice! I used it on Windows XP, not sure how it will do on Vista though, sorry.
它带有一个用于 Windows 的二进制安装程序,甚至还有一个关于如何通过麦克风录制并保存到波形文件的示例。好的!我在 Windows XP 上使用它,但不确定它在 Vista 上的效果如何,抱歉。