Buenas, estoy intentando realizando en java un programa (en principio en español).
El cual se escribirá un texto en un JTextField y programa tiene que reproducir el texto mediante
una voz lo más natural posible.
He probado con fretts con speech y antes con mbrola. pero no me deja o no se cambiarle la voz.
¿ese es sintetizado mas adecuado para java o hay otro mejor?
¿Que me aconsejáis?
Gracias
Como estaras usando esa API, tienes codigo? segun si que funciona.
Si, he hecho una prueba con el siguiente código:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sonido;
import java.util.Locale;
import javax.speech.Central;
import javax.speech.synthesis.Synthesizer;
import javax.speech.synthesis.SynthesizerModeDesc;
/**
*
* @author pcx
*/
public class SonidoSp {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try {
// Set property as Kevin Dictionary
System.setProperty(
"freetts.voices",
"com.sun.speech.freetts.en.us"
+ ".cmu_us_kal.KevinVoiceDirectory");
// Register Engine
Central.registerEngineCentral(
"com.sun.speech.freetts"
+ ".jsapi.FreeTTSEngineCentral");
// Create a Synthesizer
Synthesizer synthesizer
= Central.createSynthesizer(
new SynthesizerModeDesc(Locale.US));
// Allocate synthesizer
synthesizer.allocate();
// Resume Synthesizer
synthesizer.resume();
// Speaks the given text
// until the queue is empty.
synthesizer.speakPlainText(
"hola esto es carnaval tu p**a madre", null);
synthesizer.waitEngineState(
Synthesizer.QUEUE_EMPTY);
// Deallocate the Synthesizer.
synthesizer.deallocate();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
Gracias su interés
[MOD] para publicar código usar las etiquetas GeSHi
Cita de: misterguapo30 en 20 Septiembre 2020, 00:56 AM
Si, he hecho una prueba con el siguiente código:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sonido;
import java.util.Locale;
import javax.speech.Central;
import javax.speech.synthesis.Synthesizer;
import javax.speech.synthesis.SynthesizerModeDesc;
/**
*
* @author pcx
*/
public class SonidoSp {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try {
// Set property as Kevin Dictionary
System.setProperty(
"freetts.voices",
"com.sun.speech.freetts.en.us"
+ ".cmu_us_kal.KevinVoiceDirectory");
// Register Engine
Central.registerEngineCentral(
"com.sun.speech.freetts"
+ ".jsapi.FreeTTSEngineCentral");
// Create a Synthesizer
Synthesizer synthesizer
= Central.createSynthesizer(
new SynthesizerModeDesc(Locale.US));
// Allocate synthesizer
synthesizer.allocate();
// Resume Synthesizer
synthesizer.resume();
// Speaks the given text
// until the queue is empty.
synthesizer.speakPlainText(
"hola esto es carnaval tu p**a madre", null);
synthesizer.waitEngineState(
Synthesizer.QUEUE_EMPTY);
// Deallocate the Synthesizer.
synthesizer.deallocate();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
Gracias su interés
[MOD] para publicar código usar las etiquetas GeSHi
No contaba con mucho tiempo pero *hay* un api version 1.0 sobre ese synthesizer que no encuentro, tambien por lo ocupado, pero creo que este ejemplo con todas las api de terceros deberia, deberia ejecutarse bien....