Text-to-speech in French with SI_VOX and in English with FreeTTS

Text-to-speech or text-to-speech  (or TTS, Text-To-Speech) is a method that allows you to create artificial speech from the text. It relies on language processing techniques to transcribe the text, including signal processing to generate beeps from a phonetic version. Stephen Hawking  uses this technique to communicate with others.

1 - Text-to-speech in French (with SI_VOX)

SI_VOX is a French library and the best API for text-to-speech in French in Java. To be able to use it, follow these steps
  1. Download the SI_VOX API:  http://users.polytech.unice.fr/~helen/SI_VOX-SRC.tar.gz
  2. After creating the project, Import the library 'SI_VOX.jar' into your project.
  3. Copy and paste the "data" folder that is located   In the compressed folder in the root of the project, this file contains the parameters of the voice.
  4. Import class to read text:
import t2s.son.TextReader;
  5.    Create a text reader:
ReaderTextReader = new ReaderText("Hello");
 6. Read the text: 
player.playAll();
 7.    Edit text: 
reader.setText("I am a text-to-speech program");

import t2s.son.TextReader; 

public class Synthese_Vocale{
public static void main(String[] args) {
ReaderTextReader = new ReaderText("hello");
player.playAll();
reader.setText("I'm a speech synthesizer, who are you?");
player.playAll();
}
}

2- English Text-to-Speech (with FreeTTS)

FreeTSS  est an open source text-to-speech system, it was created with the Java language. FreeTTS is an implementation of  Java Speech API.


For more information about the FreeTTS API, click this link  http://freetts.sourceforge.net/docs/index.php#what_is_freetts

To turn text into speech, you need the interface  FreeTTSSpeakable which converts the text to a FreeTTSSpeakable object.

Voice: is the central point of FreeTTS, it takes a FreeTTSSpeakable as input and translates the associated text into a speech and then outputs the corresponding audio.

VoiceManager: is the warehouse of FreeTTS's voices. Here's how to choose a voice:
VoiceManager voiceManager = VoiceManager.getInstance();
// Create a list of voices
Voice[] voice = voiceManager.getVoices();

//Each voice has properties, you can browse the list to find the voice as needed.
// allocate resources for this voice

voice [x].allocate();
The following code is a demonstrative application; to demonstrate the use of synthesizer speech  FreeTTS . This program shows how to use FreeTTS  without the need for the "JSAPI" API.

import com.sun.speech.freetts.Voice; 
import com.sun.speech.freetts.VoiceManager;

public class Synthese_Vocale {
/**
* How to display all voices
*/
public static void voicelist() {
System.out.println("All available voices:");
VoiceManager voiceManager = VoiceManager.getInstance();
Voice[] voice = voiceManager.getVoices();
for (int i = 0; i < voice.length; i++) {
System.out.println(" " + voice[i].getName()
+ " (" + voice[i].getDomain() + " domain)");
}
}

public static void main(String[] args) {

/*Method that allows the display of all available voices*/
voicelist();

String VoiceName = "kevin";
System.out.println("\nVoice used: " + VoiceName);

/* The VoiceManager manages all voices for FreeTTS
*/
VoiceManager voiceManager = VoiceManager.getInstance();
/*Load voice
*/
Voice = voiceManager.getVoice(VoiceName);

/*If the voice name does not exist, then error
*/
if (voice == null) {
System.err.println(
"The voice "
+ voicename +". is not recognized please try another name.");
System.exit(1);
}

/* Load resources whose voice uses
*/
voice.allocate();

/* synthesize speech
*/
voice.speak("hello world");
voice.speak("how are you today");
voice.speak("I am a programmer");

/* unallocate
*/
voices.deallocate();
/*program completed successfully
*/
System.exit(0);
}
}