问题
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