Ejemplo n.º 1
0
 //Функция для потока
 public void myThread()
 {
     speech.SpeakAsync("Время этапа " + namez + " из Дедлайна " + deadnamez + " вышло! ");
     speech.Resume();
     Thread.Sleep(5000);
     speech.Pause();
 }
Ejemplo n.º 2
0
 public void voice()
 {
     FixTextTxt.Text = "";
     if (startplay)
     {
         if (playpause)
         {
             playpause = false;
             readerspeak.Resume();
             PlayAction.Content = "Pause";
         }
         else
         {
             playpause = true;
             readerspeak.Pause();
             PlayAction.Content = "Resume";
         }
     }
     else if (!startplay)
     {
         SpeakText(ErrorFix.IsChecked.Value, true);
         // Speak a string asynchronously.
         startplay          = true;
         playpause          = false;
         PlayAction.Content = "Pause";
         Stopbtn.IsEnabled  = true;
     }
 }
Ejemplo n.º 3
0
        public string SpeakStart(string text, string lang)
        {
            SpeakStop();

            text = CleanUp(text);

            bool voiceSelected = false;

            foreach (VoiceRate vi in voices)
            {
                if (vi.Voice.Culture.Name.Equals(lang) || (vi.Voice.Culture.Parent != null && vi.Voice.Culture.Parent.Name.Equals(lang))) //Parent: pt-BR ~ pt
                {
                    speech.SelectVoice(vi.Voice.Name);
                    speech.Rate   = vi.Rate;
                    voiceSelected = true;
                    break;
                }
            }

            if (!voiceSelected)
            {
                speech.SelectVoice(voices[0].Voice.Name);
            }


            speech.SpeakAsync(text);

            if (speech.State == SynthesizerState.Paused)
            {
                speech.Resume();
            }

            return(text);
        }
        /// <summary>
        /// Handles the SpeechRecognized event of the engine control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Speech.Recognition.SpeechRecognizedEventArgs"/> instance containing the event data.</param>
        void engine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            //scvText.ScrollToEnd();
            string speech = (e.Result.Text);

            Marvel.SpeakAsyncCancelAll();

            switch (speech)
            {
            //Get weather report
            case "get weather report":
            case "what is the weather today":
            case "what is the weather":
                Marvel.Speak("ok master, before your get with weather report");
                Marvel.Speak("if your city name is in my directory, city name list, then i will search for you ");
                Marvel.Speak("if it is not in my directory then type it on text box and press get weather report button, ");
                Marvel.Speak("ok ready, tell me your city name");
                break;

            case "hide weather report":
                FormBorderStyle = FormBorderStyle.None;
                WindowState     = FormWindowState.Minimized;
                TopMost         = false;
                break;

            case "show weather report":
            case "show weather report again":
                FormBorderStyle = FormBorderStyle.None;
                WindowState     = FormWindowState.Normal;
                TopMost         = true;
                break;

            case "get weather forcast for whole week":
                WeeklyWeather();
                break;

            case "pause":
                Marvel.Pause();
                break;

            case "resume":
                Marvel.Resume();
                break;

            case "stop":
                Marvel.Pause();
                break;

            case "close weather report":
            case "close this":
                UnloadGrammarAndCommands();
                closebtn.PerformClick();
                break;

            default:
                inputtxt.Text = speech;
                yahooweatherbtn.PerformClick();
                break;
            }
        }
