in podcast/main.py [0:0]
def record_line(voice: str, quote: str) -> AudioSegment:
client = texttospeech.TextToSpeechClient()
synthesis_input = texttospeech.SynthesisInput(text=quote)
voice = texttospeech.VoiceSelectionParams(
language_code="en-US", name=voice
)
audio_config = texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.MP3
)
response = client.synthesize_speech(
input=synthesis_input, voice=voice, audio_config=audio_config
)
logging.info(f'Recording "{quote}" in {voice}')
return AudioSegment.from_file(
io.BytesIO(response.audio_content), format="mp3"
)