파이썬 Speech Recognition library을 사용하여 마이크의 음성 입력을 인식하고 있습니다.Pyaudio : no get_device_count 메서드
내 기본 마이크에서 정상적으로 작동합니다. 이것은 내가 사용하고있는 코드입니다. 1. 나는이 오류를 받고 있어요 - 나는 문서
Creates a new Microphone instance, which represents a physical microphone on the computer. Subclass of AudioSource.
If device_index is unspecified or None, the default microphone is used as the audio source. Otherwise, device_index should be the index of the device to use for audio input. https://pypi.python.org/pypi/SpeechRecognition/
의 이해 무엇에 따르면 문제는 내가 pyaudio.get_device_count와 노드를 취득하고자 할 때()이다.
AttributeError : '모듈'개체가 어떤 속성 'get_device_count'
그래서 내가 버그로 된 USB 마이크
import pyaudio
import speech_recognition as sr
index = pyaudio.get_device_count() - 1
print index
r = sr.Recognizer()
with sr.Microphone(index) as source:
audio = r.listen(source)
try:
print("You said " + r.recognize(audio))
except LookupError:
print("Could not understand audio")
pyaudio 버전을 사용하고 있다는 것을 언급 할만한 가치가 있습니다. –