Ejemplo n.º 5
0
        public void StartReading(TextPointer startingPoint)
        {
            if (startingPoint == null)
            {
                return;
            }
            StopReading();

            startedReading   = startingPoint;
            lastPoint        = startedReading;
            countToLastPoint = 0;
            breakPoint       = GetPositionAtTextOffset(startedReading, 1000);
            if (breakPoint == null)
            {
                breakPoint = startedReading.DocumentEnd;
            }
            if (breakPoint.Paragraph != null)
            {
                breakPoint = breakPoint.Paragraph.ContentEnd;
            }

            _synth.SpeakAsync(richTextBoxToPromt(startingPoint, breakPoint));
            ReadText = new TextRange(startingPoint, startingPoint);
            if (_synth.State == SynthesizerState.Paused)
            {
                _synth.Resume();
            }
            State = ReaderState.StartedSpeaking;
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            string            text; int type;
            SpeechSynthesizer S = new SpeechSynthesizer();

            Console.WriteLine("Please Enter Voice type");
            S.Speak("Please Enter Voice type. Press 1 to select female voice");

            type = Int32.Parse(Console.ReadLine());
            if (type == 1)
            {
                S.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult, 1);
            }
            else
            {
                ;
            }

            Console.WriteLine("Please Enter text");
            S.Speak("Please Enter Text");
            text = Console.ReadLine();

            S.Speak(text);
            S.Pause();                                      //pausing the object
            S.Resume();                                     //resuming the object
            S.Speak("Thankyou for using this software developed by Prerna Sharma.!");
            S.Pause();                                      //pausing the object
            S.Resume();
            S.Speak("Have a nice day ahead");

            S.Dispose();                                   // to free the resources
            Console.ReadKey();
        }
Ejemplo n.º 7
0
 public static void Speak(string msg)                                      // Use for Voice Output
 {
     synth.Pause();
     synth.SpeakAsyncCancelAll();
     synth.Resume();
     synth.SpeakAsync(msg);
 }
Ejemplo n.º 8
0
 public void Resume()
 {
     if (synthesizer.State == SynthesizerState.Paused)
     {
         synthesizer.Resume();
     }
 }
Ejemplo n.º 9
0
        private void button_Click(object sender, EventArgs e)
        {
            string            textInput; int type;
            SpeechSynthesizer S = new SpeechSynthesizer();

            // Console.WriteLine("Please Enter Voice type");
            // S.Speak("Please Enter Voice type. Press 1 to select female voice");

            // type = Int32.Parse(Console.ReadLine());
            // if (type == 1)
            S.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult, 1);
            //  else;

            //  Console.WriteLine("Please Enter text");
            S.Speak("Please Enter Text");
            textInput = text.Text;

            S.Speak(textInput);
            S.Pause();                                          //pausing the object
            S.Resume();                                         //resuming the object
            S.Speak("Thankyou for using this software developed by Prerna Sharma.!");
            S.Pause();                                          //pausing the object
            S.Resume();
            S.Speak("Have a nice day ahead");

            S.Dispose();                                        // to free the resources
        }
Ejemplo n.º 10
0
 public void resume()
 {
     if (speechObj.State == SynthesizerState.Paused)
     {
         speechObj.Resume();
     }
 }
Ejemplo n.º 11
0
 //Detiene la lectura por completo
 private void BtnStop_Click(object sender, EventArgs e)
 {
     if (jarvis.State == SynthesizerState.Paused)
     {
         jarvis.Resume();
     }
     jarvis.SpeakAsyncCancelAll();
     btnStop.Text     = "Stop";
     btnStart.Enabled = true;
 }
Ejemplo n.º 12
0
 private void Speak(object obj)
 {
     if (_synthesizer.State == SynthesizerState.Paused)
     {
         _synthesizer.Resume();
     }
     else
     {
         SelectedExport.Value.ExportCommand.Execute();
         _synthesizer.SpeakAsync(Document.AsPrompt());
     }
 }
