Class Ssml

java.lang.Object
io.micronaut.aws.alexa.ssml.Ssml

public class Ssml extends Object
Speech Synthesis Markup Language builder.
Since:
2.0.0
Author:
sdelamo
See Also:
  • Field Details

  • Constructor Details

    • Ssml

      public Ssml()
      Constructor.
    • Ssml

      public Ssml(String text)
      Parameters:
      text - plain text
  • Method Details

    • domain

      public Ssml domain(@NonNull @NonNull AmazonDomain domain, @NonNull @NonNull String text)
      Applies different speaking styles to the speech. The styles are curated text-to-speech voices that employ different variations of intonation, emphasis, pausing and other techniques to match the speech to the type of content. For example, the news style makes Alexa's voice sound like what you might expect to hear in a TV or radio newscast, and was built primarily for customers to listen to news articles and other news-based content.
      Parameters:
      domain - Name of the speaking style to apply to the speech
      text - Text to be wrapped inside the amazon:domain tag
      Returns:
      An SsmlBuilder with an amazon:domain tag.
    • audio

      public Ssml audio(@NonNull @NonNull String src)
      The audio tag lets you provide the URL for an MP3 file that the Alexa service can play while rendering a response.
      Parameters:
      src - Specifies the URL for the MP3 file
      Returns:
      SSML Builder
    • effect

      public Ssml effect(@NonNull @NonNull AmazonEffect effect, @NonNull @NonNull String text)
      Applies Amazon-specific effect to the speech.
      Parameters:
      effect - Effect
      text - text to apply the effect to
      Returns:
      Text wrapped in amazon:effect tag
    • text

      public Ssml text(@NonNull @NonNull String text)
      Parameters:
      text - plain text
      Returns:
      Return builder
    • emotion

      public Ssml emotion(@NonNull @NonNull AmazonEmotion emotion, @NonNull @NonNull AmazonEmotionIntensity intensity, @NonNull @NonNull String text)
      Parameters:
      emotion - The name of the emotion to apply to the speech
      intensity - The intensity or strength of teh emotion to express.
      text - plain text to apply emotion to
      Returns:
      SSML builder
    • lang

      public Ssml lang(@NonNull @NonNull String text, @NonNull @NonNull SupportedLang lang)
      Parameters:
      text - text to speak tagged as a particular lang
      lang - specify the language model and rules to speak the tagged content
      Returns:
      SSML Builder
    • paragraph

      public Ssml paragraph(@NonNull @NonNull String text)
      Parameters:
      text - text to be wrapped in a paragraph
      Returns:
      SSML builder
    • prosody

      public Ssml prosody(@NonNull @NonNull String text, @Nullable @Nullable ProsodyRate rate, @Nullable @Nullable ProsodyPitch pitch, @Nullable @Nullable ProsodyVolume volume)
      Parameters:
      text - text to be wrapped in the prosody tag
      rate - Rate of Speech
      pitch - Tone (pitch) of the speech
      volume - Volume of the Speech
      Returns:
      SSML Builder
    • sentence

      public Ssml sentence(@NonNull @NonNull String text)
      Parameters:
      text - Text to be wrapped in a sentence tag (s)
      Returns:
      SSML builder
    • speak

      public Ssml speak(@NonNull @NonNull String text)
      Parameters:
      text - Text to be wrapped in speak tag
      Returns:
      SSML Builder
    • s

      public Ssml s(@NonNull @NonNull String text)
      Parameters:
      text - Text to be wrapped in a sentence tag (s)
      Returns:
      SSML builder
    • p

      public Ssml p(@NonNull @NonNull String text)
      Parameters:
      text - Text to be wrapped in a paragraph tag
      Returns:
      SSML builder
    • sayAs

      public Ssml sayAs(@NonNull @NonNull String text, @NonNull @NonNull InterpretAs interpretAs, @Nullable @Nullable InterpretAsDateFormat interpretAsDateFormat)
      Parameters:
      text - text to be wrapped in a say as tag
      interpretAs - Indicate alexa how to interpret text
      interpretAsDateFormat - Format to be used when interpret-as is set to date.
      Returns:
      SSML Builder
    • w

      public Ssml w(@NonNull @NonNull String text, @NonNull @NonNull WordRole role)
      Parameters:
      text - Text to be wrapped
      role - Specify role of the word
      Returns:
      SSML builder
      See Also:
    • emphasis

      public Ssml emphasis(@NonNull @NonNull String text, @Nullable @Nullable EmphasisLevel emphasisLevel)
      Parameters:
      text - Text to be emphasized
      emphasisLevel - Emphasis level
      Returns:
      SSML builder
    • breakWithSeconds

      public Ssml breakWithSeconds(@NonNull @NonNull Integer seconds)
      Parameters:
      seconds - duration of break in seconds
      Returns:
      SSML Builder
      See Also:
    • voice

      public Ssml voice(@NonNull @NonNull String text, @NonNull @NonNull Voice voice)
      Parameters:
      text - text to be spoken in a particular voice
      voice - Amazon Polly voice to speak the text with
      Returns:
      SSML Builder
    • sub

      public Ssml sub(@NonNull @NonNull String text, @NonNull @NonNull String alias)
      Parameters:
      text - text to be pronouced differently
      alias - pronunciation to substitute
      Returns:
      SSML
    • breakWithMilliseconds

      public Ssml breakWithMilliseconds(@NonNull @NonNull Integer milliseconds)
      Parameters:
      milliseconds - duration of break in milliseconds
      Returns:
      SSML Builder
      See Also:
    • breakWithStrength

      public Ssml breakWithStrength(@NonNull @NonNull BreakStrength strength)
      Parameters:
      strength - Break strength
      Returns:
      SSML Builder
      See Also:
    • build

      public String build()
      Returns:
      SSML as String