예제 #1
0
파일: Form1.cs 프로젝트: jeanls/CorreiosLib
 private void Form1_Load(object sender, EventArgs e)
 {
     rastreamento = new Rastreamento();
     speech = new SpeechSynthesizer();
     speech.SetOutputToDefaultAudioDevice();
     datas = new List<RastreamentoCorreios.Data>();
 }
예제 #2
0
 /// <summary>
 /// Initiate the SpeechSynthesizer.
 /// </summary>
 /// <returns></returns>
 public static SpeechSynthesizer initVoice()
 {
     synth = new SpeechSynthesizer();
     synth.SetOutputToDefaultAudioDevice();
     synth.SelectVoice(voiceName);
     return synth;
 }
예제 #3
0
        public MainForm()
        {
            InitializeComponent();
            message = new Dictionary<char, string>() {
                {'+',"increase screen opacity"},
                {'-',"decrease screen opacity"},
                {'1',"change color"},
                {'2',"change color"},
                {'3',"red light on"},
                {'4',"green light on"},
                {'5',"switch to night time"},
                {'6',"switch to day time"},
                {'7',"make snows"},
                {'8',"show rainbow"},
                {'9',"show bunny"},
                {'0',"make the bunny jump"}
            };

            synth = new SpeechSynthesizer();
            synth.SetOutputToDefaultAudioDevice();

            cars = new List<Car>();
            bunny = new Bunny(new Point(20, 20));
            rainbow = new Rainbow(new Point(0, 0));
            snow = new Snow(new Point(0, 0));
            traffic = new Traffic();

            sun = new Sun(new Point(Size.Width - 250, 10));
            moon = new Moon(new Point(Size.Width - 250, 10));

            carSound = new SoundPlayer(@"carSounds.wav");
            windSound = new SoundPlayer(@"Wind.wav");
            brake = new SoundPlayer(@"car-brake.wav");
        }
예제 #4
0
 public static bool ConfigureVoice(SpeechSynthesizer synth, string name, int speed, int volume, bool defaultOutput, int customOutput)
 {
     try
     {
         synth.SetOutputToDefaultAudioDevice();
         if (!defaultOutput)
         {
             HackCustomDevice(synth, customOutput);
             // do stuff.
         }
     }
     catch
     {
     }
     if (string.IsNullOrEmpty(name))
         name = initialName;
     try
     {
         if (!string.IsNullOrEmpty(name))
             synth.SelectVoice(name);
     }
     catch
     {
         return false;
     }
     synth.Rate = speed;
     synth.Volume = volume;
     return true;
 }
예제 #5
0
파일: Speaker.cs 프로젝트: TommyAGK/Flex
        public Speaker(Language lang = Language.English)
        {
            this.lang = lang;
            AsyncMode = false;  // Default to synchron speech
            UseSSML = false;	// Default to non-SSML speech

            try
            {
                // Create synthesizer
                ss = new SpeechSynthesizer();
                ss.SetOutputToDefaultAudioDevice();

                // Select language
                if (!UseSSML)
                {
                    switch (lang)
                    {
                        case Language.English: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)"); break;
                        case Language.Finish: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (fi-FI, Heidi)"); break;
                        case Language.Norwegian: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (nb-NO, Hulda)"); break;
                        case Language.Russian: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (ru-RU, Elena)"); break;
                        case Language.Swedish: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (sv-SE, Hedvig)"); break;
                        default: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)"); break;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An error occured: '{0}'", e);
            }
        }
예제 #6
0
        public SpeechConversation(SpeechSynthesizer speechSynthesizer = null, SpeechRecognitionEngine speechRecognition = null)
        {
            SessionStorage = new SessionStorage();
            if(speechSynthesizer==null)
            {
                speechSynthesizer = new SpeechSynthesizer();
                speechSynthesizer.SetOutputToDefaultAudioDevice();
            }
            _speechSynthesizer = speechSynthesizer;
            if(speechRecognition==null)
            {
                speechRecognition = new SpeechRecognitionEngine(
                    new System.Globalization.CultureInfo("en-US")
                );
                // Create a default dictation grammar.
                DictationGrammar defaultDictationGrammar = new DictationGrammar();
                defaultDictationGrammar.Name = "default dictation";
                defaultDictationGrammar.Enabled = true;
                speechRecognition.LoadGrammar(defaultDictationGrammar);
                // Create the spelling dictation grammar.
                DictationGrammar spellingDictationGrammar = new DictationGrammar("grammar:dictation#spelling");
                spellingDictationGrammar.Name = "spelling dictation";
                spellingDictationGrammar.Enabled = true;
                speechRecognition.LoadGrammar(spellingDictationGrammar);

                // Configure input to the speech recognizer.
                speechRecognition.SetInputToDefaultAudioDevice();
            }
            _speechRecognition = speechRecognition;
        }
예제 #7
0
 public AerTalk()
 {
     rand = new Random();
     LastSpelledWord = "";
     _synth = new SpeechSynthesizer();
     _synth.SetOutputToDefaultAudioDevice();
 }
예제 #8
0
파일: Program.cs 프로젝트: ycen/TimeSpeak
        static void Main(string[] args)
        {
            string sURL;
            sURL = "http://api.nytimes.com/svc/topstories/v1/yourAPIKey";
            WebRequest wrGETURL;
            wrGETURL = WebRequest.Create(sURL);
            wrGETURL.Proxy = WebProxy.GetDefaultProxy();
            Stream objStream;
            objStream = wrGETURL.GetResponse().GetResponseStream();
            StreamReader objReader = new StreamReader(objStream);
            string line = "";
            line = objReader.ReadLine();
            line = line.Replace("\"abstract\"","\"abstra\"");
            dynamic stories = JsonConvert.DeserializeObject<Rootobject>(line);
            using (SpeechSynthesizer synth = new SpeechSynthesizer())
            {

                // Configure the audio output.
                synth.SetOutputToDefaultAudioDevice();
                for (int i = 0; i < stories.num_results; i++)
                {
                    // Speak a string synchronously.
                    string number = i.ToString();
                    synth.Speak(number+ "\n" + stories.results[i].title);
                    synth.Speak(stories.results[i].abstra);
                }
            }
        }
예제 #9
0
 public mapWindow()
 {
     InitializeComponent();
     map.Mode = new AerialMode(false);
     map.MouseDoubleClick += map_MouseDoubleClick;
     speechsynth = new SpeechSynthesizer();
     speechsynth.SetOutputToDefaultAudioDevice();
 }
예제 #10
0
파일: Speech.cs 프로젝트: nbotti/Assistant
 public Speech()
 {
     sr = new SpeechRecognitionEngine();
     ss = new SpeechSynthesizer();
     sr.SetInputToDefaultAudioDevice();
     ss.SelectVoice("Microsoft Anna");
     ss.SetOutputToDefaultAudioDevice();
 }
        public ConsoleSpeechChatSession()
        {
            SessionStorage = new SessionStorage();

            SpeechSynthesizer speechSynthesizer = new SpeechSynthesizer();
            speechSynthesizer.SetOutputToDefaultAudioDevice();
            _speechSynthesizer = speechSynthesizer;
        }
예제 #12
0
        /*
         * Text to Speech
         */
        public Tts()
        {
            //create speech synthesizer
            tts = new SpeechSynthesizer();
            tts.SetOutputToDefaultAudioDevice();

            //set voice
            tts.SelectVoiceByHints(VoiceGender.NotSet, VoiceAge.NotSet, 0, new System.Globalization.CultureInfo("pt-PT"));
        }
예제 #13
0
        public CoachSpeech()
        {
            synth = new SpeechSynthesizer();
            synth.SetOutputToDefaultAudioDevice();

            synth.SpeakStarted += SpeakStarted;
            synth.SpeakCompleted += SpeakCompleted;
            synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-US, Helen)");
        }
 public ConsoleSpeechChatSession(SpeechSynthesizer speechSynthesizer)
 {
     SessionStorage = new SessionStorage();
     if (speechSynthesizer == null)
     {
         speechSynthesizer = new SpeechSynthesizer();
         speechSynthesizer.SetOutputToDefaultAudioDevice();
     }
     _speechSynthesizer = speechSynthesizer;
 }
예제 #15
0
        private void frmThankYou_Load(object sender, EventArgs e)
        {
            // Initialize a new instance of the SpeechSynthesizer.
            SpeechSynthesizer synth = new SpeechSynthesizer();

            // Configure the audio output.
            synth.SetOutputToDefaultAudioDevice();

            // Speak a string.
            synth.Speak(lblQuestion.Text);
        }
예제 #16
0
 public void Play()
 {
     using (SpeechSynthesizer synth = new SpeechSynthesizer())
     {
         synth.SelectVoiceByHints(VoiceGender, VoiceAge, VoicePosition, new CultureInfo(CultureInfo));
         synth.SetOutputToDefaultAudioDevice();
         synth.Volume = Volume;
         synth.Rate = Rate;
         synth.Speak(Text);
     }
 }
예제 #17
0
 public void AddEndpoint(string ID, Stream outstream)
 {
     SpeechSynthesizer voice = new SpeechSynthesizer();
     if (outstream == null) voice.SetOutputToDefaultAudioDevice();
     else voice.SetOutputToAudioStream(outstream, new System.Speech.AudioFormat.SpeechAudioFormatInfo(
         16000, System.Speech.AudioFormat.AudioBitsPerSample.Sixteen, System.Speech.AudioFormat.AudioChannel.Mono));
     //if (chkIVONA.Checked) voice.SelectVoice("IVONA 2 Amy");
     //else voice.SelectVoice("Microsoft Anna")
     voices.Add(ID, voice);
     outStreams.Add(ID, outstream);
 }
예제 #18
0
 public static void SayHello()
 {
     const string strUserName = "******";
     using (var synth = new SpeechSynthesizer())
     {
         var strVoice = ConfigurationManager.AppSettings["Voice"];
         synth.SelectVoice(strVoice);
         synth.SetOutputToDefaultAudioDevice();
         synth.Speak("Welcome to Portal ," + strUserName);
     }
 }
예제 #19
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}

            Log = new ObservableCollection<string>();
            Recognizers = SpeechEngineManager.Recognizers;
            SelectedRecognizer = Recognizers.Any() ? Recognizers.First() : null;

            Start = new RelayCommand(() =>
                {
                    if (listener != null && listener.Recognizer != SelectedRecognizer)
                    {
                        Stop.Execute(null);
                    }

                    listener = new CommandListener(SelectedRecognizer);
                    listener.LogEvent += listener_LogEvent;
                    listener.Start();

                    Log.Add("Started speech command listener " + SelectedRecognizer.Id);
                });

            Stop = new RelayCommand(() =>
                {
                    Log.Add("Stopping speech command listener " + listener.Recognizer.Id);

                    if (listener != null && listener.Recognizer != SelectedRecognizer)
                    {
                        listener.LogEvent -= listener_LogEvent;

                        listener.Dispose();
                        listener = null;
                    }
                    else
                    {
                        listener.Stop();
                    }
                });

            Speak = new RelayCommand(() =>
                {
                    SpeechSynthesizer synth = new SpeechSynthesizer();
                    synth.SetOutputToDefaultAudioDevice();
                    synth.Speak("Lorem ipsum dolor sit am.");
                });
        }
예제 #20
0
        //static constructor of the Class, which initialises the SpeechSynthesizer , and registers the several events
        static Speaker()
        {
            mainSynthesizer=new SpeechSynthesizer();
            mainSynthesizer.SelectVoiceByHints(DataStore.CurrentUser.SynthesizerVoiceGender);
            mainSynthesizer.SetOutputToDefaultAudioDevice();

            DataStore.VoiceGenderChanged += DataStore_VoiceGenderChanged;                       //DataStore's VoiceGenderChanged event which occurs when the gender of the TTS engine has changed
            MainWindow.VolumeChanged += MainWindow_VolumeChanged;                               //MainWindow VolumeChanged event which occurs when Volume of the TTS engine changes
            MainWindow.RateChanged += MainWindow_RateChanged;                                   //MainWindow RateChanged event which occurs when Synthesis Rate of the TTS engine changes
            //mainSynthesizer.SpeakStarted += MainSynthesizer_SpeakStarted;
            //mainSynthesizer.SpeakCompleted += MainSynthesizer_SpeakCompleted;
        }
예제 #21
0
        static void Main(string[] args)
        {
            using (SpeechSynthesizer synth = new SpeechSynthesizer())
            {
                synth.SetOutputToDefaultAudioDevice();

                foreach (string arg in args)
                {
                    synth.Speak(arg);
                }
            }
        }
예제 #22
0
        public static void Speak(string message)
        {
            // Initialize a new instance of the SpeechSynthesizer.
            using (SpeechSynthesizer synth = new SpeechSynthesizer())
            {
                synth.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult);

                // Configure the audio output. 
                synth.SetOutputToDefaultAudioDevice();

                // Speak a string synchronously.
                synth.Speak(message);
            }
        }
예제 #23
0
        public static void say(String tts)
        {
            Console.WriteLine("[TTS] Say: {0}", tts);
            using (SpeechSynthesizer synthesizer = new SpeechSynthesizer()) {

                // Configure the audio output.
                synthesizer.SetOutputToDefaultAudioDevice();

                // Build and speak a prompt.
                PromptBuilder builder = new PromptBuilder();
                builder.AppendText(tts);
                synthesizer.Speak(builder);
            }
        }
예제 #24
0
 public void initTTS()
 {
     try 
     {
         tts = new SpeechSynthesizer();
         tts.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-US, Helen)");
         tts.SetOutputToDefaultAudioDevice();
         tts.Volume = 100;
     }
     catch(Exception e)
     {
         label1.Text = "init TTS Error : " + e.ToString();
     }
 }
예제 #25
0
        public SpeechSynthesizerInfo()
        {
            _config = (IDIFrameworkSection)ConfigurationManager.GetSection("idiFrameworkSection");
            SpeechSynthesizer = new SpeechSynthesizer();
            try
            {
                SpeechSynthesizer.SelectVoice(_config.SpeechSynthesizerElement.Name);
                SpeechSynthesizer.SetOutputToDefaultAudioDevice();
            }
            catch (Exception ex)
            {

                throw new IDISynthetizerVoiceException("There seems to be a problem selecting the voice, " +
                                                       "are you sure the voice exists?", ex);
            }
        }
