espeak-ruby
espeak-ruby is small Ruby API for utilizing ‘espeak’ and ‘lame’ to create Text-To-Speech mp3 files.
-
eSpeak is a compact open source software speech synthesizer for English and other languages, for Linux and Windows.
-
LAME is a high quality MPEG Audio Layer III (MP3) encoder licensed under the LGPL.
Install
sudo gem install dejan-espeak-ruby –source gems.github.com
Example
require ‘rubygems’ require ‘espeak-ruby’
include ESpeak
# Creates hello.mp3 file espeak(“hello.mp3”, :text => “Hello World”) # Creates /home/espeak/hello-de.mp3 file espeak(“/home/espeak/hello-de.mp3”, :text => “Hallo Welt”, :voice => “de”)
Features
Currently only subset of espeak features is supported.
:voice => ‘en’, # use voice file of this name from espeak-data/voices :pitch => 50, # pitch adjustment, 0 to 99 :speed => 170 # speed in words per minute, 80 to 370
This can be easily overriden:
espeak(“zdravo.mp3”, :text => “Zdravo svete”, :voice => “sr”, :pitch => 90, :speed => 200)
Requirements
-
Linux or Windows (I failed in trying to compile espeak on Mac)
Related
-
github.com/dejan/espeak-http - Micro web app for Text-To-Speech conversion via HTTP powered by Ruby, Sinatra, lame, espeak and espeak-ruby
Credits
Author: Dejan Simic ~ rors.org