// UNFINISHED

// known issues:

// - speech is processed synchronously on the event thread

// - pause/resume doesn't work

// - voices are ignored, no polyphony now


JSCSpeech


JSCSpeech 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 and unzip the 1.2.2 binary from http://sourceforge.net/projects/freetts

- Copy at least the following files from the lib folder into your's system class path:

cmu_us_kal.jar

cmulex.jar

en_us.jar

freetts.jar

  (the java system class path for example on Mac OS X is : /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 33 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

// JSCSpeech.setSpeechVoice( 0, 14 );

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

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

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

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

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

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

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

JSCSpeech.setSpeechPitchMod( 0, 200 );

JSCSpeech.setSpeechPitchMod( 0, 0 );


// NOT YET WORKING

//Two actions can be applied:

//

//(

//JSCSpeech.wordAction = { arg voiceNum;

// //i.postln;

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

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

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

//};

//)

//(

//JSCSpeech.doneAction_({ arg voiceNum;

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

//});

//)


// NOT YET WORKING

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

//

//JSCSpeech.pause( 0, 1 );

//JSCSpeech.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

//(

//JSCSpeech.init( 64 );

//

//Task({

// 64.do ({arg i;

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

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

// JSCSpeech.setSpeechVolume( i, 0.07 );

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

// });

//}).play;

//)