Skip to content
This repository

A ruby library for TTS & ASR document preparation

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 assets
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec Add a bunch of dependencies and setup RSpec with ci_reporter June 20, 2011
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 CHANGELOG.md
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE.md Initial commit June 18, 2011
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 ruby_speech.gemspec
README.md

RubySpeech

RubySpeech is a library for constructing and parsing Text to Speech (TTS) and Automatic Speech Recognition (ASR) documents such as SSML and GRXML. The primary use case is for construction of these documents to be processed by TTS and ASR engines.

Installation

gem install ruby_speech

Library

RubySpeech provides a DSL for constructing SSML documents like so:

require 'ruby_speech'

speak = RubySpeech::SSML.draw do
  voice gender: :male, name: 'fred' do
    string "Hi, I'm Fred. The time is currently "
    say_as 'date', format: 'dmy' do
      "01/02/1960"
    end
  end
end
speak.to_s

becomes:

<speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US">
  <voice gender="male" name="fred">
    Hi, I'm Fred. The time is currently <say-as format="dmy" interpret-as="date">01/02/1960</say-as>
  </voice>
</speak>

Once your Speak is fully prepared and you're ready to send it off for processing, you must call to_doc on it to add the XML header:

<?xml version="1.0"?>
<speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US">
  <voice gender="male" name="fred">
    Hi, I'm Fred. The time is currently <say-as format="dmy" interpret-as="date">01/02/1960</say-as>
  </voice>
</speak>

You may also then need to call to_s.

Check out the YARD documentation for more

Features:

SSML

  • Document construction
  • <voice/>
  • <prosody/>
  • <emphasis/>
  • <say-as/>
  • <break/>
  • <audio/>

TODO:

SSML

Document Structure

  • <p/> and <s/>
  • <phoneme/>
  • <sub/>
  • <lexicon/>
  • <meta/> and <metadata/>

Misc

  • <mark/>
  • <desc/>

Links:

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history.
    • If you want to have your own version, that is fine but bump version in a commit by itself so I can ignore when I pull
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2011 Ben Langfeld. MIT licence (see LICENSE for details).

Something went wrong with that request. Please try again.