speech_recognition的离线版本识别效果不好,代码如下(python3.7):
import pyaudio
import wave
import tkinter
import pyttsx3
import mp3play
import ffmpeg
import ffmpy
import time
import threading
import pydub
from pydub import AudioSegment
from pydub.playback import play
import speech_recognition as sr #加载包
#创建窗口
root = tkinter.Tk()
root.geometry('900x500+250+100')
root.resizable(False, False)
root.title('语音输入')
#语音提示功能
def voice(in_text):
engine = pyttsx3.init()
rate = engine.getProperty('rate')
engine.setProperty('rate', rate-5)
volume = engine.getProperty('volume')
engine.setProperty('volume', volume + 5)
engine.say(in_text)
engine.runAndWait()
#录音
def record():
lbl_inputvoice1 = tkinter.Label(root, text='准备录音', justify="left", fg="red", font=("微软雅黑", 50, "bold"))
lbl_inputvoice1.pl