本文介绍了pycharm 中的 PyAudio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个语音到文本的程序,其中我通过 pycharm ask for PyAudio 使用语音识别,所以我尝试这样做.但是pycharm中的PyAudio没有安装

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

推荐答案

Sounddevice 更容易进行语音识别,因为它很简单.但是,如果您确实需要 pyaudio 使用

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

如果这不起作用,则通过查看 python 控制台选项卡检查您在 pycharm 中使用的 python.在这种情况下,我使用的是 python 3.6.

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

这篇关于pycharm 中的 PyAudio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 04:39