[英]What device I would select for Speech Recognition to use the audio coming out of my computer?
I'm trying to make a closed captions generator using Python 3. When I call list_microphone_names()
, a bunch of audio sources are listed.我正在尝试使用 Python 3 制作隐藏式字幕生成器。当我调用
list_microphone_names()
,会列出一堆音频源。 Which source would I select for the audio that comes out of my computer?我会为从我的计算机发出的音频选择哪个来源?
I've tried using pocketsphinx
for live recognition but the results are horribly inaccurate.我曾尝试使用
pocketsphinx
进行实时识别,但结果非常不准确。 I've found an option for using the -adcdev
parameter to select a source but I don't know what to put into it.我找到了一个使用
-adcdev
参数来选择源的选项,但我不知道要放入什么。
Here is what I get from calling list_microphone_names()
:这是我从调用
list_microphone_names()
:
>>> import speech_recognition as sr
>>> r = sr.Recognizer()
>>> mic = sr.Microphone()
>>> sr.Microphone.list_microphone_names()
['Microsoft Sound Mapper - Input',
'Microphone (HD Webcam C270)',
'Microsoft Sound Mapper - Output',
'Speakers (Realtek High Definiti',
'Primary Sound Capture Driver',
'Microphone (HD Webcam C270)',
'Primary Sound Driver',
'Speakers (Realtek High Definition Audio)',
'Speakers (Realtek High Definition Audio)',
'Microphone (HD Webcam C270)',
'Line In (Realtek HD Audio Line input)',
'Speakers (Realtek HD Audio output)',
'Microphone (Realtek HD Audio Mic input)',
'Stereo Mix (Realtek HD Audio Stereo input)',
'Microphone (HD Webcam C270)']
I'm guessing Stereo Mix because this article explains how to record the sound coming from your computer without using Stereo Mix.我猜是立体声混音,因为本文解释了如何在不使用立体声混音的情况下录制来自计算机的声音。
If it is possible for accurate, live speech recognition with speech_recognition for the audio that comes out of my computer, I'm all in for it.如果可以使用语音识别功能对我的计算机发出的音频进行准确、实时的语音识别,那么我全力支持。
Running Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
. Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
运行Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
。
Rather than listing all available microphones, consider using Microphone.list_working_microphones()
that lists only those currently hearing sound.与其列出所有可用的麦克风,不如考虑使用
Microphone.list_working_microphones()
仅列出当前听到声音的Microphone.list_working_microphones()
。 Make sure to make some noise, otherwise the function may return an empty list.确保发出一些噪音,否则该函数可能会返回一个空列表。 After you got the list of working microphones, try them one by one and finally pick up the one with which recognition quality is the best.
拿到工作话筒列表后,一一试用,最后挑出识别质量最好的那一个。
The code snippet below simply picks the first one working:下面的代码片段只是选择第一个工作:
for device_index in Microphone.list_working_microphones():
m = Microphone(device_index=device_index)
break
else:
print("No working microphones found!")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.