I have written a program for speech to text in which I use speech recognition by pycharm ask for PyAudio so I tried to do so . But PyAudio in pycharm is not getting installed
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I guess you need to configure a Python interpreter
https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html
回答2:
Sounddevice is easier for speech recognition because of it's simplicity. However if you really need pyaudio use
pip<python version> install pyaudio #in the terminal
if that does not work then check what python you are using in pycharm by looking at the python console tab. In this case I am using python 3.6.
import sounddevice as sd
import soundfile as sf
import speechrecognition as sr
s = sr.Recognizer()
audio = sd.rec(int(time*44100),44100)
sd.wait()
sf.write("audio.wav",audio,time*44100)
audio = sr.AudioFile("audio.wav")
with audio as file:
audio = s.record(file)
#wit.ai is a free speech recognition api from facebook and works almost as good as google.
text = s.recognize_wit(audio, key="*********")