将文本转为语音的语言。

huangapple go评论57阅读模式
英文:

Change languag of text to speech

问题

我想从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()
英文:

I want to change the voice of azure from python, with these characteristics

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

but i'm new to azure so i don't know how, this is my code:

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()

答案1

得分: 0

根据文档https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/how-to-speech-synthesis?tabs=browserjs%2Cterminal&pivots=programming-language-python#select-synthesis-language-and-voice,您应该能够执行以下操作:

config.speech_synthesis_language = "es‑MX"
config.speech_synthesis_voice_name = "es-MX-DaliaNeural"

语音列表在这里https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support?tabs=tts

英文:

Acording to the documentation https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/how-to-speech-synthesis?tabs=browserjs%2Cterminal&pivots=programming-language-python#select-synthesis-language-and-voice you should be able to do:

config.speech_synthesis_language = "es‑MX" 
config.speech_synthesis_voice_name ="es-MX-DaliaNeural"

The list of voices is here https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support?tabs=tts

huangapple
  • 本文由 发表于 2023年2月14日 03:58:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/75440632.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定