espeak-ruby
espeak-ruby is a small Ruby API for utilizing espeak and lame to create Text-To-Speech mp3 files or just speak (without saving). See live demo.
Install
Add espeak-ruby to Gemfile
gem "espeak-ruby", require: "espeak"
Examples
speech = ESpeak::Speech.new("YO!")
speech.speak
speech = ESpeak::Speech.new("Hallo Welt", voice: "de")
speech.save("hello-de.mp3")
ESpeak::Voice.all.map { |v| v.language }
ESpeak::Voice.find_by_language('en') #<ESpeak::Voice:0x007fe1d3806be8 @language="en", @name="default", @gender="M", @file="default">
Features
Currently only subset of espeak features is supported.
:voice => 'en'
:pitch => 50
:speed => 170
:capital => 170
:amplitude => 150
These are default values, and they can be easily overridden:
Speech.new("Zdravo svete", voice: "sr", pitch: 90, speed: 200).speak
Installing dependencies
OS X
brew install espeak lame
Ubuntu
apt-get install espeak lame
Licence
espeak-ruby is released under the MIT License.