// UNFINISHED

// known issues:

// - speech is processed synchronously on the event thread

// - pause/resume doesn't work

// - voices are ignored, no polyphony now

JSpeech

JSpeech lets you use the java freetts speech synthesizer.

To use this synthesizer, you will have to install the free java text-to-speech synthesis package "FreeTTS":

- Download from http://sourceforge.net/projects/freetts

- Copy the contents of the lib folder (freetts.jar, en_us.jar, cmutimelex.jar etc.) into your java's system class path

(for example on Mac OS X : /Library/Java/Extensions)

- Copy the file speech.properties into your home folder (~)

- (Re)boot SwingOSC

GUI.useID( \swing, { "hi i'm talking with the default voice now, i guess".speak });

// compare to cocoa (mac os x only):

GUI.useID( \cocoa, { "hi i'm talking with the default voice now, i guess".speak });

First argument is always the voice channel number, second the value

// different voices not not working in SwingOSC

// JSpeech.setSpeechVoice( 0, 14 );

JSpeech.setSpeechPitch( 0, 40 ); // pitch in MIDI Num

JSpeech.setSpeechPitch( 0, 52 ); // pitch in MIDI Num

JSpeech.setSpeechPitch( 0, 28 ); // pitch in MIDI Num

JSpeech.setSpeechRate( 0, 45 ); // slightly related to words per minute

JSpeech.setSpeechRate( 0, 300 ); // slightly related to words per minute

JSpeech.setSpeechVolume( 0, 0.5 ); // approximately linear volume

JSpeech.setSpeechVolume( 0, 1.0 ); // approximately linear volume

JSpeech.setSpeechPitchMod( 0, 200 );

JSpeech.setSpeechPitchMod( 0, 0 );

// NOT YET WORKING

//Two actions can be applied:

//

//(

//JSpeech.wordAction = { arg voiceNum;

// //i.postln;

// // the currently speaking text may not be changed

// //JSpeech.setSpeechPitch( voiceNum, [ 41, 60 ].choose );

// //JSpeech.setSpeechRate( voiceNum, [ 60, 80, 10 ].choose );

//};

//)

//(

//JSpeech.doneAction_({ arg voiceNum;

// JSpeech.setSpeechPitch( voiceNum, [ 41, 48, 40, 43, 30, 60 ].choose );

//});

//)

// NOT YET WORKING

//Pause the speech while speaking: 1=pause, 0= start

//

//JSpeech.pause( 0, 1 );

//JSpeech.pause( 0, 0 );

Initialization happens automatically, by default with one voice channel.

You may explicitly initalize with more channels, up to 128:

// NOT YET WORKING

//(

//JSpeech.init( 64 );

//

//Task({

// 64.do ({arg i;

// [ 0.1, 0.18, 0.2 ].choose.wait;

// JSpeech.setSpeechRate( i, [ 90, 30, 60 ].choose );

// JSpeech.setSpeechVolume( i, 0.07 );

// "no this is private. float . boolean me. char[8] ".jspeak( i );

// });

//}).play;

//)