synthesizeSpeech

abstract suspend fun <T> synthesizeSpeech(input: SynthesizeSpeechRequest, block: suspend (SynthesizeSpeechResponse) -> T): T

Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see How it Works.

Samples


fun main() { 
   //sampleStart 
   // Synthesizes plain text or SSML into a file of human like speech.
val resp = pollyClient.synthesizeSpeech {
    lexiconNames = listOf<String>(
        "example"
    )
    outputFormat = OutputFormat.fromValue("mp3")
    sampleRate = "8000"
    text = "All Gaul is divided into three parts"
    textType = TextType.fromValue("text")
    voiceId = VoiceId.fromValue("Joanna")
} 
   //sampleEnd
}