PyAudio in pycharm

2019-07-26 23:41发布

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

2条回答
Animai°情兽
2楼-- · 2019-07-27 00:07
戒情不戒烟
3楼-- · 2019-07-27 00:16

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. enter image description here

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="*********")
查看更多
登录 后发表回答