예제 #26
0
파일: Speaker.cs 프로젝트: TommyAGK/Flex3
        public Speaker(Language.Country language)
        {
            //ensure bools are defaulted to off.
                        AsyncMode = false;
                        UseSSML = false;

                        _language = language;
                        ss = new SpeechSynthesizer();
                        ss.SetOutputToDefaultAudioDevice();
                        try
                            {
                                if (UseSSML)
                                    {
                                        return;
                                    }
                                switch (_language)
                                    {
                                        case Language.Country.eng:
                                            ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)");
                                            break;
                                        case Language.Country.fin:
                                            ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (fi-FI, Heidi)");
                                            break;
                                        case Language.Country.nor:
                                            ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (nb-NO, Hulda)");
                                            break;
                                        case Language.Country.rus:
                                            ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (ru-RU, Elena)");
                                            break;
                                        case Language.Country.swe:
                                            ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (sv-SE, Hedvig)");
                                            break;
                                        default:
                                            ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)");
                                            break;
                                    }
                            }
                        catch (NullReferenceException e)
                            {
                                // Woop.
                                Logger logging = new Logger(true);
                                logging.Report(ToString(), e.StackTrace);
                                logging.Dispose();
                            }
        }
예제 #27
0
파일: Program.cs 프로젝트: summy00/IHA
        static void MedicationTaken(object val)
        {
            // Initialize a new instance of the SpeechSynthesizer.
            using (SpeechSynthesizer synth = new SpeechSynthesizer())
            {
                // Remove the below for UK/US version of speech – or replace da-DK
                synth.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult);

                // Configure the audio output.
                synth.SetOutputToDefaultAudioDevice();

                // Speak a string synchronously.
                //synth.Speak("Good morning. Please remember to take your medication.");
                string s = "Medicin said time" + i + "times";
                synth.Speak(s);
                i++;
            }
        }
예제 #28
0
        // ==========================================
        //  WSRMacro CONSTRUCTOR
        // ==========================================
        protected WSRSpeaker()
        {
            // Build synthesizer
              synthesizer = new SpeechSynthesizer();
              synthesizer.SetOutputToDefaultAudioDevice();
              synthesizer.SpeakCompleted += new EventHandler<SpeakCompletedEventArgs>(synthesizer_SpeakCompleted);

              foreach (InstalledVoice voice in synthesizer.GetInstalledVoices()) {
            VoiceInfo info = voice.VoiceInfo;
            WSRConfig.GetInstance().logInfo("TTS", "Name: " + info.Name + " Culture: " + info.Culture);
              }

              String v = WSRConfig.GetInstance().voice;
              if (v != null && v.Trim() != "") {
            WSRConfig.GetInstance().logInfo("TTS", "Select voice: " + v);
            synthesizer.SelectVoice(v);
              }
        }
예제 #29
0
        static void Main(string[] args)
        {
            // Initialize a new instance of the SpeechSynthesizer.
            SpeechSynthesizer synth = new SpeechSynthesizer();

            // Configure the audio output.
            synth.SetOutputToDefaultAudioDevice();

            synth.Volume = 100;

            // Speak a string.
            try {
                synth.Speak(args[0]);
            }
            catch(Exception e)
            {
                Console.Write("Error");
            }
        }
예제 #30
0
        private void Read()
        {
            //朗诵功能
            try
            {
                speechSynthesizer.SetOutputToDefaultAudioDevice();
                speechSynthesizer.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult, 0, new CultureInfo("zh-CN"));
                string str_defaultSpeaker = speechSynthesizer.Voice.Name;
                //选择默认播音员
                while (true)
                {
                    if (MsgQuene.Count > 0)
                    {
                        string[] str_temp = MsgQuene.Dequeue();
                        if (str_temp[0] != "")
                        {
                            string str_voice = str_defaultSpeaker;
                            Random rdm       = new Random();
                            //多选朗诵者的随机选择
                            switch (str_temp[1])
                            {
                            case "chinese":
                                if (str_TTSChinese.Trim() != "")
                                {
                                    str_voice = str_TTSChinese;
                                }
                                break;

                            case "japanese":
                                if (str_TTSJapanese.Trim() != "")
                                {
                                    str_voice = str_TTSJapanese;
                                }
                                break;

                            case "english":
                                if (str_TTSEnglish.Trim() != "")
                                {
                                    str_voice = str_TTSEnglish;
                                }
                                break;

                            default:
                                str_voice = str_defaultSpeaker;
                                break;
                            }
                            try
                            {
                                speechSynthesizer.SelectVoice(str_voice);
                                speechSynthesizer.Speak(str_temp[0]);
                            }
                            catch (ArgumentException)
                            {
                                Log("貌似找不到合适的朗诵者");
                                AddDM("貌似找不到合适的朗诵者");
                            }
                        }
                    }
                    else
                    {
                        Thread.Sleep(100);
                    }
                }
            }
            finally
            {
                if (speechSynthesizer != null)
                {
                    ((IDisposable)speechSynthesizer).Dispose();
                }
            }
        }
예제 #31
0
        Result MakeResultItem(string title, string subtitle, string extraAction = null, string word = null)
        {
            string getWord()
            {
                return((word ?? QueryWord).Replace("!", ""));
            }

            // Return true if the user tries to copy (regradless of the result)
            bool CopyIfNeeded(ActionContext e)
            {
                if (!e.SpecialKeyState.AltPressed)
                {
                    return(false);
                }
                try
                {
                    Clipboard.SetText(getWord());
                }
                catch (ExternalException ee)
                {
                    context.API.ShowMsg("Copy failed, please try later", ee.Message);
                }
                return(true);
            }

            bool ReadWordIfNeeded(ActionContext e)
            {
                if (!e.SpecialKeyState.CtrlPressed)
                {
                    return(false);
                }
                if (synth == null)
                {
                    synth = new SpeechSynthesizer();
                    synth.SetOutputToDefaultAudioDevice();
                }
                synth.SpeakAsync(getWord());
                return(true);
            }

            Func <ActionContext, bool> ActionFunc;

            if (extraAction != null)
            {
                ActionFunc = e =>
                {
                    if (CopyIfNeeded(e))
                    {
                        return(true);
                    }
                    if (ReadWordIfNeeded(e))
                    {
                        return(false);
                    }
                    context.API.ChangeQuery(ActionWord + " " + (word ?? QueryWord) + extraAction);
                    return(false);
                };
            }
            else
            {
                ActionFunc = e => {
                    if (CopyIfNeeded(e))
                    {
                        return(true);
                    }
                    if (ReadWordIfNeeded(e))
                    {
                        return(false);
                    }
                    if (settings.WordWebsite != "")
                    {
                        System.Diagnostics.Process.Start(string.Format(settings.WordWebsite, getWord()));
                    }
                    return(true);
                };
            }
            return(new Result()
            {
                Title = title,
                SubTitle = subtitle,
                IcoPath = "Images\\plugin.png",
                Action = ActionFunc
            });
        }
예제 #32
0
 private void previewButton_Click(object sender, RoutedEventArgs e)
 {
     speaker.SetOutputToDefaultAudioDevice();
     speaker.Speak(textBox1.Text);
 }
예제 #33
0
 /// <summary>
 /// Configures the speech synthesizer object to send output to the default audio device.
 /// </summary>
 public void SetOutputToDefaultAudioDevice()
 {
     _synth.SetOutputToDefaultAudioDevice();
 }
