gpt4 book ai didi

python - 将文本语言更改为语音

转载 作者:行者123 更新时间:2023-12-03 03:27:07 31 4
gpt4 key购买 nike

我想从python改变azure的声音,具有这些特征

languageCode = 'es‑MX'
ssmlGender = 'FEMALE'
voicName = 'es‑MX‑DaliaNeural'

但我是 azure 的新手,所以我不知道如何操作,这是我的代码:

import PyPDF2
import azure.cognitiveservices.speech as sdk

key = "fake key"
region = "fake region"

config = sdk.SpeechConfig(subscription=key, region=region)
synthesizer = sdk.SpeechSynthesizer(speech_config=config)

book = open("prueba.pdf", "rb")
reader = PyPDF2.PdfFileReader(book)

for num in range(0,reader.numPages):
text = reader.getPage(num).extractText()

result = synthesizer.speak_text_async(text).get()

最佳答案

关于python - 将文本语言更改为语音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75440632/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com