algometrica / larytet-master

Automatically exported from code.google.com/p/larytet-master
0 stars 0 forks source link

Speech support #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
using System;
using System.Speech.Synthesis;
using System.Threading;

namespace TestNarrator
{
   class Program
   {
       static void Main(string[] args)
       {
           SpeechSynthesizer speaker = new SpeechSynthesizer();
           speaker.Rate = 1;
           speaker.Volume = 100;
           speaker.SelectVoice("Microsoft Mary");
           speaker.SpeakAsync("Welcome to the J. Quant. Trading system!");
           Thread.Sleep(1000);
           speaker.SelectVoice("Microsoft Sam");
           speaker.Speak("Call. Option. Has been. Sold!");
           Thread.Sleep(1000);
           speaker.SelectVoice("Microsoft Mike");
           speaker.Speak("Put. Option. Has been. Bought!");
       }
   }
}

Original issue reported on code.google.com by larytet@gmail.com on 13 Oct 2009 at 1:05

GoogleCodeExporter commented 9 years ago
i suggest a separate low priority thread (mailbox thread) for playing
sounds. Application sends string (message) to the thread and thread
plays the sound using free CPU cycles.
There are two types of messages
- control sounds.
- text which requires text to speech.
String describing control sound starts from slash. Something like
"/beep". All preset control sounds are defined as static public
fields.
The methods Play() and Speak() are protected and contain platform
dependent ifdefs. I will add the Linix code.

Another way to save CPU cycles is to skip text to speech conversion
altogether and play prerecorded chunks (how many different phrases you
are going to have ?). This approach also simplifies implementation of
the Linux part.

Original comment by larytet@gmail.com on 13 Oct 2009 at 1:05

GoogleCodeExporter commented 9 years ago
We need a table (map/hash) which maps English words to the filenames
(for example, MP3). If there is no word in the dictionary you can use
default sound, like beep. We can also use one of the already existing
"talking dictionaries". 

External application like MPLayer can play the sound(s) and there are
many mixers which can merge audio files.

If we we need tts then there are lot of online and offline applications
see, for example http://www.dancewithshadows.com/tech/text-to-speech.asp

Original comment by larytet@gmail.com on 13 Oct 2009 at 1:06