将文本转为语音的语言。

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

Change languag of text to speech

问题

我想从Python更改Azure的语音,并具有以下特征

  1. languageCode = 'es-MX'
  2. ssmlGender = 'FEMALE'
  3. voicName = 'es-MX-DaliaNeural'

但我对Azure还不熟悉,不知道如何操作,这是我的代码:

  1. import PyPDF2
  2. import azure.cognitiveservices.speech as sdk
  3. key = "fake key"
  4. region = "fake region"
  5. config = sdk.SpeechConfig(subscription=key, region=region)
  6. synthesizer = sdk.SpeechSynthesizer(speech_config=config)
  7. book = open("prueba.pdf", "rb")
  8. reader = PyPDF2.PdfFileReader(book)
  9. for num in range(0, reader.numPages):
  10. text = reader.getPage(num).extractText()
  11. result = synthesizer.speak_text_async(text).get()
英文:

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

  1. languageCode = 'esMX'
  2. ssmlGender = 'FEMALE'
  3. voicName = 'esMXDaliaNeural'

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

  1. import PyPDF2
  2. import azure.cognitiveservices.speech as sdk
  3. key = "fake key"
  4. region = "fake region"
  5. config = sdk.SpeechConfig(subscription=key, region=region)
  6. synthesizer = sdk.SpeechSynthesizer(speech_config=config)
  7. book = open("prueba.pdf", "rb")
  8. reader = PyPDF2.PdfFileReader(book)
  9. for num in range(0,reader.numPages):
  10. text = reader.getPage(num).extractText()
  11. 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,您应该能够执行以下操作:

  1. config.speech_synthesis_language = "es‑MX"
  2. 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:

  1. config.speech_synthesis_language = "esMX"
  2. 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:

确定