PyAudio in pycharm

风流意气都作罢 提交于 2020-01-24 19:54:17

问题


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="*********")


来源:https://stackoverflow.com/questions/56336740/pyaudio-in-pycharm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!