Test Foro de elhacker.net SMF 2.1

Programación => Programación General => Java => Mensaje iniciado por: misterguapo30 en 15 Septiembre 2020, 02:12 AM

Título: Sintetizador de voz para java
Publicado por: misterguapo30 en 15 Septiembre 2020, 02:12 AM
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
Título: Re: Sintetizador de voz para java
Publicado por: rub'n en 20 Septiembre 2020, 00:50 AM
Como estaras usando esa API, tienes codigo? segun si que funciona.
Título: Re: Sintetizador de voz para java
Publicado por: misterguapo30 en 20 Septiembre 2020, 00:56 AM
Si, he hecho una prueba con el siguiente código:
Código (java) [Seleccionar]

/*
* 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
Título: Re: Sintetizador de voz para java
Publicado por: rub'n en 25 Septiembre 2020, 12:02 PM
Cita de: misterguapo30 en 20 Septiembre 2020, 00:56 AM
Si, he hecho una prueba con el siguiente código:
Código (java) [Seleccionar]

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