我会 select 什么设备让语音识别使用来自我的计算机的音频?

What device I would select for Speech Recognition to use the audio coming out of my computer?

我正在尝试使用 Python 制作隐藏式字幕生成器 3. 当我调用 list_microphone_names() 时,列出了一堆音频源。对于从我的计算机发出的音频,我会 select 哪个来源?

我试过使用 pocketsphinx for live recognition but the results are horribly inaccurate. I've found an option for using the -adcdev 参数到 select 一个来源,但我不知道要放入什么。

这是我通过调用 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)']

我猜是立体声混音,因为 this article 解释了如何在不使用立体声混音的情况下录制来自计算机的声音。

如果可以通过 speech_recognition 对从我的计算机发出的音频进行准确、实时的语音识别,我全力以赴。

运行 Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32.

与其列出所有可用的麦克风,不如考虑使用 Microphone.list_working_microphones() 仅列出当前听到声音的麦克风。确保发出一些声音,否则该函数可能 return 一个空列表。拿到可用麦克风列表后,一个一个试听,最后选出识别质量最好的那个。

下面的代码片段只是选择了第一个有效的代码片段:

for device_index in Microphone.list_working_microphones():
    m = Microphone(device_index=device_index)
    break
else:
    print("No working microphones found!")