Ejemplo n.º 13
0
        private void stopButton_Click(object sender, EventArgs e)
        {
            if (synth.State == SynthesizerState.Speaking || synth.State == SynthesizerState.Paused)
            {
                synth.SpeakAsyncCancelAll();
            }

            synth.Resume();
            stopButton.Enabled = false;
            playing            = false;
            pause = false;
            playPauseButton.Image = Properties.Resources.play_small;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Stops all speech synthesis, usually to allow for a new speech call.
        /// </summary>
        /// <seealso cref="https://msdn.microsoft.com/en-us/library/system.speech.synthesis.speechsynthesizer.speakasynccancelall(v=vs.110).aspx"/>
        /// <seealso cref="https://msdn.microsoft.com/en-us/library/system.speech.synthesis.speechsynthesizer.resume%28v=vs.110%29.aspx"/>
        public void CancelAllSpeech()
        {
            speechSynthLetter.SpeakAsyncCancelAll();
            speechSynthWord.SpeakAsyncCancelAll();

            if (ParaSpeechState == SynthesizerState.Paused)
            {
                // Strangely, canceling a speech synthesizer in a paused state doesn't set the state to ready,
                // but leaves it paused. Resuming it, then canceling it, resets it to ready.
                speechSynthPara.Resume();
            }
            speechSynthPara.SpeakAsyncCancelAll();
        }
Ejemplo n.º 15
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (ohannah.State == SynthesizerState.Speaking)
     {
         ohannah.Pause();
         button3.Text = "Resume";
     }
     else if (ohannah.State == SynthesizerState.Paused)
     {
         ohannah.Resume();
         button3.Text = "Pause";
     }
 }
        public void Read(string text)
        {
            lock (this)
            {
                if (null != current_prompt)
                {
                    speech_synthesizer.SpeakAsyncCancel(current_prompt);
                }

                current_prompt_length = text.Length;
                current_prompt        = speech_synthesizer.SpeakAsync(text);
                speech_synthesizer.Resume();
            }
        }
Ejemplo n.º 17
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (pr)
     {
         syn.Resume();
         sp.Start();
     }
     else
     {
         syn.Pause();
         sp.Stop();
     }
     pr = !pr;
 }
Ejemplo n.º 18
0
        private void StopSpeech()
        {
            if (_currentPrompt == null)
            {
                return;
            }
            _synthesizer.SpeakAsyncCancel(_currentPrompt);
            _currentPrompt = null;
            _synthesizer.Resume();
            CurrentWord           = string.Empty;
            CurrentCharacterIndex = 0;

            btnStart.Focus();
        }
Ejemplo n.º 19
0
 private void Pause_button_Click(object sender, EventArgs e)//function name states the function :P
 {
     if (VoiceTTS.State == SynthesizerState.Speaking)
     {
         Pause.Text = "Resume";
         VoiceTTS.Pause();
         Read.Enabled = false;
     }
     else if (VoiceTTS.State == SynthesizerState.Paused)
     {
         Pause.Text = "Pause";
         VoiceTTS.Resume();
         Read.Enabled = true;
     }
 }
Ejemplo n.º 20
0
 private void cmdPause_Click(object sender, EventArgs e)
 {
     if (_speechState == SynthesizerState.Speaking)
     {
         //cmdPause.Text = "Resume";
         //cmdPause.Enabled = true;
         _speachSyn.Pause();
     }
     else if (_speechState == SynthesizerState.Paused)
     {
         //cmdPause.Text = "Pause";
         //cmdPause.Enabled = true;
         _speachSyn.Resume();
     }
 }
Ejemplo n.º 21
0
 public void PausePlay()
 {
     if (IsPaused == false)
     {
         synthesizer.Pause();
         button2.Text = "Play";
         IsPaused     = true;
     }
     else
     {
         synthesizer.Resume();
         button2.Text = "Pause";
         IsPaused     = false;
     }
 }
Ejemplo n.º 22
0
        private void soundPhrase1_Click(object sender, EventArgs e)
    {
        PictureBox[] PauseSound = { soundPhrase1Pause, soundPhrase2Pause, soundPhrase3Pause, soundPhrase5Pause, soundPhrase6Pause, soundPhrase7Pause,soundPhrase8Pause,soundPhrase9Pause,soundPhrase10Pause,soundPhrase11Pause,soundPhrase12Pause,soundPhrase13Pause,soundPhrase14Pause };
        Label[] labels = { coursLabel, coursLabel1,CoursLabel2,coursLabel3, coursLabel4, coursLabel5, coursLabel6, coursLabel7,coursLabel8,coursLabel9,CoursLabel10,coursLabel11,coursLabel12};
        foreach (PictureBox box in PauseSound) box.Visible = false;
        int i = 0; PictureBox pbox = (PictureBox)sender;
        while (PauseSound[i].Name != pbox.Name + "Pause") { i++; }
        childThread = new Thread(new ThreadStart(() =>
        {


            if ((pbox.Name == pausedName)) { sSynth.Resume(); pausedName = ""; }
            else
            {
                try { sSynth.Pause(); } catch (Exception) { }

                sSynth = new SpeechSynthesizer();
                PromptBuilder pBuilder = new PromptBuilder();
                SpeechRecognitionEngine sRecognize = new SpeechRecognitionEngine(new CultureInfo("fr-FR"));

                pBuilder.ClearContent();
                pBuilder.AppendText(labels[i].Text);
                sSynth.Speak(pBuilder);
                sSynth.Dispose();
                pausedName = "";
                this.Invoke(new MethodInvoker(() => PauseSound[i].Hide()));

            }

        }));
        PauseSound[i].Show();
        PauseSound[i].Click += pause_click;
        childThread.Start();
    }
