/*

These examples show the use of SwingOSC with the free

java text-to-speech synthesis package FreeTTS. To run, you

need to download FreeTTS from here:


http://sourceforge.net/projects/freetts


The jars jsapi.jar and freetts.jar have to be included in the

classpath when running SwingOSC. These jars are generated

when you run the script lib/jsapi.sh (on Linux/Mac OS) or

lib/jsapi.exe (on Windows). Copy the file speech.properties

into your home folder (~).

Here's an example of how to run SwingOSC with FreeTTS on

Mac OS X and Linux. It assumes that you have copied the

FreeTTS lib folder into the SwingOSC folder. In the terminal,

cd into the SwingOSC folder and type

java -cp build/SwingOSC.jar:lib/freetts.jar:lib/jsapi.jar de.sciss.swingosc.SwingOSC -u 57111 -L

*/


// Note that the whole lib folder of freetts has to stay intact.

// Unfortunately you cannot use '/classes' to add the jars at runtime

// because freetts will not find required resourced


// Speak to the default system output


(

g = SwingOSC.default;

g.sendBundle( nil,

[ '/local', \voice, '[', '/methodr', '[', '/method', 'com.sun.speech.freetts.VoiceManager', \getInstance, ']',

\getVoice, "kevin16", ']' ],

[ '/method', \voice, \allocate ]

);

)


g.sendMsg( '/method', \voice, \speak, "Thank you for giving me a voice. I'm so glad to say hello to this world." );

g.sendMsg( '/set', \voice, \rate, 200, \pitchShift, 2.0, \volume, 0.95 );

g.sendMsg( '/method', \voice, \speak, "The FreeTTS distribution includes a program that will allow you to test many of the features of FreeTTS" );


g.sendBundle( nil, [ '/method', \voice, \deallocate ], [ '/free', \voice ]);


// Render some speech to a sound file


(

g.sendBundle( nil,

[ '/local', \voice, '[', '/methodr', '[', '/method', 'com.sun.speech.freetts.VoiceManager', \getInstance, ']',

\getVoice, "kevin16", ']' ],

[ '/local', \file, '[', '/new', 'com.sun.speech.freetts.audio.SingleFileAudioPlayer', "~/Desktop/Schoko".absolutePath,

  '[', '/field', 'javax.sound.sampled.AudioFileFormat$Type', \AIFF, ']', ']' ],

[ '/set', \voice, \rate, 50, \pitchShift, 0.5, \volume, 0.95, \audioPlayer, '[', "/ref", \file, ']' ],

[ '/method', \voice, \allocate ],

[ '/method', \voice, \speak, "Sets the dumpfile for this voice" ],

[ '/method', \file, \close ],

[ '/method', \voice, \deallocate ],

[ '/free', \voice, \file ]

);

)


// last mod : 30-jul-07 sciss