-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Open
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.samplesIssues that are directly related to samples.Issues that are directly related to samples.triage meI really want to be triaged.I really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
I created a helper function to test the SSML google:style tag (Python).
def synthesize_ssml(style_name):
from google.cloud import texttospeech
ssml_text = f'<speak><google:style name="{style_name}">Hello I'm so happy today!</google:style></speak>'
client = texttospeech.TextToSpeechClient()
input_text = texttospeech.SynthesisInput(ssml=ssml_text)
# Note: The following voices can speak in multiple styles: en-US-Neural2-F, en-US-Neural2-J
# Ref: https://docs.cloud.google.com/text-to-speech/docs/ssml
voice = texttospeech.VoiceSelectionParams(
language_code="en-US",
name="en-US-Neural2-F", # or "en-US-Neural2-J"
)
audio_config = texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.MP3
)
response = client.synthesize_speech(
input=input_text, voice=voice, audio_config=audio_config
)
# The response's audio_content is binary.
out_file = f"output_{style_name}.mp3"
with open(out_file, "wb") as out:
out.write(response.audio_content)
print('Audio content written to file {out_file}')
The resulting audios of synthesize_ssml('apologetic'), synthesize_ssml('calm'), synthesize_ssml('empathetic'), synthesize_ssml('firm'), synthesize_ssml('lively') all sound the same. I also tested Azure TTS voices supporting styles and the same text using different styles do sound different.
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.samplesIssues that are directly related to samples.Issues that are directly related to samples.triage meI really want to be triaged.I really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.