Ejemplo n.º 23
0
 private void PauseBtn_Click(object sender, EventArgs e)
 {
     if (Decca.State == SynthesizerState.Speaking)
     {
         Decca.Pause();
         PauseBtn.Text = "Resume";
     }
     else
     {
         if (Decca.State == SynthesizerState.Paused)
         {
             Decca.Resume();
             PauseBtn.Text = "Pause";
         }
     }
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Resumes reader
 /// </summary>
 public void ResumeReader()
 {
     if (_reader.State == SynthesizerState.Paused)
     {
         _reader.Resume();
     }
 }
        public void Read(string text)
        {
            //Utilities.LockPerfTimer l1_clk = Utilities.LockPerfChecker.Start();
            lock (read_out_loud_lock)
            {
                //l1_clk.LockPerfTimerStop();
                if (null != current_prompt)
                {
                    speech_synthesizer.SpeakAsyncCancel(current_prompt);
                }

                current_prompt_length = text.Length;
                current_prompt        = speech_synthesizer.SpeakAsync(text);
                speech_synthesizer.Resume();
            }
        }
Ejemplo n.º 26
0
        public void Falar(string strTexto)
        {
            SpeechEngine.Rate   = this.Velocidade;
            SpeechEngine.Volume = this.Volume;

            SpeechEngine.StateChanged += SpeechEngine_StateChanged;

            if (!string.IsNullOrWhiteSpace(strTexto))
            {
                switch (SpeechEngine.State)
                {
                case SynthesizerState.Ready:
                    SpeechEngine.SetOutputToDefaultAudioDevice();      //Definindo o dispositivo padrão de reprodução da síntese.
                    SpeechEngine.SpeakAsync(strTexto);
                    break;

                case SynthesizerState.Speaking:
                    SpeechEngine.Pause();
                    break;

                case SynthesizerState.Paused:
                    SpeechEngine.Resume();
                    break;
                }
            }
        }
Ejemplo n.º 27
0
 public void ResumeTextspeak()
 {
     if (ts.State == SynthesizerState.Paused)
     {
         ts.Resume();
     }
 }
Ejemplo n.º 28
0
 private void btnPause_Click(object sender, EventArgs e)
 {
     if (Marvel.State == SynthesizerState.Speaking)
     {
         Marvel.Pause();
         btnPause.Text = "Resume";
     }
     else
     {
         if (Marvel.State == SynthesizerState.Paused)
         {
             Marvel.Resume();
             btnPause.Text = "Pause";
         }
     }
 }
Ejemplo n.º 29
0
 public void ResumeTextSpeak()
 {
     if (m_speechSynthesizer.State == SynthesizerState.Paused)
     {
         m_speechSynthesizer.Resume();
     }
 }
Ejemplo n.º 30
0
 private void btnPause_Click(object sender, EventArgs e)
 {
     if (nexiWeb.State == SynthesizerState.Speaking)
     {
         nexiWeb.Pause();
         btnPause.Text = "CONTINUE";
     }
     else
     {
         if (nexiWeb.State == SynthesizerState.Paused)
         {
             nexiWeb.Resume();
             btnPause.Text = "PAUSE";
         }
     }
 }
Ejemplo n.º 31
0
 public void Play()
 {
     speaker = new SpeechSynthesizer();
     speaker.SelectVoice("ScanSoft Raquel_Full_22kHz");
     speaker.SpeakCompleted += new EventHandler<SpeakCompletedEventArgs>(speaker_SpeakCompleted);
     speaker.SpeakAsync(texto);
     speaker.Resume();
 }