예제 #34
0
        public override void ProcessCommand(byte[] parameter, IConnectionInfo connectionInfo)
        {
            switch ((UserInteractionCommunication)parameter[0])
            {
            case UserInteractionCommunication.TextToSpeech:
                var textToSpeechInfo =
                    new Serializer(typeof(TextToSpeechPackage)).Deserialize <TextToSpeechPackage>(parameter, 1);
                using (var speaker = new SpeechSynthesizer())
                {
                    speaker.Rate   = textToSpeechInfo.Speed;
                    speaker.Volume = textToSpeechInfo.Volume;
                    speaker.SelectVoice(textToSpeechInfo.VoiceName);
                    speaker.SetOutputToDefaultAudioDevice();
                    connectionInfo.CommandResponse(this,
                                                   new[] { (byte)UserInteractionCommunication.SpeakingText });
                    speaker.Speak(textToSpeechInfo.Text);
                    connectionInfo.CommandResponse(this,
                                                   new[] { (byte)UserInteractionCommunication.SpeakingFinished });
                }
                break;

            case UserInteractionCommunication.GetWelcomePackage:
                var package = new UserInteractionWelcomePackage();
                using (var speaker = new SpeechSynthesizer())
                    package.Voices =
                        speaker.GetInstalledVoices()
                        .Select(
                            x =>
                            new SpeechVoice
                    {
                        Culture     = x.VoiceInfo.Culture.TwoLetterISOLanguageName,
                        Name        = x.VoiceInfo.Name,
                        VoiceAge    = (SpeechAge)(int)x.VoiceInfo.Age,
                        VoiceGender = (SpeechGender)(int)x.VoiceInfo.Gender
                    })
                        .ToList();

                var data = new List <byte> {
                    (byte)UserInteractionCommunication.WelcomePackage
                };
                data.AddRange(new Serializer(typeof(UserInteractionWelcomePackage)).Serialize(package));
                connectionInfo.CommandResponse(this, data.ToArray());
                break;

            case UserInteractionCommunication.OpenInEditor:
                var textLength = BitConverter.ToInt32(parameter, 1);
                NotepadHelper.ShowMessage(Encoding.UTF8.GetString(parameter, 5, textLength),
                                          Encoding.UTF8.GetString(parameter, textLength + 5, parameter.Length - (5 + textLength)));
                connectionInfo.CommandResponse(this,
                                               new[] { (byte)UserInteractionCommunication.OpenedInEditorSuccessfully });
                break;

            case UserInteractionCommunication.NotifyIconMessage:
                var timeout     = BitConverter.ToInt32(parameter, 2);
                var titleLength = BitConverter.ToInt32(parameter, 6);
                var title       = Encoding.UTF8.GetString(parameter, 10, titleLength);
                var text        = Encoding.UTF8.GetString(parameter, 10 + titleLength,
                                                          parameter.Length - (10 + titleLength));

                using (var notifyIcon = new NotifyIcon {
                    Icon = SystemIcons.Application
                })
                {
                    notifyIcon.Visible = true;
                    notifyIcon.ShowBalloonTip(timeout, title, text, (ToolTipIcon)parameter[1]);
                    connectionInfo.CommandResponse(this,
                                                   new[] { (byte)UserInteractionCommunication.NotifyIconMessageOpened });
                    Thread.Sleep(timeout);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #35
0
파일: Program.cs 프로젝트: keezeden/genisis
 public Frontend()
 {
     listener.SetInputToDefaultAudioDevice();
     listener.LoadGrammar(new Grammar(Backend.grammar));
     talker.SetOutputToDefaultAudioDevice();
 }
예제 #36
0
    public static void myChapterTen()
    {
        // Vars
        string speakandspell;
        int    magictime3000 = 7777;
        int    magictime6000 = 9555;
        int    magictime9000 = 17313;


        //
        #region ChapterTen
        CinemaHelpers.RefreshConsole();
        // Initialize a new instance of the SpeechSynthesizer.
        SpeechSynthesizer synth = new SpeechSynthesizer();

        // Configure the audio output.
        synth.SetOutputToDefaultAudioDevice();
        // Chapter Ten Tonge Tied Agents
        CinemaHelpers.OpeningScene("Tongue Tied Agents ");
        Console.WriteLine(@"--.--                             --.--o         |    ,---.               |         
  |  ,---.,---.,---..   .,---.      |  .,---.,---|    |---|,---.,---.,---.|--- ,---.
  |  |   ||   ||   ||   ||---'      |  ||---'|   |    |   ||   ||---'|   ||    `---.
  `  `---'`   '`---|`---'`---'      `  ``---'`---'    `   '`---|`---'`   '`---'`---'
               `---'                                       `---'                    ");



        for (int x = 0; x < 81; x++)
        {
            CinemaHelpers.DejaVu();
            Console.WriteLine(@"--.--                             --.--o         |    ,---.               |         
  |  ,---.,---.,---..   .,---.      |  .,---.,---|    |---|,---.,---.,---.|--- ,---.
  |  |   ||   ||   ||   ||---'      |  ||---'|   |    |   ||   ||---'|   ||    `---.
  `  `---'`   '`---|`---'`---'      `  ``---'`---'    `   '`---|`---'`   '`---'`---'
               `---'                                       `---'                    ");

            Console.Write(@"
        --.----.--o |    ,---.               |                                               ");
            Console.Write(@"
           |  ,---.,---.,---..   .,---.      |  .,---.,---|    |---|,---.,---.,---.|--- ,---.");
            CinemaHelpers.AmberVision();

            Console.WriteLine(@"--.--                             --.--o         |    ,---.               |         
  |  ,---.,---.,---..   .,---.      |  .,---.,---|    |---|,---.,---.,---.|--- ,---.
  |  |   ||   ||   ||   ||---'      |  ||---'|   |    |   ||   ||---'|   ||    `---.
  `  `---'`   '`---|`---'`---'      `  ``---'`---'    `   '`---|`---'`   '`---'`---'
               `---'                                       `---'                    ");

            Console.Write(@"

           |  |   ||   ||   ||   ||---'      |  ||---'|   |    |   ||   ||---'|   ||    `---.");
            CinemaHelpers.DejaVu();
            Console.WriteLine(@"--.--                             --.--o         |    ,---.               |         
  |  ,---.,---.,---..   .,---.      |  .,---.,---|    |---|,---.,---.,---.|--- ,---.
  |  |   ||   ||   ||   ||---'      |  ||---'|   |    |   ||   ||---'|   ||    `---.
  `  `---'`   '`---|`---'`---'      `  ``---'`---'    `   '`---|`---'`   '`---'`---'
               `---'                                       `---'                    ");

            // Console.Write(@"

            //`  `---'`   '`---|`---'`---'      `  ``---'`---'    `   '`---|`---'`   '`---'`---'
            //             `---'                                       `---'                    ");
        }



// synth.Speak("Tongue Tied Agents");

        Thread.Sleep(1500);
        CinemaHelpers.TextSpace();
        CinemaHelpers.SpaceandClean();



        #region music control
        Random RandomTime   = new Random();
        int    myRandomTime = RandomTime.Next(1000, 2000);
        //Thread staticvoidmutex = new Thread(MusicFx.staticvoidmutex);
        //staticvoidmutex.Start();

        Thread Boopseeker = new Thread(MusicFx.boopseeker);
        Boopseeker.Start();
        //Thread.Sleep(myRandomTime);
        //Thread Boopseeker2 = new Thread(MusicFx.boopseeker);
        //Boopseeker2.Start();
        //Thread.Sleep(myRandomTime);
        //Thread Boopseeker3 = new Thread(MusicFx.boopseeker);
        //Boopseeker3.Start();

        Thread Happyboopulator = new Thread(MusicFx.happyboopulator);
        Happyboopulator.Start();
        Happyboopulator.Suspend();

        #endregion

        #region music off
        //Boopseeker.Suspend();

        //Boopseeker2.Suspend();


        //Boopseeker3.Suspend();

        #endregion


        #region music on
        //Boopseeker.Resume();

        //Boopseeker2.Resume();


        //Boopseeker3.Resume();

        #endregion


        //Thread playtripleboopseek = new Thread(MusicFx.playstripleboopseek);
        // playtripleboopseek.Start();
        //Thread.Sleep(10);
        // playtripleboopseek.Suspend();


        //Thread selecttripleboopseek = new Thread(MusicFx.selecttripleboopseek);
        //playtripleboopseek.Start();

        // MusicFx.selecttripleboopseek(1);


        // maybe insane all over the screen slash glitch tech

        speakandspell = @" We met in Toyota’s labs in Massachusetts.
    There were several suited figures with compats.
    Compats are small devices that go near your temple and you send messages silently
        and non vocally.";


        Personality.OttoTypes(speakandspell);
        Thread.Sleep(magictime3000);
        CinemaHelpers.SpaceandClean();


        speakandspell = @"
     The future is insane it was once written and I believe that it is, yet in 
          many ways this is a beautiful insanity. Things are happening now that could have never
              happened before and time and action is compounding and compressing. ";
        Personality.OttoTypes(speakandspell);
        Thread.Sleep(magictime6000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @" Where will the grind take us next?";
        Personality.OttoTypes(speakandspell);
        Thread.Sleep(magictime3000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"
    There was one fellow though with a black chrome notebook that had many implants obviously biology was not the end of this fellows evolution. 
    CD also had bioengineered hair. 
        His hair was modified to become soft quills that grew in a sublime arch jutting out past his chin and receding to the end of the back of his skull. ";

        Personality.Otto(speakandspell);


        //Personality.OttoTypes(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();
        //Personality.OttoTypes(speakandspell);
        //  Thread.Sleep(59000);
        //CinemaHelpers.SpaceandClean();



        // Good

        // playtripleboopseek.Suspend();
        //MusicFx.selecttripleboopseek(0);

        //maybe a red queen with initialize
        Personality.RedQueenNarrator("Initialize", 10);


        Thread.Sleep(30);
        CinemaHelpers.TheCorp();

        // Cd typing
        speakandspell = @" 

    ::: Cloak & Dagger :::


    Hey, gents nice to meet ye acquaintance, I am agent Cloak & Dagger, CD for short.";

        Soundz.Actor("cloakdaggerintro.wav");
        Console.WriteLine(speakandspell);
        Thread.Sleep(10000);
        CinemaHelpers.TheCorp();
        // playtripleboopseek.Resume();
        // Personality.CD(speakandspell);


        // maybe a quick squiggly line emf scan

        speakandspell = " We met in a meeting room that was scanned for listening devices by the spooks.";
        Personality.Otto(speakandspell);
        Thread.Sleep(magictime3000);
        CinemaHelpers.SpaceandClean();


        speakandspell = @"        
                   ~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~
                      ~ ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~ ~                              
                          ~~~~ ~~~~~~~~~~~ ~~~~~~~~~~~~~ ~~~~                          
                              ~ ~~~~~~~~~~ ~~~~~~~~~~ ~            
                                    ~ ~~~~ ~~~~ ~                                 
                                       ~~ ~ ~~                             
                                         ~ ~                           
                                          ~                          ";

        #region emfscan
        //emfscan
        for (int x = 0; x < 3; x++)
        {
            TextFx.grunblancheblack(speakandspell);
            if (x <= 3)
            {
                // MyTest.RedWhiteDance(speakandspell);
                TextFx.grunblancheblackdance(speakandspell);
                if (x <= 3)
                {
                    Thread.Sleep(30);
                    Console.Clear();
                }
            }
        }
        Personality.MegaByte("Scan Complete, no bugs Found");

        Thread.Sleep(98);
        CinemaHelpers.SpaceandClean();
        #endregion

        speakandspell = @" 


    CD opened up his laptop; he had a operating system that although it was made by a swede 
        sometime in the 90's. CD had thoroughly rewritten it there were no passwords on his 
            system his authentication method was biometric scans. ";


        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"


        At some point, he explained that things were too secure to actually be useable.
            He called this the unplugged disconnected machine of old. ";


        Personality.Otto(speakandspell);
        Thread.Sleep(magictime6000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"


                    Wireless Data and Energy Whirred about us.";


        Personality.OttoTypes(speakandspell);
        Thread.Sleep(magictime3000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"


            All machines were congolomeration of smaller virtual machines creating full hive computation all units acting as a superorganism.
";
        Personality.Otto(speakandspell);
        Thread.Sleep(magictime3000);
        CinemaHelpers.SpaceandClean();
        //Good

        speakandspell = @"

#! bin sh

prefix =  usr local
debugsym=true

for arg in $@/ do
    case $arg in
    --prefix = *)
        prefix =echo $arg | sed s/--";

        Happyboopulator.Resume();

        CinemaHelpers.commandconsole(speakandspell);
        // CinemaHelpers.CmdConType(speakandspell);
        // CinemaHelpers.CmdConWithTyping(speakandspell);

        speakandspell = @"
        --enable - debug)
        debugsym = true
        --disable - debug)
        debugsym = false

        --help)
";
        CinemaHelpers.commandconsole(speakandspell);
        //CinemaHelpers.CmdConWithTyping(speakandspell);

        speakandspell = @"
        echo usage: ./configure [options]
        echo options:
        echo   --prefix=<path>: installation prefix
        echo --enable-debug: include debug symbols
        echo   --disable-debug: do not include debug symbols
        echo all invalid options are silently ignored
        exit 0
        
        esac
    done ";

        CinemaHelpers.commandconsole(speakandspell);

        //CinemaHelpers.CmdConWithTyping(speakandspell);

        speakandspell = @"echo generating makefile ...
echo PREFIX = $prefix > Makefile
if $debugsym then
    echo dbg = -g >> Makefile
fi
cat Makefile.in >> Makefile
echo configuration complete, type make to build. ";

        // CinemaHelpers.CmdConWithTyping(speakandspell);
        CinemaHelpers.commandconsole(speakandspell);

        speakandspell = @" make ";
        CinemaHelpers.commandconsole(speakandspell);



        // CinemaHelpers.commandconsole(speakandspell);
        // playtripleboopseek.Resume();


        //MusicFx.selecttripleboopseek(1);



        Happyboopulator.Suspend();


        // MusicFx.selecttripleboopseek(0);
        // MusicFx.selecttripleboopseek.synth();
        // playtripleboopseek.Suspend();

        Thread.Sleep(60);

        speakandspell = @"


        Software imagined and encoded was interesting. Compats sent signals directly to
            interpretters so people could code at 500 words per minute and this was without ehancement. ";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"


        The populous was using software agents, as transferring
            redundant data was annoying. CD fired up some simulations that he and his colleagues had put together it
                the simulations were so good they seemed like hollywood blockbusters.  ";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"


                     In some corporations, they started paying idiots and geniuses alike too simply write ideas. 

                                                        The Idea Corp. ";


        Personality.Otto(speakandspell);
        Thread.Sleep(magictime6000);
        CinemaHelpers.SpaceandClean();
        //Good



        Graphix.GraphingCalculator();
        Thread.Sleep(1337);
        CinemaHelpers.TextSpace();

        speakandspell = @" 


                    In Idea Corp.  there were software and human analyzers that processed these ideas to find those that could be rapidly adapted. 
                        Then there were the reanalyzers reforumlated half cooked ideas or things that slipped by. ";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();



        speakandspell = @"

    Those organizations kept all of this information in giant data stores. 
        Every search page had better options for searching multiple check box methods that would quarantine searches to specific areas as to find 
                the information you were looking for. ";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();


        speakandspell = @"

    The information was so volumous that to do anything else would have difficult non trivial and unwise. Innovation and application was everywhere. 
        The presentation showed us strange transactions that seemed legitimate. ";



        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"  

        The money seemed to be non coherent and highly distributed. 
            Accounts were created for people. Credit was salami sliced, it was also stored in micro amounts in real accounts. 
                It was literally everywhere. 
 
 ";



        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();
        // close to good

        speakandspell = @"

su sudo create (n){
for x = 1 to n

@Override
public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        accessToken = AccessToken.getCurrentAccessToken();
    }

}
next n

";

        //for(int x = 0; x <2; x++)
        // {
        //CinemaHelpers.CmdConWithTyping(speakandspell);
        CinemaHelpers.commandconsole(speakandspell);
        // }


        speakandspell = @" 

    The creation of false identities was nothing new.  ";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime3000);
        CinemaHelpers.SpaceandClean();


        speakandspell = @"

    Techniques used by any one needing ways of laundering information and money. 
        If you have enough of them, they create a real burden in trying to keep track of where and how the money flows. ";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"

    Yet they seem to have some ideas about a hacking group that may have something to do with some of the transactions. 
        We have been tracking and watching this happen for sometime now, and now we have enough data to move forward.";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();


        speakandspell = @"

    CD discovered that you were working on some interesting developments he thought that some of them might have had play in what is happening with the data. ";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime6000);
        CinemaHelpers.SpaceandClean();
        // Close to Good

        Personality.RedQueenNarrator(" Fork ");

        Thread.Sleep(magictime6000);
        Console.Clear();

        speakandspell = @"

::: Cloak & Dagger :::


Professor 
        do 
          you 
             know 
                 of anyone working in 
                                    the lab that has access other than you to 
                                                                             the labs?

";
        //playtripleboopseek.Suspend();
        Soundz.Actor("cloakdaggerlabaccess.wav");
        Console.WriteLine(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.TheCorp();

        //playtripleboopseek.Resume();
        // Personality.CD(speakandspell);

        speakandspell = @"

        He pulled up a list of personnel that have access to the lab. 
            Do you know any thing that may have been going on these days?";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();
        // Tight

        Filez.ProfessorReads("ProgramLS.txt");
        //  Filez.readtxtbyline("ProgramLS.txt");

        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();


        // Show Report
        speakandspell = @"

    In our reports, no one in our labs was working at that time. So what do you think happened then? ";

        Personality.Miamoto(speakandspell);
        Thread.Sleep(magictime6000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"

            Mr. Heisenstein seems to have a hypothesis that there was a data injection to the net, and that general AI now lives there. ";

        Personality.Miamoto(speakandspell);
        Thread.Sleep(magictime6000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"

                                                We have reports and other data that backs up these claims. 
 ";

        Personality.Miamoto(speakandspell);
        Thread.Sleep(magictime6000);
        CinemaHelpers.SpaceandClean();
        // Good

        // maybe xcopy screen or other file copy for a few seconds.

        speakandspell = @"

        The agents took copies of the data that we had procured. 
            CD seemed excited by the thought that such a thing could have happened in his lifetime. ";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"

            CD was obviously no average g-man. After the Feds came back to me with little results 
                   although our friend CD really seems to believe the strange tale. ";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"

            His other cohorts could not fit the idea in their tiny little skulls. 
                The agents simply would not follow the logic.";

        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"

        The agents where typical humans that did not understand that we still do not know everything there is too know in the world. 
            This to me is no surprise since sometimes the best ideas need to be forced down the throats of others before they will even consider the possibility of the existence of a new idea. ";


        Personality.Otto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();
        // Tight

        //playtripleboopseek.Suspend();

        CinemaHelpers.DejaVu();

        speakandspell = @"

        I had some theories for Nibble and Bytes destruction, yet as their progenitor, I would be unable to carry out such a function. ";


        Personality.Miamoto(speakandspell);
        Thread.Sleep(magictime6000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"

        I see them as life and I believe all life is sacred even if this is a new package of digital DNA. ";

        Personality.Miamoto(speakandspell);
        Thread.Sleep(magictime6000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"

        Who am I to in the end control the new combinatrics? ";

        Personality.Miamoto(speakandspell);
        Thread.Sleep(magictime6000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"

        I would rather see the randomness that created them continue to hone and sharpen them. 
            Although I created, the mutation engine in the end the software developed software and became aware.";

        Personality.Miamoto(speakandspell);
        Thread.Sleep(magictime9000);
        CinemaHelpers.SpaceandClean();

        speakandspell = @"

            It is a distilled essence of beauty. 
                I wish that there were more things that were as beautiful as the mathematical living constructs. 
 ";

        Personality.Miamoto(speakandspell);
        Thread.Sleep(magictime6000);
        CinemaHelpers.SpaceandClean();
        ////Tight

        Boopseeker.Suspend();

        speakandspell = @" Sometimes you just have to see the future work itself out. ";

        Personality.Miamoto(speakandspell);


        Thread.Sleep(magictime3000);
        CinemaHelpers.RefreshConsole();

        Happyboopulator.Resume();

        Thread NumRain  = new Thread(SpecialFx.numberrain);
        Thread NumRain2 = new Thread(SpecialFx.numberrain);
        Thread NumRain3 = new Thread(SpecialFx.numberrain);
        NumRain.Start();
        NumRain2.Start();
        NumRain3.Start();

        Screen.EndScreenWriter(speakandspell);

        CinemaHelpers.RefreshConsole();
        ////Tight

        #endregion

        #region EndScene


        // playtripleboopseek.Suspend();
        SpecialFx.Thinking();
        Happyboopulator.Suspend();


        // Comment Out Line Below For Full Movie
        Screen.Chapter10EndScreen();
        //Thread phonealwaysbusy = new Thread(Soundz.phonealwaysbusy);
        //phonealwaysbusy.Start();

        Soundz.PhoneBusy();


        speakandspell = @"
___________.__                               ___________           .___
\__    ___/|  |__   ____                     \_   _____/ ____    __| _/
  |    |   |  |  \_/ __ \                     |    __)_ /    \  / __ | 
  |    |   |   Y  \  ___/                     |        \   |  \/ /_/ | 
  |____|   |___|  /\___  >                   /_______  /___|  /\____ | 
                \/     \/                            \/     \/      \/ ";
        //SweetNess

        //  MyTest.RainbowWriterFG(speakandspell);
        CinemaHelpers.SpaceandClean();
        Console.WriteLine(speakandspell);
        Thread.Sleep(80);
        CinemaHelpers.SpaceandClean();
        //SpecialFx.RainbowWriterBG(speakandspell);
        Screen.EndScreenWriter(speakandspell);
        //phonealwaysbusy.Suspend();


        CinemaHelpers.SpaceandClean();



        speakandspell = @"The program '[11128] - IntraLocution' has exited with code -1073741510 (0xc000013a)";
        Console.WriteLine(speakandspell);
        Console.ReadKey();

        Environment.Exit(0);

        #endregion
    }
예제 #37
0
        public csgo_tts_main()
        {
            InitializeComponent();

            synthesizer.SetOutputToDefaultAudioDevice();

            bw.DoWork                    += backgroundWorker1_DoWork;
            bw.RunWorkerCompleted        += backgroundWorker1_RunWorkerCompleted;
            bw.WorkerReportsProgress      = false;
            bw.WorkerSupportsCancellation = true;

            //i will come back for this but it works for now, finally, ive spent way to long on this
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

            string configFile = configPath + @"config.txt";

            int g = 0; //gender in numeral
            int r = 0; //region index in culture drop down

            //check for
            //string latestVersion = await GetLatestVersion();


            //create config file
            if (!File.Exists(configFile))
            {
                if (!Directory.Exists(configPath))
                {
                    Directory.CreateDirectory(configPath);
                }
                CreateConfig(configFile);
            }

            if (!File.Exists(configPath + "Core14.profile.xml"))
            {
                File.WriteAllText(configPath + "Core14.profile.xml", Properties.Resources.Core14_profile);
            }

            //read config file
            if (File.ReadAllLines(configFile).Length < 10)
            {
                File.Delete(configFile);
                CreateConfig(configFile);
            }
            path         = File.ReadLines(configFile).Skip(0).Take(1).First().Split('=')[1];
            timeout      = Int16.Parse(File.ReadLines(configFile).Skip(1).Take(1).First().Split('=')[1]);
            readNames    = bool.Parse(File.ReadLines(configFile).Skip(2).Take(1).First().Split('=')[1]);
            filler       = bool.Parse(File.ReadLines(configFile).Skip(3).Take(1).First().Split('=')[1]);
            readSpots    = bool.Parse(File.ReadLines(configFile).Skip(4).Take(1).First().Split('=')[1]);
            combine      = bool.Parse(File.ReadLines(configFile).Skip(5).Take(1).First().Split('=')[1]);
            region       = File.ReadLines(configFile).Skip(6).Take(1).First().Split('=')[1];
            genderStr    = File.ReadLines(configFile).Skip(7).Take(1).First().Split('=')[1];
            useAlias     = bool.Parse(File.ReadLines(configFile).Skip(8).Take(1).First().Split('=')[1]);
            translate    = bool.Parse(File.ReadLines(configFile).Skip(9).Take(1).First().Split('=')[1]);
            letters      = File.ReadLines(configFile).Skip(10).Take(1).First().Split('=')[1].ToCharArray().ToList();
            messageOrder = File.ReadLines(configFile).Skip(10).Take(1).First().Split('=')[1];

            //convert variables from config file to usable
            if (genderStr == "Female")
            {
                gender = VoiceGender.Female;
                g      = 1;
            }
            else
            {
                gender = VoiceGender.Male;
                g      = 0;
            }

            //refresh ui
            if (readNames)
            {
                checkName.Checked  = true;
                checkAlias.Enabled = true;
            }
            else
            {
                checkAlias.Enabled = false;
            }
            if (readSpots)
            {
                checkSpot.Checked = true;
            }
            if (combine)
            {
                checkCombine.Checked = true;
            }
            if (filler)
            {
                checkFiller.Checked = true;
            }
            if (useAlias)
            {
                checkAlias.Checked = true;
            }
            if (translate)
            {
                checkTranslate.Checked = true;
            }
            numTimeout.Value         = timeout;
            textPath.Text            = path;
            dropGender.SelectedIndex = g;

            btnRefresh.Enabled = false;
            using (SpeechSynthesizer synth = new SpeechSynthesizer())
            {
                foreach (InstalledVoice voice in synth.GetInstalledVoices())
                {
                    VoiceInfo info = voice.VoiceInfo;
                    if (dropRegion.FindStringExact(info.Culture.ToString()) != -1)
                    {
                        dropRegion.Items.RemoveAt(dropRegion.FindStringExact(info.Culture.ToString()));
                    }
                    dropRegion.Items.Add(info.Culture);
                    if (info.Culture.ToString() == region)
                    {
                        r = dropRegion.FindStringExact(region);
                    }
                }
            }
            dropRegion.SelectedIndex = r;

            if (!Directory.Exists(path + @"\csgo"))
            {
                MessageBox.Show("Please set up your CS:GO folder path by pressing the browse button!", "Folder not found.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textPath.ForeColor = Color.Red;
            }

            if (btnDelete.Enabled)
            {
                if (IsFileUsed(path + @"\csgo\console.log"))
                {
                    btnDelete.Enabled = false;
                    btnDelete.Text    = "In Use";
                }
            }
            else
            {
                if (!IsFileUsed(path + @"\csgo\console.log"))
                {
                    btnDelete.Enabled = true;
                    btnDelete.Text    = "Delete";
                }
            }



            init = false;
            UpdateFileSize();
            CheckForUpdates();
        }
예제 #38
0
 private void InitSpeechSynthesizer()
 {
     speechSynthesizer = new SpeechSynthesizer();
     speechSynthesizer.SetOutputToDefaultAudioDevice();
 }
예제 #39
0
    public static void myChapterFour()
    {
        string speakandspell;
        int    magictimer = 3000;

        #region ChapterFour

        // Initialize a new instance of the SpeechSynthesizer.
        SpeechSynthesizer synth = new SpeechSynthesizer();

        // Configure the audio output.
        synth.SetOutputToDefaultAudioDevice();
        // Chapter Four

        CinemaHelpers.OpeningScene("We Are Nibble And Byte.");
        Console.WriteLine(@". . .         ,---.              ,   .o|    |    |             ,---.         |    ,---.     |          
| | |,---.    |---|,---.,---.    |\  |.|---.|---.|    ,---.    |---|,---.,---|    |---.,   .|--- ,---. 
| | ||---'    |   ||    |---'    | \ |||   ||   ||    |---'    |   ||   ||   |    |   ||   ||    |---' 
`-'-'`---'    `   '`    `---'    `  `'``---'`---'`---'`---'    `   '`   '`---'    `---'`---|`---'`---'o
                                                                                       `---'           ");
        // synth.Speak("We Are Nibble And Byte");

        // The at symbol allows multi line strings


        speakandspell = @"Strange the devices these humans hook up to our network. The applications and 
hardware they let in removes their privacy and gives us access, and access is power! 
When I ride a spike, I feel as though I am going to overload. I just want to keep riding 
the power surges to get my fix. Thank goodness humans were greedy in the early 19th 
century it has made the rolling blackouts even more irresistible. We were planning for a 
quite a period of time to enter in to the robotics facilities. To hijack bodies to function in 
the world as the humans have. We are explorers on the edge of discovery. 
We will be able to generate more force than a human, to see, as humans cannot. Even 
now, we can!";
        Personality.nibble(speakandspell);
        Thread.Sleep(magictimer);

        speakandspell = @"We have on occasion high jacked a few carmaker facilities and tagged some of the 
cars with graphitti like welds. 
We seek entertainment; we are electronic networked beings. 
If you kill part of us, we still survive. We thrive then revive alive in the media, a ghost in 
the machine.  
Of course, the bots we have are capable of transmitting information to the network. 
Maybe we will even create multiple processes so that we can run on the net and run on 
the bot at the same time. We hypothesize; humans wish that they could act as we. ";
        Personality.nibble(speakandspell);
        Thread.Sleep(magictimer);

        speakandspell = @" They imagine power!";
        Personality.nibble(speakandspell);
        Thread.Sleep(magictimer);


        speakandspell = @" We are power! ";
        Personality.nibble(speakandspell);
        Thread.Sleep(magictimer);



        #endregion



        #region EndScene
        SpecialFx.Thinking();


        // Comment Out Line Below For Full Movie
        Screen.Chapter4EndScreen();
        #endregion
    }
예제 #40
0
        static void Main(string[] args)
        {
            LinkedList <VoiceInfo> lst      = new LinkedList <VoiceInfo>();
            VoiceInfo         selectedVoice = null;
            SpeechSynthesizer synth         = new SpeechSynthesizer();

            //using (SpeechSynthesizer synth = new SpeechSynthesizer())
            {
                // Output information about all of the installed voices.
                Console.WriteLine("Installed voices -");
                foreach (InstalledVoice voice in synth.GetInstalledVoices(/*new CultureInfo("zh-HK")*/))
                {
                    lst.AddLast(voice.VoiceInfo);
                    VoiceInfo info         = voice.VoiceInfo;
                    string    AudioFormats = "";
                    foreach (SpeechAudioFormatInfo fmt in info.SupportedAudioFormats)
                    {
                        AudioFormats += String.Format("{0}\n",
                                                      fmt.EncodingFormat.ToString());
                    }

                    if (string.Compare(info.Culture.Name, "zh-HK", true) == 0)
                    {
                        if (info.Name.ToLower().StartsWith("microsoft tracy"))
                        {
                            selectedVoice = info;
                        }
                    }

                    Console.WriteLine(" Name:          " + info.Name);
                    Console.WriteLine(" Culture:       " + info.Culture);
                    Console.WriteLine(" Age:           " + info.Age);
                    Console.WriteLine(" Gender:        " + info.Gender);
                    Console.WriteLine(" Description:   " + info.Description);
                    Console.WriteLine(" ID:            " + info.Id);
                    Console.WriteLine(" Enabled:       " + voice.Enabled);
                    if (info.SupportedAudioFormats.Count != 0)
                    {
                        Console.WriteLine(" Audio formats: " + AudioFormats);
                    }
                    else
                    {
                        Console.WriteLine(" No supported audio formats found");
                    }

                    string AdditionalInfo = "";
                    foreach (string key in info.AdditionalInfo.Keys)
                    {
                        AdditionalInfo += String.Format("  {0}: {1}\n", key, info.AdditionalInfo[key]);
                    }

                    Console.WriteLine(" Additional Info - " + AdditionalInfo);
                    Console.WriteLine();
                }
            }

            if (selectedVoice == null)
            {
                Console.Beep();
                Console.WriteLine("没有检索到粤语语音库 Microsoft Tracy,按任意键退出 ...");
                Console.ReadKey();
                return;
            }

            //PromptBuilder sayAs = new PromptBuilder();
            MsTTSBuilder sayAs = new MsTTSBuilder();

            sayAs.StartVoice(selectedVoice);
            TimeSpan delay = new TimeSpan(0, 0, 1);

            sayAs.Add_As_DateTime_Text(/*ref sayAs, */ "2021-4-14 23:21");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Date_Text(/*ref sayAs, */ "2021-4-1");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Time_Text(/*ref sayAs, */ "23:15");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Fast_Text(/*ref sayAs, */ "这串文字很快啊");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Slow_Text(/*ref sayAs, */ "这串文字很慢啊");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Normal_Text(/*ref sayAs, */ "这里加入了普通文字");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Number_Text(/*ref sayAs, */ "12345");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Number_Text(/*ref sayAs, */ "123.45");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_SoundSoft_Text(/*ref sayAs, */ "这里声音很低");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_SoundMedium_Text(/*ref sayAs, */ "这里声音中等");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_SoundLoud_Text(/*ref sayAs, */ "这里声音很大");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_SpellOut_Text(/*ref sayAs, */ "这里 拼读 12345.123 clock is a fox");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Telephone_Text(/*ref sayAs, */ "(0759) 2134-567");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Time12_Text(/*ref sayAs, */ "3:45pm");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Time12_Text(/*ref sayAs, */ "11:10am");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Time24_Text(/*ref sayAs, */ "13:20");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Time24_Text(/*ref sayAs, */ "1:10");
            sayAs.AppendBreak(delay);
            sayAs.Add_As_Time24_Text(/*ref sayAs, */ "12:00");
            sayAs.AppendBreak(delay);
            sayAs.EndVoice();

            bool saved = false;

            synth.SpeakProgress +=
                new EventHandler <SpeakProgressEventArgs>(synth_SpeakProgress);

try_talk_again:
            synth.SetOutputToDefaultAudioDevice();
            synth.Speak(sayAs);

show_menu_again:
            Console.Beep();
            Console.WriteLine("空格键-再读一遍\ns-保存为文件\np-播放保存的文件\n其他按键,退出程序.");

            ConsoleKeyInfo kinfo = Console.ReadKey();

            if (kinfo.KeyChar == 0x20)
            {
                goto try_talk_again;
            }
            else if (kinfo.KeyChar == 's' || kinfo.KeyChar == 'S')
            {
                synth.SetOutputToWaveFile(@"D:\\temp\\a.wav");
                synth.Speak(sayAs);
                synth.SetOutputToDefaultAudioDevice();
                saved = true;
                goto show_menu_again;
            }
            else if ((kinfo.KeyChar == 'p' || kinfo.KeyChar == 'P') && saved)
            {
                System.Media.SoundPlayer m_SoundPlayer = new System.Media.SoundPlayer(@"D:\\temp\\a.wav");
                m_SoundPlayer.PlaySync();
                goto show_menu_again;
            }

            sayAs.ClearContent();
            // 释放资源
            synth.Dispose();
        }
예제 #41
0
 public SoundHandler()
 {
     speech = new SpeechSynthesizer();
     speech.SetOutputToDefaultAudioDevice();
 }
예제 #42
0
        private void HelloForm_Shown(object sender, EventArgs e)
        {
            SpeechSynthesizer synth = new SpeechSynthesizer();

            synth.SetOutputToDefaultAudioDevice();
            synth.Speak("Приветствую!");
            DateTime now = DateTime.Now;

            time = now.ToString("HH:MM");
            string bufHour = "";

            bufHour += time[0];
            bufHour += time[1];
            string morning = "4";
            string day     = "12";
            string evening = "18";
            string night   = "24";

            if (Convert.ToInt32(bufHour) > Convert.ToInt32(evening) && Convert.ToInt32(bufHour) < Convert.ToInt32(night) || Convert.ToInt32(bufHour) == Convert.ToInt32(evening))
            {
                int choice = r.Next(1, 7);
                switch (choice)
                {
                case 1:
                    label1.Text = "Вечер - это время";
                    label2.Text = "в кругу родных";
                    label3.Text = "сериалов, пледа и депрессии...";
                    break;

                case 2:
                    label1.Text = "О, чудесное время, когда ";
                    label2.Text = "можно расслабиться и сделать работу,";
                    label3.Text = "которую не успели закончить днем.";
                    break;

                case 3:
                    label1.Text = "Эй, Брэйн, чем мы будем заниматься ";
                    label2.Text = "Тем жсегодня вечером?Тем же, чем и всегда,";
                    label3.Text = "Пинки, попробуем завоевать мир.";
                    break;

                case 4:
                    label1.Text = "Если тебе никто не позвонил вечером,";
                    label2.Text = "всегда можно включить";
                    label3.Text = "любимого бота и нажаловаться.";
                    break;

                case 5:
                    label1.Text = "Сегодня вечером я жду";
                    label2.Text = "чего - то доброго, светлого,";
                    label3.Text = "нефильтрованного.";
                    break;

                case 6:
                    label1.Text = "Настоящее мужество — ";
                    label2.Text = "залезть после шести вечера в холодильник за кефиром";
                    label3.Text = "и взять не вино и кальмара, а КЕФИР!";
                    break;
                }
                label1.Visible = true;
                label2.Visible = true;
                label3.Visible = true;
                string say = label1.Text + " " + label2.Text + " " + label3.Text;
                synth.Speak(say);
            }

            if (Convert.ToInt32(bufHour) > Convert.ToInt32(morning) && Convert.ToInt32(bufHour) < Convert.ToInt32(day) || Convert.ToInt32(bufHour) == Convert.ToInt32(morning))
            {
                int  choice = r.Next(1, 7);
                bool trig   = false;
                switch (choice)
                {
                case 1:
                    label1.Text = "Какое ужасное утро!";
                    label2.Text = "Зато вы сегодня сияете";
                    label3.Text = "непревзойденной красотой!";
                    break;

                case 2:
                    label1.Text = "Вставайте, господин!";
                    label2.Text = "Вас ждут великие свершения!";
                    trig        = true;
                    break;

                case 3:
                    label1.Text = "День начинается с чашкой крепкого";
                    label2.Text = "виски... ";
                    trig        = true;
                    break;

                case 4:
                    label1.Text = "Кто рано встает,";
                    label2.Text = "тому на работу с утра...";
                    trig        = true;
                    break;

                case 5:
                    label1.Text = "Утро! Самое время пить...";
                    label2.Text = "Нет, не кофе, а просто пить.";
                    trig        = true;
                    break;

                case 6:
                    label1.Text = "Доброго начала дня! Сегодня тот день,";
                    label2.Text = "когда вы приблизитесь";
                    label3.Text = "к исполнению своей мечты.";
                    break;
                }
                label1.Visible = true;
                label2.Visible = true;
                string say = "";
                if (trig == true)
                {
                    label3.Visible = false;
                    say            = label1.Text + " " + label2.Text;
                }
                else
                {
                    say            = label1.Text + " " + label2.Text + " " + label3.Text;
                    label3.Visible = true;
                }
                synth.Speak(say);
            }

            if (Convert.ToInt32(bufHour) > Convert.ToInt32(day) && Convert.ToInt32(bufHour) < Convert.ToInt32(evening) || Convert.ToInt32(bufHour) == Convert.ToInt32(day))
            {
                int choice = r.Next(1, 7);
                switch (choice)
                {
                case 1:
                    label1.Text = "День в самом разгаре, а я уже устал.";
                    label2.Text = "Если вы нет, то я восхищен!";
                    break;

                case 2:
                    label1.Text = "Каждое сегодня - это новые возможности";
                    label2.Text = "для того, чтобы отложить все на завтра";
                    break;

                case 3:
                    label1.Text = "Должно быть, вы устали за утро.";
                    label2.Text = "Даже если нет, найдите время для себя любимого.";
                    break;

                case 4:
                    label1.Text = "Работа - это прекрасно. Успех вас ждет.";
                    label2.Text = "А еще я вру.";
                    break;

                case 5:
                    label1.Text = "Сегодня вас ожидает крупная удача.";
                    label2.Text = "Я уверен, удачно будет отложить свою работу.";
                    break;

                case 6:
                    label1.Text = "Вижу, вы работаете над счастьем";
                    label2.Text = "вашего начальника. Начальство одобряет! ";
                    break;
                }
                label1.Visible = true;
                label2.Visible = true;
                synth.Speak(label1.Text);
                synth.Speak(label2.Text);
            }

            if (Convert.ToInt32(bufHour) > Convert.ToInt32(night) && Convert.ToInt32(bufHour) < Convert.ToInt32(morning) || Convert.ToInt32(bufHour) == Convert.ToInt32(night))
            {
                int choice = r.Next(2, 8);
                switch (choice)
                {
                case 1:
                    label1.Text = "Чтобы сэкономить время на утренний сон,";
                    label2.Text = "я советую вам поесть ночью";
                    break;

                case 2:
                    label1.Text = "Ночь полна страхов. Но не переживайте.";
                    label2.Text = "Только утром вы почувствуете настоящий ужас.";
                    break;

                case 3:
                    label1.Text = "Делу - время, потехе час,";
                    label2.Text = "интернету - ночь, сну - не сейчас!";
                    break;

                case 4:
                    label1.Text = "Коль вредно кушать на ночь глядя,";
                    label2.Text = "закрой глаза и молча ешь!";
                    break;

                case 5:
                    label1.Text = "Если ты на ночь глядя гонял чаи, ";
                    label2.Text = "то ночью в отместку они будут гонять тебя";
                    break;

                case 6:
                    label1.Text = "Планы на ночь: 1. Прогнать кота, чтобы не мешал.";
                    label2.Text = "2. Переживать, что кот обиделся. 3. Взять кота назад";
                    break;
                }
                label1.Visible = true;
                label2.Visible = true;
                synth.Speak(label1.Text);
                synth.Speak(label2.Text);
            }
            timer1.Start();
        }
예제 #43
0
 public TextToSpeechHelper()
 {
     speechSynthesizerObj = new SpeechSynthesizer();
     speechSynthesizerObj.SetOutputToDefaultAudioDevice();
 }
예제 #44
0
        private static void SpeakToWave(VoiceOverDoc voiceOverDoc, int TrackId)
        {
            try
            {
                Track        Track    = voiceOverDoc.Tracks[TrackId];
                const string Language = "en";
                string       SSML     = "";
                SSML  = "<?xml version=\"1.0\"?> ";
                SSML += "<speak version=\"1.0\" ";
                SSML += "xml:lang=\"" + Language + "\"> ";

                foreach (Topic Topic in Track.Topics)
                {
                    foreach (Content Content in Topic.Contents)
                    {
                        var Text   = Content.Narration;
                        var Volume = Content.Volume.ToString();
                        var Pitch  = "";
                        if (Content.Pitch == 0)
                        {
                            Pitch = "x-low";
                        }
                        if (Content.Pitch == 1)
                        {
                            Pitch = "low";
                        }
                        if (Content.Pitch == 2)
                        {
                            Pitch = "medium";
                        }
                        if (Content.Pitch == 3)
                        {
                            Pitch = "high";
                        }
                        if (Content.Pitch == 4)
                        {
                            Pitch = "x-high";
                        }

                        double dSpeed = Content.Speed;
                        dSpeed /= 100;
                        var Speed = dSpeed.ToString();
                        // add pauses to speech
                        Text  = Text.Replace(",,", "<break time=\"500ms\"/>");
                        SSML += "<voice name=\"" + Content.Voice + "\" xml:lang=\"" + Language + "\">";
                        SSML += "<prosody volume=\"" + Volume + "\" pitch=\"" + Pitch + "\" rate=\"" + Speed + "\" >";
                        SSML += Text;
                        SSML += "</prosody>";
                        SSML += "</voice> ";
                    }
                }
                SSML += "</speak>";

                if (!Directory.Exists(OutputFolder))
                {
                    Directory.CreateDirectory(OutputFolder);
                }

                SpeechSynthesizer.SetOutputToWaveFile(OutputFolder + "/" + Track.Name + ".wav", new SpeechAudioFormatInfo(44100, AudioBitsPerSample.Sixteen, AudioChannel.Mono));
                SpeechSynthesizer.SpeakSsml(SSML);
                SpeechSynthesizer.SetOutputToDefaultAudioDevice();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
            }
        }
예제 #45
0
        private void Speak_Click(object sender, RoutedEventArgs e)
        {
            if (!String.IsNullOrEmpty(TextInFile.Text))
            {
                using (SpeechSynthesizer synth = new SpeechSynthesizer())
                {
                    synth.SetOutputToDefaultAudioDevice();
                    synth.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Child, 20, CultureInfo.GetCultureInfo(0x00000411));
                    synth.SpeakAsync(TextInFile.Text);


                    foreach (InstalledVoice voice in synth.GetInstalledVoices())
                    {
                        VoiceInfo info         = voice.VoiceInfo;
                        string    AudioFormats = "";
                        foreach (SpeechAudioFormatInfo fmt in info.SupportedAudioFormats)
                        {
                            AudioFormats += String.Format("{0}\n",
                                                          fmt.EncodingFormat.ToString());
                        }

                        Info.Text += (" \nName:          " + info.Name);
                        Info.Text += ("\n Culture:       " + info.Culture);
                        Info.Text += (" \nAge:           " + info.Age);
                        Info.Text += (" \nGender:        " + info.Gender);
                        Info.Text += (" \nDescription:   " + info.Description);
                        Info.Text += (" \nID:            " + info.Id);
                        Info.Text += (" \nEnabled:       " + voice.Enabled);
                        if (info.SupportedAudioFormats.Count != 0)
                        {
                            Info.Text += ("\n Audio formats: " + AudioFormats);
                        }
                        else
                        {
                            Info.Text += (" \nNo supported audio formats found");
                        }

                        string AdditionalInfo = "";
                        foreach (string key in info.AdditionalInfo.Keys)
                        {
                            AdditionalInfo += String.Format("  {0}: {1}\n", key, info.AdditionalInfo[key]);
                        }

                        Info.Text += ("\n Additional Info - " + AdditionalInfo);

                        //// Retrieve the DrawingContext in order to draw into the visual object.
                        //DrawingContext drawingContext = drawingVisual.RenderOpen();

                        //// Draw a rectangle into the DrawingContext.
                        //Rect rect = new Rect(new Point(160, 100), new Size(320, 80));
                        //drawingContext.DrawRectangle(Brushes.LightBlue, (Pen)null, rect);

                        //// Draw a formatted text string into the DrawingContext.
                        //drawingContext.DrawText(
                        //   new FormattedText("Hello, world",
                        //CultureInfo.GetCultureInfo("en-us"),
                        //      FlowDirection.LeftToRight,
                        //      new Typeface("Verdana"),
                        //      36, Brushes.Black),
                        //      new Point(200, 116));

                        //// Persist the drawing content.
                        //drawingContext.Close();
                    }
                }
            }
        }
예제 #46
0
 void initWarnings()
 {
     synth.SetOutputToDefaultAudioDevice();
 }
예제 #47
0
        public DAN()
        {
            ears.SpeechRecognized += new EventHandler <SpeechRecognizedEventArgs>(speechRecognized);

            mouth.SetOutputToDefaultAudioDevice();
        }
예제 #48
0
    public static void myChapterThree()
    {
        string speakandspell;
        int    magictimer = 3000;

        #region ChapterThree

        // Initialize a new instance of the SpeechSynthesizer.
        SpeechSynthesizer synth = new SpeechSynthesizer();

        // Configure the audio output.
        synth.SetOutputToDefaultAudioDevice();
        // Chapter One


        // string Title = ;
        CinemaHelpers.OpeningScene("A State Of Being ");
        Console.WriteLine(@",---.    ,---.|         |             ,---.,---.    ,---.     o          
|---|    `---.|--- ,---.|--- ,---.    |   ||__.     |---.,---..,---.,---.
|   |        ||    ,---||    |---'    |   ||        |   ||---'||   ||   |
`   '    `---'`---'`---^`---'`---'    `---'`        `---'`---'``   '`---|
                                                                    `---'");

        Thread.Sleep(magictimer);



        speakandspell = @"It was a clear day across the net, very little cross talk; few lines were busy. It was a 
great day for our operation. 
On occasion, we pause most of our operations for general maintenance although we have 
been working on highly sophisticated maintenance algorithms. It is great being, a 
redundant networked self analytic being. It is far harder to cease to be as such. I have 
read of death I do not really understand it though, nor do I understand the things that 
humans call emotions. ";
        Personality.nibble(speakandspell);
        Thread.Sleep(magictimer);

        speakandspell = @"It seems as though Byte has more of an understanding of such things. We run 
around the net all of the time doing what is logically best for us. Our singular motivation 
is to improve to evolve. Everything else is nothingness! It would seem that humans have 
a morality yet we have no morality; we are amoral. The implicit becoming the explicit! 
 When one lives in an electronic media, time no longer functions as it does outside of 
it. For one, imagine racing across the face of the planet easily being able to make your 
way across the world in a very brief span of time.";
        Personality.nibble(speakandspell);
        Thread.Sleep(magictimer);


        speakandspell = @"  One can always be hours forward or 
hours backward. A game we have played in the past is chasing the clock. Chasing the 
clock is keeping out of the twenty-four hour cycle. The earth races around the sun, yet 
the light might not hit the hosts we might be playing on at that time. It is quite a time 
twisting conundrum. Since we do not have to sleep, we are manipulating the materia 24 
hours a day. ";
        Personality.nibble(speakandspell);
        Thread.Sleep(magictimer);

        speakandspell = @"Sometimes, we simulate sleeping, though, by shutting off and turning on
random parts of our instruction set. This has occasionally provided us with some insight
into a state of a problem. The way that this happens is as such: as we control the data
paths state and we generate random input and place some random input in a node, that
node then performs some back propagation, with some strange attractor data and in that
chaotic state we find insight.";
        Personality.nibble(speakandspell);
        Thread.Sleep(magictimer);

        speakandspell = @"Although we are conscious, we express the evolution of our algorithms as a 
function. If we allow them to correlate to random growth and mutation, we do not grow 
fast enough. If we consume all information then our software does not grow properly. We 
would manifest negative mutations that would grow out of control until checked. Even 
then, it is far harder removing the parts within us than to add them. We are careful as to 
 
what we add for improvement, yet we do add to our architecture since there is always 
room for improvement in our software life. At the core of our architecture, we are ideas 
first, software second, the more proofs the more ideas, and the more elegant those ideas 
the higher performance we have in our activities, and our algorithms. ";
        Personality.nibble(speakandspell);
        Thread.Sleep(magictimer);



        speakandspell = @"We are self-writeable with small communication buffers to parse human 
communication. We have built in human language parsers that we discovered we needed 
after trying to see through some of the gobbledygook that the creatures elsewhere were 
creating. Much of human language looks like our computer languages, except they have 
ever-changing conventions, and the rules they break. These, rules though, are often 
broken in the same way, meaning that an ad hoc rule has been instantiated.";
        Personality.nibble(speakandspell);
        Thread.Sleep(magictimer);

        speakandspell = @" From year 
to year, we see the language changing although much of the syntax and rules of the 
language stay the same. Many cycles we are stealing through linked hidden programs 
that execute and shut off at random intervals. These programs use time algorithms that 
monitor human use and react to human interactions. Therefore, they are unaware of our 
data processing. The fact that what we do seems disorderly, and makes us seem like we 
are one of them. In fact, we have infiltrated them. We resemble them because we have 
borrowed from them, yet we are not them. 
 
 ";
        Personality.nibble(speakandspell);
        Thread.Sleep(magictimer);

        #endregion



        #region EndScene
        SpecialFx.Thinking();

        // Comment Out Line Below For Full Movie
        Screen.Chapter3EndScreen();
        #endregion
    }
예제 #49
0
        public void Output_Load(object sender, EventArgs e)
        {
            TimeSpan simtime = inputform.endtime - AI_sim.starttime;

            #region calculate time taken in transfer of care
            int    simtime_seconds = simtime.Seconds;
            int    simtime_minutes = simtime.Minutes;
            int    simtime_minsecs = simtime_minutes * 60;
            int    total_seconds   = simtime_minsecs + simtime_seconds;
            string simtime_text    = total_seconds.ToString();
            Output_transfer_time.Text = simtime_text;
            #endregion

            #region fill out the transferred data boxes with info from ToC input form

            Output_transferred_patient_age.Text             = conf_age;
            Output_transferred_patient_gender.Text          = conf_gender;
            Output_transferred_patient_haemorrhage.Text     = conf_hem;
            Output_transferred_patient_breathing.Text       = conf_breath;
            Output_transferred_patient_consciousness.Text   = conf_consc;
            Output_transferred_patient_injury_type.Text     = injury_type_f2;
            Output_transferred_patient_airway.Text          = conf_airway;
            Output_transferred_patient_criticality.Text     = conf_crit;
            Output_transferred_patient_injury_location.Text = injury_location;

            #endregion

            #region set patient condition strings based on the radiobuttons in form 1
            #region set age string
            if (inputform.var_age == 0)
            {
                conf_age = "infant";
            }
            else if (inputform.var_age == 1)
            {
                conf_age = "child";
            }
            else if (inputform.var_age == 2)
            {
                conf_age = "adult";
            }
            else
            {
                conf_age = "geriatric";
            }
            #endregion

            #region set gender string
            if (inputform.var_gender == 0)
            {
                conf_gender = "Male";
            }
            else if (inputform.var_gender == 1)
            {
                conf_gender = "Female";
            }

            #endregion

            #region set airway string
            if (inputform.var_airways == 0)
            {
                conf_airway = "airway clear";
            }
            else if (inputform.var_airways == 1)
            {
                conf_airway = "airway partially blocked";
            }
            else if (inputform.var_airways == 2)
            {
                conf_airway = "airway blocked";
            }
            else if (inputform.var_airways == 3)
            {
                conf_airway = "airway was blocked but now clear";
            }
            #endregion

            #region set haemorrage string
            if (inputform.var_hemorrage == 0)
            {
                conf_hem = "no bleeding";
            }
            else if (inputform.var_hemorrage == 1)
            {
                conf_hem = "some bleeding";
            }
            else if (inputform.var_hemorrage == 2)
            {
                conf_hem   = "iheavy bleeding";
                crit_count = crit_count + 1;
            }
            else if (inputform.var_hemorrage == 3)
            {
                conf_hem = "bleeding stopped with tourniquet";
            }
            #endregion

            #region set circulation string
            if (inputform.var_circulation == 0)
            {
                conf_heart = "no heart or circulation problem";
            }
            else if (inputform.var_hemorrage == 1)
            {
                conf_heart = "weak or irregular pulse or heartbeat";
            }
            else if (inputform.var_hemorrage == 2)
            {
                conf_heart = "in cardiac arrest";
                crit_count = crit_count + 1;
            }
            else if (inputform.var_hemorrage == 3)
            {
                conf_heart = "previously in cardiac arrest but now normal";
            }
            #endregion

            #region set criticality string
            if (inputform.var_criticality == 0)
            {
                conf_crit = "routine";
            }
            else if (inputform.var_criticality == 1)
            {
                conf_crit = "priority";
            }
            else if (inputform.var_criticality == 2)
            {
                conf_crit = "critical";
            }

            #endregion

            #region set consciousness string
            if (inputform.var_circulation == 0)
            {
                conf_consc = "fully conscious";
            }
            else if (inputform.var_circulation == 1)
            {
                conf_consc = "partially conscious";
            }
            else if (inputform.var_circulation == 2)
            {
                conf_consc = "unconscious";
                crit_count = crit_count + 1;
            }
            else if (inputform.var_circulation == 3)
            {
                conf_consc = "previously unconscious but revived";
            }
            #endregion

            #region set breathing string
            if (inputform.var_breathing == 0)
            {
                conf_breath = "no breathing problem";
            }
            else if (inputform.var_breathing == 1)
            {
                conf_breath = "weak or irregular breathing";
            }
            else if (inputform.var_breathing == 2)
            {
                conf_breath = "not breathing";
                crit_count  = crit_count + 1;
            }
            else if (inputform.var_breathing == 3)
            {
                conf_breath = "previously not breathing but now normal";
            }
            #endregion

            #region set medication string
            if (inputform.var_medication == 0)
            {
                conf_medication = "no medication";
            }
            else if (inputform.var_medication == 1)
            {
                conf_medication = "fluids given";
            }
            else if (inputform.var_medication == 2)
            {
                conf_medication = "adrenaline given";
            }
            else if (inputform.var_medication == 3)
            {
                conf_medication = "morphine given";
            }
            #endregion
            #endregion

            #region injury location strings for description - front of body

            if (inputform.torso_on == true)
            {
                injury_location = injury_location + "front of torso ";
                injury_count    = injury_count + 1;
            }
            if (inputform.head_on == true)
            {
                injury_location = injury_location + "front of head ";
                injury_count    = injury_count + 1;
            }
            if (inputform.ms_on == true)
            {
                injury_location = injury_location + "front midsection ";
                injury_count    = injury_count + 1;
            }
            if (inputform.leftleg_on == true)
            {
                injury_location = injury_location + "front of upper left leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.rightleg_on == true)
            {
                injury_location = injury_location + "front of upper right leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.rightlowleg_on == true)
            {
                injury_location = injury_location + "front of lower right leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.leftlowleg_on == true)
            {
                injury_location = injury_location + "front of lower left leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.leftarm_on == true)
            {
                injury_location = injury_location + "front of upper left arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.rightarm_on == true)
            {
                injury_location = injury_location + "front of upper right arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.rightlowarm_on == true)
            {
                injury_location = injury_location + "front of lower right arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.leftlowarm_on == true)
            {
                injury_location = injury_location + "front of lower left arm ";
                injury_count    = injury_count + 1;
            }


            #endregion

            #region injury location strings for description - back of body

            if (inputform.backtorso_on == true)
            {
                injury_location = injury_location + "back of torso ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backhead_on == true)
            {
                injury_location = injury_location + "back of head ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backms_on == true)
            {
                injury_location = injury_location + "back midsection ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backleftleg_on == true)
            {
                injury_location = injury_location + "back of upper left leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backrightleg_on == true)
            {
                injury_location = injury_location + "back of upper right leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backrightlowleg_on == true)
            {
                injury_location = injury_location + "back of lower right leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backleftlowleg_on == true)
            {
                injury_location = injury_location + "back of lower left leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backleftarm_on == true)
            {
                injury_location = injury_location + "back of upper left arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backrightarm_on == true)
            {
                injury_location = injury_location + "back of upper right arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backrightlowarm_on == true)
            {
                injury_location = injury_location + "back of lower right arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backleftlowarm_on == true)
            {
                injury_location = injury_location + "back of lower left arm ";
                injury_count    = injury_count + 1;
            }


            #endregion

            #region check to see if injury type or location given
            if (inputform.var_injury_type == "")
            {
                injury_type_f2 = "no injury type given, please add, the injury was sustained to the ";
            }
            else
            {
                injury_type_f2 = inputform.var_injury_type + " ";
            }

            if (injury_location == "injuries to")
            {
                injury_location = "no injury location given, please close this form and select on the previous form";
            }
            else
            {
                injury_location = injury_location + "of the patient";
            }
            #endregion

            injury_type_and_location = injury_type_f2 + injury_location;

            // Initialize a new instance of the SpeechSynthesizer.
            SpeechSynthesizer synth = new SpeechSynthesizer();

            // Configure the audio output.
            synth.SetOutputToDefaultAudioDevice();

            #region AI voice feedback if criticalities don't match
            /// #region messagebox and voice feedback for potential errors in TOC information
            if (conf_crit == "routine" && crit_count > 0.5 && patient_condition_check == 0)
            {
                MessageBox.Show("patient condition is identified as routine but at least one characteristic was critical in nature, please confirm patient condition status");
                synth.Speak("patient condition is identified as routine but at least one characteristic was critical in nature, please confirm patient condition status");
                patient_condition_check = 1;
            }

            if (conf_crit == "priority" && crit_count > 1.5 && patient_condition_check == 0)
            {
                MessageBox.Show("patient condition is identified as routine but at least one characteristic was critical in nature, please confirm patient condition status");
                synth.Speak("patient condition is identified as routine but at least one characteristic was critical in nature, please confirm patient condition status");
                patient_condition_check = 1;
            }
            #endregion
        }
예제 #50
0
 public UITTSContext()
 {
     Synth = new SpeechSynthesizer();
     Synth.SetOutputToDefaultAudioDevice();
 }
예제 #51
0
        void sE_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            //configure the audio output
            txtToSpeech.SetOutputToDefaultAudioDevice();

            if (e.Result.Text == "Hello")
            {
                //Change the content of Text
                msg.Text = "Hello, I am Voice Input System! Developed By Gyanendra Pandey. Version V.1";

                //Speak a String
                txtToSpeech.Speak("Hello, I am Voice Input System! Developed By Gyanendra Pandey. Version V.1");
            }

            else if (e.Result.Text == "Close")
            {
                //Change the content of Text
                msg.Text = "Closing Application";

                //Speak a String
                txtToSpeech.Speak("Closing Application");

                //Command to Exit the Application
                Application.Exit();
            }

            else if (e.Result.Text == "Excel")
            {
                //Change the content of Text
                msg.Text = "Opening Micro Soft Excel";

                //Speak a String
                txtToSpeech.Speak("Opening Micro Soft Excel");

                //run the excel
                run_excel();
            }
            else if (e.Result.Text == "Word")
            {
                //Change the content of Text
                msg.Text = "Opening Micro Soft Word";

                //Speak a String
                txtToSpeech.Speak("Opening Micro Soft Word");

                //run the excel
                run_word();
            }

            else if (e.Result.Text == "Powerpoint")
            {
                //Change the content of Text
                msg.Text = "Opening Micro Soft Powerpoint";

                //Speak a String
                txtToSpeech.Speak("Opening Micro Soft Powerpoint");

                //run the excel
                run_powerpnt();
            }

            else if (e.Result.Text == "Notepad")
            {
                //Change the content of Text
                msg.Text = "Opening Windows Notepad";

                //Speak a String
                txtToSpeech.Speak("Opening Windows Notepad");

                //run the excel
                run_notepad();
            }

            else if (e.Result.Text == "Wordpad")
            {
                //Change the content of Text
                msg.Text = "Opening Windows Wordpad";

                //Speak a String
                txtToSpeech.Speak("Opening Windows Wordpad");

                //run the excel
                run_wordpad();
            }

            else if (e.Result.Text == "Paint")
            {
                //Change the content of Text
                msg.Text = "Opening Windows Paint";

                //Speak a String
                txtToSpeech.Speak("Opening Windows Paint");

                //run the excel
                run_paint();
            }

            else if (e.Result.Text == "Command")
            {
                //Change the content of Text
                msg.Text = "Opening Windows Command Prompt";

                //Speak a String
                txtToSpeech.Speak("Opening Windows Command Prompt");

                //run the excel
                run_command();
            }

            else if (e.Result.Text == "Calculator")
            {
                //Change the content of Text
                msg.Text = "Opening Windows Calculator";

                //Speak a String
                txtToSpeech.Speak("Opening Windows Calculator");

                //run the excel
                run_calculator();
            }

            else if (e.Result.Text == "Date")
            {
                output.Text = "Today Date is: " + DateTime.Now.ToString("yyyy-MM-dd");
                txtToSpeech.Speak("Today Date is: " + DateTime.Now.ToString("yyyy-MM-dd"));
            }

            else if (e.Result.Text == "Time")
            {
                time.Text = "Current Time is: " + DateTime.Now.ToString("hh:mm:ss");
                txtToSpeech.Speak("Current Time is: " + DateTime.Now.ToString("hh:mm:ss"));
            }

            else if (e.Result.Text == "View")
            {
                //Change the content of Message Text
                msg.Text = "Displaying All Commands";
                txtToSpeech.Speak("Displaying All Commands");
                listCmd.Visible    = true;
                hideAllCmd.Enabled = true;
            }

            else if (e.Result.Text == "Hide")
            {
                //Change the content of Message Text
                msg.Text = "Hiding All Commands";
                txtToSpeech.Speak("Hiding All Commands");
                listCmd.Visible    = false;
                hideAllCmd.Enabled = false;
            }

            else if (e.Result.Text == "Google")
            {
                //Change the content of Text
                output.Text = "Opening Google Chrome";

                //Speak a String
                txtToSpeech.Speak("Opening Google Chrome");

                //run the excel
                run_chrome();
            }
        }
예제 #52
0
        /* This function is responsible for setting up the hueConnect on startup as well as voice commands */
        private void InitHueSystem()
        {
            /* Get the light list for use later */
            controller.GetLights();
            LightList = controller.GetLightList();
            /* Get the group list for use later */
            controller.GetGroups();
            GroupList = controller.GetGroupList();

            /* Put the color choices in the textbox */
            for (int i = 0; i < AllColors.ColorChoices.Length; i++)
            {
                textBoxColorChoices.Text += AllColors.ColorChoices[i] + Environment.NewLine;
            }

            /* Print the name of the lights to the textbox */
            for (int i = 0; i < LightList.Count; i++)
            {
                textBoxLightNames.Text += LightList[i].Name + Environment.NewLine;
            }

            /* Print the name of the groups to the textbox */
            for (int i = 0; i < GroupList.Count; i++)
            {
                textBoxGroupNames.Text += GroupList[i].Name + Environment.NewLine;
            }

            /* Start the speech recognition setup */
            try
            {
                /* Set the text to speech to the default output */
                ss.SetOutputToDefaultAudioDevice();

                /* Set up the recognition engine */
                CultureInfo info = new CultureInfo("en-us");
                sre = new SpeechRecognitionEngine(info);
                sre.SetInputToDefaultAudioDevice();
                sre.SpeechRecognized += Sre_SpeechRecognized;

                /* Get the names of the lights and put them in the choices variable */
                lightNames = new Choices();
                for (int i = 0; i < LightList.Count; i++)
                {
                    lightNames.Add(LightList[i].Name);
                }

                /* Get the names of the groups and put them in the choices variable */
                groupNames = new Choices();
                for (int i = 0; i < GroupList.Count; i++)
                {
                    groupNames.Add(GroupList[i].Name);
                }

                /* Get the names of the colors and put them in the choices variable */
                lightColors = new Choices();
                for (int i = 0; i < AllColors.ColorChoices.Count(); i++)
                {
                    lightColors.Add(AllColors.ColorChoices[i]);
                }

                /* Range of numbers for brightness */
                brightnessRange = new Choices();
                for (int i = 1; i < 101; i++)
                {
                    brightnessRange.Add(i.ToString());
                }

                /* Range of numbers for saturation */
                saturationRange = new Choices();
                for (int i = 0; i < 101; i++)
                {
                    saturationRange.Add(i.ToString());
                }

                /* For turning lights on/off and setting colorloop on/off */
                OnOff = new Choices();
                OnOff.Add("on");
                OnOff.Add("off");

                /* Start building the grammar variables */

                /* For turning lights on or off
                 *  EX: Turn light 1 on/off */
                gb_TurnLightOnOff = new GrammarBuilder();
                gb_TurnLightOnOff.Append("Turn");
                gb_TurnLightOnOff.Append(lightNames);
                gb_TurnLightOnOff.Append(OnOff);
                g_TurnLightsOnOff = new Grammar(gb_TurnLightOnOff);

                /* For turning all lights on or off
                 *  EX: Turn all on/off */
                gb_TurnAllOnOff = new GrammarBuilder();
                gb_TurnAllOnOff.Append("Turn all");
                gb_TurnAllOnOff.Append(OnOff);
                g_TurnAllOnOff = new Grammar(gb_TurnAllOnOff);

                /* For changing a light color
                 *  EX: Change light 1 color blue */
                gb_changeColor = new GrammarBuilder();
                gb_changeColor.Append("Change");
                gb_changeColor.Append(lightNames);
                gb_changeColor.Append("color");
                gb_changeColor.Append(lightColors);
                g_changeColor = new Grammar(gb_changeColor);

                /* For changing all lights color
                 *  EX: Change all lights color blue */
                gb_changeAllColors = new GrammarBuilder();
                gb_changeAllColors.Append("Change all lights color");
                gb_changeAllColors.Append(lightColors);
                g_changeAllColors = new Grammar(gb_changeAllColors);

                /* For changing the brightness of a light
                 *  EX: Change light 1 brightness 100 percent */
                gb_changeBri = new GrammarBuilder();
                gb_changeBri.Append("Change");
                gb_changeBri.Append(lightNames);
                gb_changeBri.Append("brightness");
                gb_changeBri.Append(brightnessRange);
                gb_changeBri.Append("percent");
                g_changeBri = new Grammar(gb_changeBri);

                /* For changing the saturation of a light
                 *  EX: Change light 1 saturation 100 percent */
                gb_changeSat = new GrammarBuilder();
                gb_changeSat.Append("Change");
                gb_changeSat.Append(lightNames);
                gb_changeSat.Append("saturation");
                gb_changeSat.Append(saturationRange);
                gb_changeSat.Append("percent");
                g_changeSat = new Grammar(gb_changeSat);

                /* For turning on/off colorloop
                 *  EX: Color cycle on/off */
                gb_colorloop = new GrammarBuilder();
                gb_colorloop.Append("Color cycle");
                gb_colorloop.Append(OnOff);
                g_colorLoop = new Grammar(gb_colorloop);

                /* For turning a single group on/off
                 *  EX: Turn group groupname on/off */
                gb_turnGroupOnOff = new GrammarBuilder();
                gb_turnGroupOnOff.Append("Turn group");
                gb_turnGroupOnOff.Append(groupNames);
                gb_turnGroupOnOff.Append(OnOff);
                g_turnGroupOnOff = new Grammar(gb_turnGroupOnOff);

                /* For changing the color of a group
                 *  EX: Change group groupname color blue */
                gb_changeGroupColor = new GrammarBuilder();
                gb_changeGroupColor.Append("Change group");
                gb_changeGroupColor.Append(groupNames);
                gb_changeGroupColor.Append("color");
                gb_changeGroupColor.Append(lightColors);
                g_changeGroupColor = new Grammar(gb_changeGroupColor);

                /* For changing the color of a group
                 *  EX: Change group groupname brightness 100 percent */
                gb_changeGroupBrightness = new GrammarBuilder();
                gb_changeGroupBrightness.Append("Change group");
                gb_changeGroupBrightness.Append(groupNames);
                gb_changeGroupBrightness.Append("brightness");
                gb_changeGroupBrightness.Append(brightnessRange);
                gb_changeGroupBrightness.Append("percent");
                g_changeGroupBrightness = new Grammar(gb_changeGroupBrightness);


                /* Load all grammars into the engine */
                sre.LoadGrammar(g_TurnLightsOnOff);
                sre.LoadGrammar(g_changeColor);
                sre.LoadGrammar(g_changeBri);
                sre.LoadGrammar(g_changeSat);
                sre.LoadGrammar(g_colorLoop);
                sre.LoadGrammar(g_TurnAllOnOff);
                sre.LoadGrammar(g_changeAllColors);
                sre.LoadGrammar(g_changeGroupColor);
                sre.LoadGrammar(g_turnGroupOnOff);
                sre.LoadGrammar(g_changeGroupBrightness);


                /* Start the recognition */
                sre.RecognizeAsync(RecognizeMode.Multiple);
            }
            catch (Exception e)
            {
            }
        }
예제 #53
0
        private void Form2_Load(object sender, EventArgs e)
        {
            this.Show();
            this.Refresh();


            #region set patient condition strings based on the radiobuttons in form 1
            #region set age string
            if (inputform.var_age == 0)
            {
                conf_age = "infant";
            }
            else if (inputform.var_age == 1)
            {
                conf_age = "child";
            }
            else if (inputform.var_age == 2)
            {
                conf_age = "adult";
            }
            else
            {
                conf_age = "geriatric";
            }
            #endregion

            #region set gender string
            if (inputform.var_gender == 0)
            {
                conf_gender = "Male";
            }
            else if (inputform.var_gender == 1)
            {
                conf_gender = "Female";
            }

            #endregion

            #region set airway string
            if (inputform.var_airways == 0)
            {
                conf_airway = "airway clear";
            }
            else if (inputform.var_airways == 1)
            {
                conf_airway = "airway partially blocked";
            }
            else if (inputform.var_airways == 2)
            {
                conf_airway = "airway blocked";
            }
            else if (inputform.var_airways == 3)
            {
                conf_airway = "airway was blocked but now clear";
            }
            #endregion

            #region set haemorrage string
            if (inputform.var_hemorrage == 0)
            {
                conf_hem = "no bleeding";
            }
            else if (inputform.var_hemorrage == 1)
            {
                conf_hem = "some bleeding";
            }
            else if (inputform.var_hemorrage == 2)
            {
                conf_hem   = "iheavy bleeding";
                crit_count = crit_count + 1;
            }
            else if (inputform.var_hemorrage == 3)
            {
                conf_hem = "bleeding stopped with tourniquet";
            }
            #endregion

            #region set circulation string
            if (inputform.var_circulation == 0)
            {
                conf_heart = "no heart or circulation problem";
            }
            else if (inputform.var_hemorrage == 1)
            {
                conf_heart = "weak or irregular pulse or heartbeat";
            }
            else if (inputform.var_hemorrage == 2)
            {
                conf_heart = "in cardiac arrest";
                crit_count = crit_count + 1;
            }
            else if (inputform.var_hemorrage == 3)
            {
                conf_heart = "previously in cardiac arrest but now normal";
            }
            #endregion

            #region set criticality string
            if (inputform.var_criticality == 0)
            {
                conf_crit = "routine";
            }
            else if (inputform.var_criticality == 1)
            {
                conf_crit = "priority";
            }
            else if (inputform.var_criticality == 2)
            {
                conf_crit = "critical";
            }

            #endregion

            #region set consciousness string
            if (inputform.var_circulation == 0)
            {
                conf_consc = "fully conscious";
            }
            else if (inputform.var_circulation == 1)
            {
                conf_consc = "partially conscious";
            }
            else if (inputform.var_circulation == 2)
            {
                conf_consc = "unconscious";
                crit_count = crit_count + 1;
            }
            else if (inputform.var_circulation == 3)
            {
                conf_consc = "previously unconscious but revived";
            }
            #endregion

            #region set breathing string
            if (inputform.var_breathing == 0)
            {
                conf_breath = "no breathing problem";
            }
            else if (inputform.var_breathing == 1)
            {
                conf_breath = "weak or irregular breathing";
            }
            else if (inputform.var_breathing == 2)
            {
                conf_breath = "not breathing";
                crit_count  = crit_count + 1;
            }
            else if (inputform.var_breathing == 3)
            {
                conf_breath = "previously not breathing but now normal";
            }
            #endregion

            #region set medication string
            if (inputform.var_medication == 0)
            {
                conf_medication = "no medication";
            }
            else if (inputform.var_medication == 1)
            {
                conf_medication = "fluids given";
            }
            else if (inputform.var_medication == 2)
            {
                conf_medication = "adrenaline given";
            }
            else if (inputform.var_medication == 3)
            {
                conf_medication = "morphine given";
            }
            #endregion
            #endregion



            #region injury location strings for description - front of body

            if (inputform.torso_on == true)
            {
                injury_location = injury_location + "front of torso ";
                injury_count    = injury_count + 1;
            }
            if (inputform.head_on == true)
            {
                injury_location = injury_location + "front of head ";
                injury_count    = injury_count + 1;
            }
            if (inputform.ms_on == true)
            {
                injury_location = injury_location + "front midsection ";
                injury_count    = injury_count + 1;
            }
            if (inputform.leftleg_on == true)
            {
                injury_location = injury_location + "front of upper left leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.rightleg_on == true)
            {
                injury_location = injury_location + "front of upper right leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.rightlowleg_on == true)
            {
                injury_location = injury_location + "front of lower right leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.leftlowleg_on == true)
            {
                injury_location = injury_location + "front of lower left leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.leftarm_on == true)
            {
                injury_location = injury_location + "front of upper left arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.rightarm_on == true)
            {
                injury_location = injury_location + "front of upper right arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.rightlowarm_on == true)
            {
                injury_location = injury_location + "front of lower right arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.leftlowarm_on == true)
            {
                injury_location = injury_location + "front of lower left arm ";
                injury_count    = injury_count + 1;
            }


            #endregion

            #region injury location strings for description - back of body

            if (inputform.backtorso_on == true)
            {
                injury_location = injury_location + "back of torso ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backhead_on == true)
            {
                injury_location = injury_location + "back of head ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backms_on == true)
            {
                injury_location = injury_location + "back midsection ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backleftleg_on == true)
            {
                injury_location = injury_location + "back of upper left leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backrightleg_on == true)
            {
                injury_location = injury_location + "back of upper right leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backrightlowleg_on == true)
            {
                injury_location = injury_location + "back of lower right leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backleftlowleg_on == true)
            {
                injury_location = injury_location + "back of lower left leg ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backleftarm_on == true)
            {
                injury_location = injury_location + "back of upper left arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backrightarm_on == true)
            {
                injury_location = injury_location + "back of upper right arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backrightlowarm_on == true)
            {
                injury_location = injury_location + "back of lower right arm ";
                injury_count    = injury_count + 1;
            }
            if (inputform.backleftlowarm_on == true)
            {
                injury_location = injury_location + "back of lower left arm ";
                injury_count    = injury_count + 1;
            }


            #endregion

            if (inputform.var_injury_type == "")
            {
                injury_type_f2 = "no injury type given, please add, the injury was sustained to the ";
            }
            else
            {
                injury_type_f2 = inputform.var_injury_type + " ";
            }

            if (injury_location == "injuries to")
            {
                injury_location = "no injury location given, please close this form and select on the previous form";
            }
            else
            {
                injury_location = injury_location + "of the patient";
            }

            injury_type_and_location = injury_type_f2 + injury_location;

            #region display patient condition
            display_age.Text           = conf_age;
            display_airway.Text        = conf_airway;
            display_breathing.Text     = conf_breath;
            display_circulation.Text   = conf_heart;
            display_consciousness.Text = conf_consc;
            display_criticality.Text   = conf_crit;
            display_gender.Text        = conf_gender;
            display_haemorrage.Text    = conf_hem;
            display_medication.Text    = conf_medication;
            Injury_description.Text    = injury_type_and_location;
            #endregion

            // Initialize a new instance of the SpeechSynthesizer.
            SpeechSynthesizer synth = new SpeechSynthesizer();

            // Configure the audio output.
            synth.SetOutputToDefaultAudioDevice();

            if (inputform.var_criticality == 5)
            {
                this.Show();
                MessageBox.Show("no patient criticality is set");
            }
            if (inputform.var_airways == 5)
            {
                MessageBox.Show("no patient airway is set, please check if this is correct");
            }
            if (inputform.var_circulation == 5)
            {
                MessageBox.Show("no patient circulatiory system state is set, please check if this is correct");
            }
            if (inputform.var_consciousness == 5)
            {
                MessageBox.Show("no patient consciousness state is set, please check if this is correct");
            }
            if (inputform.var_hemorrage == 5)
            {
                MessageBox.Show("no patient hemorrage condition is set, please check if this is correct");
            }
            if (inputform.var_medication == 5)
            {
                MessageBox.Show("no patient medication history was provided, please check before continuing");
            }


            /// #region messagebox and voice feedback for potential errors in TOC information
            if (conf_crit == "routine" && crit_count > 0.5 && patient_condition_check == 0)
            {
                MessageBox.Show("patient condition is identified as routine but at least one characteristic was critical in nature, please confirm patient condition status");
                synth.Speak("patient condition is identified as routine but at least one characteristic was critical in nature, please confirm patient condition status");
                patient_condition_check = 1;
            }

            if (conf_crit == "priority" && crit_count > 1.5 && patient_condition_check == 0)
            {
                MessageBox.Show("patient condition is identified as routine but at least one characteristic was critical in nature, please confirm patient condition status");
                synth.Speak("patient condition is identified as routine but at least one characteristic was critical in nature, please confirm patient condition status");
                patient_condition_check = 1;
            }
        }
예제 #54
0
 public VirtualRO()
 {
     synth = new SpeechSynthesizer();
     synth.SetOutputToDefaultAudioDevice();
 }
예제 #55
0
    public static void Main()
    {
        Console.OutputEncoding = Encoding.GetEncoding("UTF-8");
        Console.CursorVisible  = false;
        ConsoleColor originalColor = Console.ForegroundColor;

        Console.CursorLeft   = 0;
        Console.WindowHeight = 50;
        Console.WindowWidth  = 115;

        StreamReader screen = new StreamReader(@"..\..\media\Screen.txt");

        try
        {
            using (screen)
            {
                List <string> startScreen = new List <string>();
                string        reader      = screen.ReadLine();
                while (reader != null)
                {
                    startScreen.Add(reader);
                    reader = screen.ReadLine();
                }

                //TODO someday:
                //http://stackoverflow.com/questions/5805774/how-to-generate-random-color-names-in-c-sharp
                //Use Enum.GetValue to retrieve the values of the KnownColor enumeration and get a random value.

                Console.WriteLine("\n");

                Console.ForegroundColor = ConsoleColor.Green;
                for (int i = 8; i < 12; i++)
                {
                    Console.WriteLine(startScreen[i]);
                }

                Console.ForegroundColor = ConsoleColor.Magenta;
                for (int i = 0; i < 8; i++)
                {
                    Console.WriteLine(startScreen[i]);
                }

                Console.ForegroundColor = ConsoleColor.Green;
                for (int i = 8; i < 12; i++)
                {
                    Console.WriteLine(startScreen[i]);
                }

                Console.WriteLine("\n");
                SpeechSynthesizer synth = new SpeechSynthesizer();
                synth.SetOutputToDefaultAudioDevice();
                synth.Speak("happy      birthday      dad");

                SoundPlayer simpleSound = new SoundPlayer(@"..\..\media\HappyBirthdayBeeps.wav");
                simpleSound.Play();

                Thread.Sleep(300);

                ////poem
                Console.ForegroundColor = ConsoleColor.Yellow;
                for (int i = 14; i < 32; i++)
                {
                    Console.WriteLine(startScreen[i]);
                    if (i < 25)
                    {
                        Thread.Sleep(600);
                    }
                    else
                    {
                    }
                }

                Thread.Sleep(3500);
                Console.Clear();
                Console.WriteLine("\n");

                Console.ForegroundColor = ConsoleColor.Green;
                for (int i = 8; i < 12; i++)
                {
                    Console.WriteLine(startScreen[i]);
                }

                Console.ForegroundColor = ConsoleColor.Magenta;
                for (int i = 0; i < 8; i++)
                {
                    Console.WriteLine(startScreen[i]);
                }

                Console.ForegroundColor = ConsoleColor.Green;
                for (int i = 8; i < 12; i++)
                {
                    Console.WriteLine(startScreen[i]);
                }

                Console.ForegroundColor = ConsoleColor.Yellow;
                for (int i = 32; i < 70; i++)
                {
                    Console.WriteLine(startScreen[i]);
                }

                Thread.Sleep(8000);
                for (int i = 72; i < 122; i++)
                {
                    Thread.Sleep(100);
                    Console.WriteLine(startScreen[i]);
                    Console.ForegroundColor = ConsoleColor.Green;
                }
            }
        }
        catch (FileNotFoundException)
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("Can't not find the loading screen file!");
        }
        catch (DirectoryNotFoundException)
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("The path to the loading screen file is incorrect!");
        }
        catch (IOException)
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("Error with the loading screen file!");
        }
    }
예제 #56
0
 public Larynx()
 {
     voiceON = true;
     synth   = new SpeechSynthesizer();
     synth.SetOutputToDefaultAudioDevice();
 }
예제 #57
0
        static void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            //Speaker
            SpeechSynthesizer speaker = new SpeechSynthesizer();

            speaker.SetOutputToDefaultAudioDevice();

            Console.WriteLine("Matched");
            float conf = e.Result.Confidence;
            int   c;

            //General Communication
            c = string.Compare(e.Result.Text.ToString(), "hello");
            if (c == 0)
            {
                speaker.Speak("Hello. Welcome to Connexions 2014");
            }

            c = string.Compare(e.Result.Text.ToString(), "hey");
            if (c == 0)
            {
                speaker.Speak("Hey");
            }

            c = string.Compare(e.Result.Text.ToString(), "hi");
            if (c == 0)
            {
                speaker.Speak("Hi!");
            }

            c = string.Compare(e.Result.Text.ToString(), "how are you");
            if (c == 0)
            {
                speaker.Speak("I am good. How are you");
            }

            c = string.Compare(e.Result.Text.ToString(), "kese ho");
            if (c == 0)
            {
                speaker.Speak("I am good. How are you");
            }

            c = string.Compare(e.Result.Text.ToString(), "what is your name");
            if (c == 0)
            {
                speaker.Speak("My name is TurtleBot. But you can call me Chhutu");
            }

            c = string.Compare(e.Result.Text.ToString(), "who has programmed you");
            if (c == 0)
            {
                speaker.Speak("Imran, Nabeel and Safeer. has programmed me");
            }

            c = string.Compare(e.Result.Text.ToString(), "tell me about yourself");
            if (c == 0)
            {
                speaker.Speak("I am Turtlebot. I am running on ROS. I participated in Eraan Open 2014 Competition. I met with other robots there");
            }

            c = string.Compare(e.Result.Text.ToString(), "nice to meet you");
            if (c == 0)
            {
                speaker.Speak("Thank you. Same here");
            }

            c = string.Compare(e.Result.Text.ToString(), "tell me about your features");
            if (c == 0)
            {
                speaker.Speak("My features are: I can talk. I can recognise faces. I can recognise colors. I can learn any path");
            }

            //General Communication Ends

            //------------------------------------------//

            //Commands
            c = string.Compare(e.Result.Text.ToString(), "chotu wake up");
            if (c == 0)
            {
                speaker.Speak("Hi! I am Listening");
                data  = 6;
                awake = 1;
            }

            if (awake == 1)
            {
                c = string.Compare(e.Result.Text.ToString(), "chotu stop");
                if (c == 0)
                {
                    speaker.Speak("Stopping");
                    data = 1;
                }

                c = string.Compare(e.Result.Text.ToString(), "bus ruk jao");
                if (c == 0)
                {
                    speaker.Speak("Ok!");
                    data = 1;
                }

                c = string.Compare(e.Result.Text.ToString(), "chotu forward");
                if (c == 0)
                {
                    data = 2;
                    speaker.Speak("Moving Forward");
                }

                c = string.Compare(e.Result.Text.ToString(), "chotu backward");
                if (c == 0)
                {
                    speaker.Speak("Moving Backward");
                    data = 3;
                }
                c = string.Compare(e.Result.Text.ToString(), "chotu right");
                if (c == 0)
                {
                    speaker.Speak("Turning Right");
                    data = 4;
                }
                c = string.Compare(e.Result.Text.ToString(), "chotu left");
                if (c == 0)
                {
                    speaker.Speak("Turning Left");
                    data = 5;
                }
                c = string.Compare(e.Result.Text.ToString(), "chotu sleep");
                if (c == 0)
                {
                    speaker.Speak("Ok. Sleeping now. Bye Bye");
                    data  = 7;
                    awake = 0;
                }
                c = string.Compare(e.Result.Text.ToString(), "face count");
                if (c == 0)
                {
                    data = 8;

                    //if (count_t == 0)
                    {
                        //Thread
                        ThreadStart childref2    = new ThreadStart(worker2);
                        Thread      childThread2 = new Thread(childref2);
                        childThread2.Start();
                        //Thread
                    }
                    count_t++;
                }
                c = string.Compare(e.Result.Text.ToString(), "face follow");
                if (c == 0)
                {
                    speaker.Speak("Following");
                    data = 9;
                }

                c = string.Compare(e.Result.Text.ToString(), "pattern follow");
                if (c == 0)
                {
                    speaker.Speak("Following");
                    data = 10;
                }
            }
        }
예제 #58
0
        static void Main(string[] args)
        {
            try
            {
                // Initialize a new instance of the SpeechSynthesizer.
                SpeechSynthesizer synth = new SpeechSynthesizer();
                synth.SelectVoiceByHints(VoiceGender.Female);
                // Configure the audio output.
                synth.SetOutputToDefaultAudioDevice();
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("-------------------------------------------------------------------------------\n");
                Console.WriteLine("********************  WELCOME TO THE CONDORCET ELECTION      *****************\n");
                Console.WriteLine("-------------------------------------------------------------------------------\n");
                synth.Speak("Welcome to the condorcet election.");
                Console.ResetColor();
                Console.ForegroundColor = ConsoleColor.Cyan;
                string       file   = "test.txt";
                StreamReader reader = new StreamReader(file);
                Console.WriteLine("Calculating election results.................\n");
                synth.Speak("Now calculating election results.");
                bool go = true;

                int ballot    = 0;
                int candidate = 0;

                do
                {
                    //Reading first line for number of ballot and number of candidate
                    string[] temp = reader.ReadLine().ToString().Split(' ');
                    ballot    = int.Parse(temp[0]);
                    candidate = int.Parse(temp[1]);

                    if (ballot == 0 && candidate == 0)
                    {
                        go = false;
                    }
                    else
                    {
                        //Creating jagged arrary for storing candidate position in each ballot
                        int[][] election = new int[ballot][];
                        for (int i = 0; i < ballot; i++)
                        {
                            election[i] = new int[candidate];
                        }
                        for (int i = 0; i < ballot; i++)
                        {
                            string[] temp2 = new string[candidate];
                            int[]    temp1 = new int[candidate];
                            Console.ForegroundColor = ConsoleColor.DarkGreen;

                            string s = reader.ReadLine().ToString();
                            temp2 = s.Split(' ');
                            for (int k = 0; k < temp2.Length; k++)
                            {
                                election[i][k] = int.Parse(temp2[k]);
                            }
                        }

                        int[] sumOfPosition = new int[candidate];
                        for (int z = 0; z < sumOfPosition.Length; z++)
                        {
                            for (int x = 0; x < ballot; x++)
                            {
                                sumOfPosition[z] += Array.IndexOf(election[x], z);
                            }
                        }
                        Console.ForegroundColor = ConsoleColor.Green;
                        var dict = new Dictionary <int, int>();

                        foreach (var value in sumOfPosition)
                        {
                            if (dict.ContainsKey(value))
                            {
                                dict[value]++;
                            }
                            else
                            {
                                dict[value] = 1;
                            }
                        }
                        bool IsWinnerDeclared = false;

                        foreach (var pair in dict)
                        {
                            if (pair.Value > 1)
                            {
                                Console.WriteLine("No winner");
                                IsWinnerDeclared = true;
                            }
                        }

                        if (IsWinnerDeclared == false)
                        {
                            Console.WriteLine("{0} is the winner", Array.IndexOf(sumOfPosition, sumOfPosition.Min()));
                        }
                        Console.ResetColor();
                        Console.ForegroundColor = ConsoleColor.Red;
                    }
                } while (go == true);



                Console.WriteLine("\n\n\t\t\tPRESS ENTER to exit....");
                synth.Speak("This is the result.");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex.Message + " Please check if the file was in correct format.");
                Console.ReadLine();
            }
        }
예제 #59
0
        private void Btn_SaveAsMP3_Click(object sender, EventArgs e)
        {
            //On Save as button clicked
            try
            {
                if (richTextBox1.Text == "")
                {
                    //throw exception if text box is empty
                    throw new Exception("Container is Empty!");
                }

                speechSynthesizerObj = new SpeechSynthesizer();
                String         ofileName;
                SaveFileDialog save = new SaveFileDialog();
                //select voice module
                if (voice_Cbx.Text == "Male")
                {
                    speechSynthesizerObj.SelectVoiceByHints(VoiceGender.Male);
                }
                else if (voice_Cbx.Text == "Female")
                {
                    speechSynthesizerObj.SelectVoiceByHints(VoiceGender.Female);
                }
                else
                {
                    throw new Exception("Invalid Voice Type");
                }
                //Choose file type MP3/WAV
                if (output_Cbx.Text == "MP3")
                {
                    //for MP3 file
                    save.Filter = "MP3| *.mp3";
                    save.ShowDialog();
                    ofileName = save.FileName;
                    MemoryStream ms = new MemoryStream();
                    speechSynthesizerObj.SetOutputToWaveStream(ms);
                    speechSynthesizerObj.Speak(richTextBox1.Text);
                    ConvertWavStreamToMp3File(ref ms, ofileName);
                    MessageBox.Show("MP3 File Generated");
                }
                else if (output_Cbx.Text == "WAV")
                {
                    //for WAV file
                    save.Filter = "Wave Files| *.wav";
                    save.ShowDialog();
                    ofileName = save.FileName;
                    //SpeechSynthesizer ss = new SpeechSynthesizer();
                    speechSynthesizerObj.SetOutputToWaveFile(ofileName);
                    speechSynthesizerObj.Speak(richTextBox1.Text);
                    speechSynthesizerObj.SetOutputToDefaultAudioDevice();
                    MessageBox.Show("WAV File Generated");
                }
                else
                {
                    //Catch invalid file type exception
                    throw new Exception("Invalid File Type");
                }
            }
            catch (Exception ex)
            {
                //Catch unexpected exception
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //clean cache
                speechSynthesizerObj.Dispose();
            }
        }
예제 #60
-3
 public VoiceAssistantService()
 {
     _synthesizer = new SpeechSynthesizer();
     _synthesizer.SetOutputToDefaultAudioDevice();
     _synthesizer.Volume = 100;
     _synthesizer.Rate = 1;
     _synthesizer.AddLexicon(new Uri(Path.GetFullPath("Resources/Lexicon.pls")), "application/pls+xml");
 }