Skip to content

Start Speech Synthesis Stream

polly_start_speech_synthesis_stream R Documentation

Synthesizes UTF-8 input, plain text, or SSML over a bidirectional streaming connection

Description

Synthesizes UTF-8 input, plain text, or SSML over a bidirectional streaming connection. Specify synthesis parameters in HTTP/2 headers, send text incrementally as events on the input stream, and receive synthesized audio as it becomes available.

This operation serves as a bidirectional counterpart to synthesize_speech:

  • synthesize_speech

Usage

polly_start_speech_synthesis_stream(Engine, LanguageCode, LexiconNames,
  OutputFormat, SampleRate, VoiceId, ActionStream)

Arguments

Engine

[required] Specifies the engine for Amazon Polly to use when processing input text for speech synthesis. Currently, only the generative engine is supported. If you specify a voice that the selected engine doesn't support, Amazon Polly returns an error.

LanguageCode

An optional parameter that sets the language code for the speech synthesis request. Specify this parameter only when using a bilingual voice. If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice.

LexiconNames

The names of one or more pronunciation lexicons for the service to apply during synthesis. Amazon Polly applies lexicons only when the lexicon language matches the voice language.

OutputFormat

[required] The audio format for the synthesized speech. Currently, Amazon Polly does not support JSON speech marks.

SampleRate

The audio frequency, specified in Hz.

VoiceId

[required] The voice to use in synthesis. To get a list of available voice IDs, use the describe_voices operation.

ActionStream

The input event stream that contains text events and stream control events.

Value

A list with the following syntax:

list(
  EventStream = list(
    AudioEvent = list(
      AudioChunk = raw
    ),
    StreamClosedEvent = list(
      RequestCharacters = 123
    ),
    ValidationException = list(
      message = "string",
      reason = "unsupportedOperation"|"fieldValidationFailed"|"other"|"invalidInboundEvent",
      fields = list(
        list(
          name = "string",
          message = "string"
        )
      )
    ),
    ServiceQuotaExceededException = list(
      message = "string",
      quotaCode = "input-stream-inbound-event-timeout"|"input-stream-timeout",
      serviceCode = "polly"
    ),
    ServiceFailureException = list(
      message = "string"
    ),
    ThrottlingException = list(
      message = "string",
      throttlingReasons = list(
        list(
          reason = "string",
          resource = "string"
        )
      )
    )
  )
)

Request syntax

svc$start_speech_synthesis_stream(
  Engine = "standard"|"neural"|"long-form"|"generative",
  LanguageCode = "arb"|"cmn-CN"|"cy-GB"|"da-DK"|"de-DE"|"en-AU"|"en-GB"|"en-GB-WLS"|"en-IN"|"en-US"|"es-ES"|"es-MX"|"es-US"|"fr-CA"|"fr-FR"|"is-IS"|"it-IT"|"ja-JP"|"hi-IN"|"ko-KR"|"nb-NO"|"nl-NL"|"pl-PL"|"pt-BR"|"pt-PT"|"ro-RO"|"ru-RU"|"sv-SE"|"tr-TR"|"en-NZ"|"en-ZA"|"ca-ES"|"de-AT"|"yue-CN"|"ar-AE"|"fi-FI"|"en-IE"|"nl-BE"|"fr-BE"|"cs-CZ"|"de-CH"|"en-SG",
  LexiconNames = list(
    "string"
  ),
  OutputFormat = "json"|"mp3"|"ogg_opus"|"ogg_vorbis"|"pcm"|"mulaw"|"alaw",
  SampleRate = "string",
  VoiceId = "Aditi"|"Amy"|"Astrid"|"Bianca"|"Brian"|"Camila"|"Carla"|"Carmen"|"Celine"|"Chantal"|"Conchita"|"Cristiano"|"Dora"|"Emma"|"Enrique"|"Ewa"|"Filiz"|"Gabrielle"|"Geraint"|"Giorgio"|"Gwyneth"|"Hans"|"Ines"|"Ivy"|"Jacek"|"Jan"|"Joanna"|"Joey"|"Justin"|"Karl"|"Kendra"|"Kevin"|"Kimberly"|"Lea"|"Liv"|"Lotte"|"Lucia"|"Lupe"|"Mads"|"Maja"|"Marlene"|"Mathieu"|"Matthew"|"Maxim"|"Mia"|"Miguel"|"Mizuki"|"Naja"|"Nicole"|"Olivia"|"Penelope"|"Raveena"|"Ricardo"|"Ruben"|"Russell"|"Salli"|"Seoyeon"|"Takumi"|"Tatyana"|"Vicki"|"Vitoria"|"Zeina"|"Zhiyu"|"Aria"|"Ayanda"|"Arlet"|"Hannah"|"Arthur"|"Daniel"|"Liam"|"Pedro"|"Kajal"|"Hiujin"|"Laura"|"Elin"|"Ida"|"Suvi"|"Ola"|"Hala"|"Andres"|"Sergio"|"Remi"|"Adriano"|"Thiago"|"Ruth"|"Stephen"|"Kazuha"|"Tomoko"|"Niamh"|"Sofie"|"Lisa"|"Isabelle"|"Zayd"|"Danielle"|"Gregory"|"Burcu"|"Jitka"|"Sabrina"|"Jasmine"|"Jihye"|"Ambre"|"Beatrice"|"Florian"|"Lennart"|"Lorenzo"|"Tiffany",
  ActionStream = list(
    TextEvent = list(
      Text = "string",
      TextType = "ssml"|"text",
      FlushStreamConfiguration = list(
        Force = TRUE|FALSE
      )
    ),
    CloseStreamEvent = list()
  )
)