Skip to content

A package for composing SSML fragments in scala

Notifications You must be signed in to change notification settings

infomofo/scala-ssml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scala-ssml

Scala CI

This library allows you to easily generate Speech Synthesis Markup Language (SSML) with Scala.

SSML is documented here, but it has applications for:

  • Alexa Skills (which only supports a subset of the official ssml tags, documented here)
  • Chrome Browser speechSynthesis fragments, documented here

Dependency

This dependency can be imported into any scala project using:

lazy val scalaSsml = RootProject(uri("git://github.com/infomofo/scala-ssml.git#v0.4.0"))

The library is currently compiled for scala versions 2.11.12, 2.12.11, and 2.13.2.

Basic Usage

You can generate ssml for any of the use cases outlined above.

This library makes use of method chaining for convenience.

import com.infomofo.scalassml.SSMLBuilder

SSMLBuilder()
        .text("hello")
        .pause(1000)
        .text("goodbye")

The output of a command like that would be:

<speak>
    hello
    <break time="1000ms"/>
    goodbye
</speak>

Running Tests

Tests can be run using sbt test.

Testing SSML pronunciation

Generated SSML can be tested using Amazon's online tool at: https://developer.amazon.com/alexa/console/ask/test/<skillid>/development/en_US/ where <skillid> is the id of an alexa skill.