ttslib

ttslib

About

ttslib is a wrapper around freetts for processing the library can be used to give your sketches a voice. The only drawback is, that it's not working in applets, because freetts uses custom classloaders for loading the voices, which is not allowed in the browser sandbox.

Download

ttslib-0.4-zip

ttslib-0.4-src-zip

Installation

Starting with processing 2 beta 7 you can install the ttslib by clicking on "Sketch -> Import Library ... -> Add Library". In the dialog that opens enter ttslib as a search filter and then click on the install button next to the ttslib entry.

To install the library in older processing version download the zip file manually and unzip it in the library folder of your processing installation. From release 0149 on the libraries folder should be in your sketchbook folder. older releases need it to be copied into the library folder of your processing installation.

Documentation

To use the library simply import the lib, create an instance of the TTS class and call the speak method

import guru.ttslib.*;

TTS tts;

void setup() {
  tts = new TTS();
}

void draw() {
}

void mousePressed() {
  tts.speak("Hi! I am a speaking Processing sketch");
}

From version 0.3 it also allows you to alter the pitch and the pitch range of the voice by using

tts.setPitch( frequency )
tts.setPitchRange( frequency )
tts.setPitchShift( float )

from version 0.4 on you can define which speaker the text should come from

tts.speak( "I am in the center" );
tts.speakLeft( "I am on the left" );
tts.speakRight( "I am on the right" );

To use mbrola voices make sure you have mbrola and some of the us voices installed. Then set mbrola.base as a java system property. Now the name of the mbrola voice can be set using a constructor parameter. See this blog-post for a more detailed install instruction

import guru.ttslib.*;

TTS tts;

void setup() {
      System.setProperty("mbrola.base", "/path/to/mbrola");
  tts = new TTS("mbrola_us1");
}

void draw() {
}

void mousePressed() {
  tts.speak("Hi! I am a speaking Processing sketch");
}

Examples

The zip file includes a simple chatbot example.

Licence

ttslib is released under the GNU LGPL freetts is released under this BSD Licence

Projects using the library

My name is 192.168.159.16 by Varvara Guljajeva

Older Versions

ttslib-0.1-zip

ttslib-0.1-src-zip

ttslib-0.2-zip

ttslib-0.2-src-zip

ttslib-0.3-zip

ttslib-0.3-src-zip