Este artículo se tradujo de forma manual. Mueva el puntero sobre las frases del artículo para ver el texto original.
Traducción
Original
Este tema aún no ha recibido ninguna valoración - Valorar este tema

System.Speech.Synthesis (Espacio de nombres)

¿Le ha resultado útil?
(Caracteres restantes: 1500)
Contenido de la comunidad Agregar
Consola C# - Ejemplo Básico Sintetización de Voz
$0 $0Creamos un proyecto Tipo Consola C#, Creamos una Clase y observamos la estructura base que es la siguiente.$0$0 $0 $0$0 $0 $0$0 $0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Consola_Speech_RV
{

    class Sintetizacion
    {

    }


}
$0
$0$0 $0$0 $0 $0$0 $0 $0$0 $0 $0$0 $0 $0$0 $0$0 $0Añadimos una Referencia a nuestro Proyecto,  en la Pestaña .NET seleccionamos System.Speech y$0 $0utilizamos la Referencia, añadiendo las lineas respectivas en la Cabecera.$0 $0$0 $0$0 $0$0 $0 $0$0 $0 $0$0 $0 $0$0 $0

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech;
using System.Speech.Synthesis;

namespace Consola_Speech_RV
{

    class Sintetizacion
      {
      }     
}
$0
$0$0 $0$0 $0 $0$0 $0 $0$0 $0 $0$0 $0$0 $0Creamos un Objeto de la Clase SpeechSynthesizer llamado oSynthesizer.$0 $0$0 $0 $0public SpeechSynthesizer oSynthesizer = new SpeechSynthesizer(); $0 $0$0 $0 $0Usamos el Siguiente Método:$0 $0$0 $0$0 $0$0 $0

public void speech()


        {
            string first = "I'm ready";
            string a = "Yes";
            string b = "Hello, Today is: " + DateTime.Now.ToShortDateString();
            string c = "¿Do you Want to Exit this Command Window? Yes/No";
            string d = "";
            string e = "I'm Sorry, I can't Understand.";
            string f = "Bye";
            Console.WriteLine(first);            
            oSynthesizer.S***k(first);
            Console.WriteLine(b);
            oSynthesizer.S***k(b);

            do
            {
                Console.WriteLine(c);
                oSynthesizer.S***k(c);
                d = Console.ReadLine();
                if (d == a)
                {
                    Console.WriteLine(f);
                    oSynthesizer.S***k(f);
                }
                else
                {
                    Console.WriteLine(e);
                    oSynthesizer.S***k(e);

                }


            } while (d != a);
      }
$0
$0Al ejecutar el Método en la Clase Program recibimos una indicación de que este método está funcionando ("I'm Ready") luego, la estructura lógica repetitiva Do - While se ejecutará siempre y cuando la cadena ingresada no sea otra que "Yes" $0