MCPcopy Create free account
hub / github.com/cdk-patterns/serverless / convert_text_to_speech

Function convert_text_to_speech

polly/java/lambda_fns/polly.py:51–62  ·  view source on GitHub ↗
(voice, text)

Source from the content-addressed store, hash-verified

49 return response['TranslatedText']
50
51def convert_text_to_speech(voice, text):
52 if voice not in ['Joanna', 'Matthew', 'Lupe']:
53 print('Only Joanna, Matthew and Lupe support the newscaster style')
54 sys.exit(1)
55 response = polly_c.synthesize_speech(
56 VoiceId=voice,
57 Engine='neural',
58 OutputFormat='mp3',
59 TextType='ssml',
60 Text = f'<speak><amazon:domain name="news">{text}></amazon:domain></speak>')
61
62 return response['AudioStream'].read()

Callers 1

handlerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected