Is there a way to change pitch of local engine text-to-speech voice in python

女生的网名这么多〃 提交于 2021-01-29 16:59:19

问题


I am using text-to-speech in my python project but not getting any way to increase or decrease the pitch level of the local machine voice in python. Here is my basic code:

import pyttsx3
import datetime
import speech_recognition as sr
import random


print("Intializing Toretto")

engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice',voices[1].id)
engine.setProperty('rate', 210)

def speak(audio):
    engine.say(audio)
    engine.runAndWait()

回答1:


you should add a getProperty for the rate like this:

engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
rate = engine.getProperty('rate')
engine.setProperty('voice',voices[1].id)
engine.setProperty('rate', 210)


来源:https://stackoverflow.com/questions/62394250/is-there-a-way-to-change-pitch-of-local-engine-text-to-speech-voice-in-python

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