Add prompts to video generation and final message in listening audios.

This commit is contained in:
Cristiano Ferreira
2024-03-19 19:38:09 +00:00
parent 8b83a4163d
commit 274bd79c6a
2 changed files with 24 additions and 2 deletions

View File

@@ -36,6 +36,15 @@ def text_to_speech(text: str, file_name: str):
VoiceId=voice
)
audio_segments.append(tts_response['AudioStream'].read())
# Add finish message
audio_segments.append(client.synthesize_speech(
Engine="neural",
Text="This audio recording, for the listening exercise, has finished.",
OutputFormat="mp3",
VoiceId="Stephen"
)['AudioStream'].read())
# Combine the audio segments into a single audio file
combined_audio = b"".join(audio_segments)
# Save the combined audio to a single file
@@ -63,6 +72,15 @@ def conversation_text_to_speech(conversation: list, file_name: str):
VoiceId=segment["voice"]
)
audio_segments.append(response['AudioStream'].read())
# Add finish message
audio_segments.append(client.synthesize_speech(
Engine="neural",
Text="This audio recording, for the listening exercise, has finished.",
OutputFormat="mp3",
VoiceId="Stephen"
)['AudioStream'].read())
# Combine the audio segments into a single audio file
combined_audio = b"".join(audio_segments)
# Save the combined audio to a single file