https://github.com/dejan/espeak-ruby
Ruby wrapper for ‘espeak’ and ‘lame’ with sugar on top to create Text-To-Speech mp3 files.
https://github.com/dejan/espeak-ruby
Last synced: 6 months ago
JSON representation
Ruby wrapper for ‘espeak’ and ‘lame’ with sugar on top to create Text-To-Speech mp3 files.
- Host: GitHub
- URL: https://github.com/dejan/espeak-ruby
- Owner: dejan
- License: mit
- Created: 2009-01-04T01:47:45.000Z (almost 17 years ago)
- Default Branch: master
- Last Pushed: 2025-05-14T08:25:43.000Z (6 months ago)
- Last Synced: 2025-05-14T08:26:22.521Z (6 months ago)
- Language: Ruby
- Homepage: https://espeak.makeme.tools/
- Size: 172 KB
- Stars: 196
- Watchers: 14
- Forks: 21
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: MIT-LICENSE
Awesome Lists containing this project
- nlp-with-ruby - espeak-ruby - (High Level Tasks / Text-to-Speech-to-Text)
README
# espeak-ruby
espeak-ruby is a small Ruby API for utilizing [espeak](http://espeak.sourceforge.net) and [lame](http://lame.sourceforge.net/) to create Text-To-Speech mp3 files or just speak (without saving).
## Install
Add _espeak-ruby_ to Gemfile
```ruby
gem "espeak-ruby", require: "espeak"
```
## Examples
```ruby
# Speaks "YO!"
speech = ESpeak::Speech.new("YO!")
speech.speak # invokes espeak
# Creates hello-de.mp3 file
speech = ESpeak::Speech.new("Hallo Welt", voice: "de")
speech.save("hello-de.mp3") # invokes espeak + lame
# Lists voices
ESpeak::Voice.all.map { |v| v.language } # ["af", "bs", "ca", "cs", "cy", "da", "de", "el", "en", "en-sc", "en-uk", "en-uk-north", "en-uk-rp", "en-uk-wmids", "en-us", "en-wi", "eo", "es", "es-la", "fi", "fr", "fr-be", "grc", "hi", "hr", "hu", "hy", "hy", "id", "is", "it", "jbo", "ka", "kn", "ku", "la", "lv", "mk", "ml", "nci", "nl", "no", "pap", "pl", "pt", "pt-pt", "ro", "ru", "sk", "sq", "sr", "sv", "sw", "ta", "tr", "vi", "zh", "zh-yue"]
# Find particular voice
ESpeak::Voice.find_by_language('en') #
```
## Features
Currently only subset of espeak features is supported.
```ruby
: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
:capital => 170 # increase emphasis (pitch) of capitalized words, 1 to 40 (for natural sound, can go higher)
:amplitude => 150 # amplitude (volume) adjustment, 0 to 200
```
These are default values, and they can be easily overridden:
```ruby
Speech.new("Zdravo svete", voice: "sr", pitch: 90, speed: 200).speak
```
## Installing dependencies
### OS X
brew install espeak lame
### Ubuntu
sudo apt-get install espeak lame
## Licence
espeak-ruby is released under the [MIT License](/MIT-LICENSE).