示例#1
0
        static void Main()
        {
            using (Imap imap = new Imap())
            {
                imap.ConnectSSL(_server);                        // Use overloads or ConnectSSL if you need to specify different port or SSL.
                imap.Login(_user, _password);                    // You can also use: LoginPLAIN, LoginCRAM, LoginDIGEST, LoginOAUTH methods,
                                                                 // or use UseBestLogin method if you want Mail.dll to choose for you.

                imap.SelectInbox();                              // You can select other folders, e.g. Sent folder: imap.Select("Sent");

                List <long> uids = imap.Search(Flag.Unseen);     // Find all unseen messages.

                Console.WriteLine("Number of unseen messages is: " + uids.Count);
                System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer();

                synth.SetOutputToDefaultAudioDevice();
                String speak = "you have" + uids.Count.ToString();
                // Speak a string.
                synth.Speak(speak);

                foreach (long uid in uids)
                {
                    IMail email = new MailBuilder().CreateFromEml(  // Download and parse each message.
                        imap.GetMessageByUID(uid));

                    ProcessMessage(email);                          // Display email data, save attachments.
                }
                imap.Close();
            }
        }
 public WindowsSpeechEngine()
 {
     synth = new System.Speech.Synthesis.SpeechSynthesizer();
     synth.SetOutputToDefaultAudioDevice();
     synth.SpeakCompleted += (s, e) => SpeakingCompleted?.Invoke(s, e);
     systemdefaultvoice    = synth.Voice.Name;
 }
示例#3
0
        private static void ProcessMessage(IMail email)
        {
            Console.WriteLine("Subject: " + email.Subject);
            Console.WriteLine("From: " + JoinAddresses(email.From));
            Console.WriteLine("To: " + JoinAddresses(email.To));
            Console.WriteLine("Cc: " + JoinAddresses(email.Cc));
            Console.WriteLine("Bcc: " + JoinAddresses(email.Bcc));

            Console.WriteLine("Text: " + email.Text);
            Console.WriteLine("HTML: " + email.Html);
            System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer();

            synth.SetOutputToDefaultAudioDevice();

            // Speak a string.
            synth.Speak("You have a Mail from" + email.From + "On" + email.Subject + email.Text);

            Console.WriteLine();
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();

            Console.WriteLine("Attachments: ");
            foreach (MimeData attachment in email.Attachments)
            {
                Console.WriteLine(attachment.FileName);
                attachment.Save(@"c:\" + attachment.SafeFileName);
            }
        }
示例#4
0
        private void bbardin_Click(object sender, EventArgs e)
        {
            if (Check(out int n))
            {
                tik.Value = ra.Value = n;

                //  System.Media.SystemSounds.Beep.Play();

                if (dataGridView1.SelectedRows.Count == 1)
                {
                    syntetizer.SetOutputToDefaultAudioDevice();

                    DataGridViewRow row = dataGridView1.SelectedRows[0];
                    string          v   = row.Cells[1].Value as string ?? string.Empty;
                    v += '\u25C9';
                    row.Cells[1].Value = v;

                    if (v.Length >= 2)
                    {
                        syntetizer.Speak("Ya tenemos paganini!");
                    }
                }

                System.Media.SystemSounds.Asterisk.Play();

                tik.Value = -1;
                ra.Value  = 100;
                Hurrengoa();
            }
            nz.Select();
        }
示例#5
0
文件: Speak.cs 项目: vantk85/openrpa
        protected override void Execute(CodeActivityContext context)
        {
            var voice   = Voice.Get(context);
            var rate    = Rate.Get(context);
            var volume  = Volume.Get(context);
            var doasync = Async.Get(context);
            var text    = Text.Get(context);
            var task    = Task.Run(() =>
            {
                using (var synthesizer = new System.Speech.Synthesis.SpeechSynthesizer())
                {
                    if (!string.IsNullOrEmpty(voice))
                    {
                        synthesizer.SelectVoice(voice);
                    }
                    if (rate >= 1 && rate <= 10)
                    {
                        synthesizer.Rate = rate;
                    }
                    if (volume >= 1 && volume <= 100)
                    {
                        synthesizer.Volume = volume;
                    }
                    synthesizer.SetOutputToDefaultAudioDevice();
                    synthesizer.Speak(text);
                }
            });

            if (!doasync)
            {
                task.Wait();
            }
        }
示例#6
0
 static void Init()
 {
     if (_provider == null)
     {
         _provider = new Speech.Synthesis.SpeechSynthesizer();
         _provider.SetOutputToDefaultAudioDevice();
     }
 }
示例#7
0
        static void SayString(string s)
        {
            System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer();

            synth.SetOutputToDefaultAudioDevice();
            synth.SelectVoiceByHints(System.Speech.Synthesis.VoiceGender.Female, System.Speech.Synthesis.VoiceAge.Senior);
            synth.Volume = 100;
            synth.Rate   = 0;
            synth.Speak(s);
        }
示例#8
0
 public void Play()
 {
     using (var synth = new System.Speech.Synthesis.SpeechSynthesizer())
     {
         synth.SelectVoiceByHints((System.Speech.Synthesis.VoiceGender)VoiceGender, (System.Speech.Synthesis.VoiceAge)VoiceAge, VoicePosition, new CultureInfo(CultureInfo));
         synth.SetOutputToDefaultAudioDevice();
         synth.Volume = Volume;
         synth.Rate   = Rate;
         synth.Speak(Text);
     }
 }
示例#9
0
        public SoundHandler()
        {
            cat = new System.Speech.Synthesis.SpeechSynthesizer();
            cat.SetOutputToDefaultAudioDevice();
            cat.SelectVoiceByHints(System.Speech.Synthesis.VoiceGender.Female, System.Speech.Synthesis.VoiceAge.Teen, 0, new System.Globalization.CultureInfo("zh-Hans"));
            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval = new System.Random().Next(60000 * 60, 120000 * 60);
            timer.Elapsed += CallBack;
            timer.Enabled  = true;

            FailSound    = "";
            SuccessSound = "";
        }
 public ExchangeSecretarService()
 {
     InitializeComponent();
     speech = new System.Speech.Synthesis.SpeechSynthesizer();
     speech.SetOutputToDefaultAudioDevice();
     eventLog     = new EventLog();
     this.AutoLog = false;
     if (!EventLog.SourceExists("SecretarSource"))
     {
         EventLog.CreateEventSource("SecretarSource", "SecretarLog");
     }
     eventLog.Source = "SecretarSource";
     eventLog.Log    = "SecretarLog";
 }
 public WindowsSpeechEngine()
 {
     synth = new System.Speech.Synthesis.SpeechSynthesizer();
     synth.SetOutputToDefaultAudioDevice();
     systemdefaultvoice = synth.Voice.Name;
 }
示例#12
0
        public async Task RecognizeSpeechAsync()
        {
            var config = SpeechConfig.FromSubscription("541650d764734a37a947aa914ba310cc", "westeurope");

            using (Microsoft.CognitiveServices.Speech.SpeechRecognizer recognizer = new Microsoft.CognitiveServices.Speech.SpeechRecognizer(config))
            {
                var result = await recognizer.RecognizeOnceAsync();


                // Checks result.
                bool   speech1on = false;
                string result2   = result.Text;

                if (result.Reason == ResultReason.RecognizedSpeech)
                {
                    if (result.Text.Contains("Mirror"))
                    {
                        int i = result.Text.IndexOf(" ") + 1;

                        speech1on = true;
                        result2   = result.Text.Substring(i);
                    }
                    else
                    {
                        speech1on = false;
                    }
                    if (speech1on)
                    {
                        var wa = new WAEngine {
                            APIKey = "3YYV6P-R5W8R7TY35"
                        };
                        WALogger.LogLevel        = WALogLevel.None;
                        WALogger.ConsoleLogLevel = WALogLevel.Verbose;
                        var question = result2;
                        var query    = new WAQuery()
                        {
                            Input = question, Format = WAQueryFormat.PlainText
                        };
                        var queryresult = new WAQueryResult();
                        speech.Visible = true;
                        speech.Text    = question;
                        query.PodStates.Add("test");
                        query.AppID = wa.APIKey;
                        string url     = query.FormatQuery();
                        var    result1 = wa.RunQuery(query);
                        foreach (var pod in result1.Pods)
                        {
                            foreach (var subpod in pod.SubPods)
                            {
                                string titlu = pod.Title;

                                if (titlu.Contains("Result"))
                                {
                                    System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer();

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

                                    // Speak a string.
                                    synth.Speak(subpod.PlainText);
                                    raspuns.Visible = true;
                                    raspuns.Text    = subpod.PlainText;
                                }
                                else if (titlu.Contains("Basic information"))
                                {
                                    System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer();

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

                                    synth.Speak(subpod.PlainText);
                                    raspuns.Visible = true;
                                    raspuns.Text    = subpod.PlainText;
                                }


                                else if (titlu.Contains("Estimates for"))
                                {
                                    System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer();

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

                                    synth.Speak(subpod.PlainText);
                                    raspuns.Visible = true;
                                    raspuns.Text    = subpod.PlainText;
                                }

                                else if (titlu.Contains("Biological"))
                                {
                                    System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer();

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

                                    synth.Speak(subpod.PlainText);
                                    raspuns.Visible = true;
                                    raspuns.Text    = subpod.PlainText;
                                }

                                else if (titlu.Contains("Definitions"))
                                {
                                    System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer();

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

                                    synth.Speak(subpod.PlainText);
                                    raspuns.Visible = true;
                                    raspuns.Text    = subpod.PlainText;
                                }
                            }
                        }
                    }
                }
            }
            RecognizeSpeechAsync();
        }
示例#13
0
 public UITTSContext()
 {
     Synth = new System.Speech.Synthesis.SpeechSynthesizer();
     Synth.SetOutputToDefaultAudioDevice();
 }
        private void ButtonVoiceSpecimenDescription_Click(object sender, RoutedEventArgs e)
        {
            using (System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer())
            {
                synth.SetOutputToDefaultAudioDevice();

                System.Speech.Synthesis.PromptBuilder builder = new System.Speech.Synthesis.PromptBuilder();
                builder.AppendTextWithHint("S12", System.Speech.Synthesis.SayAs.NumberCardinal);
                builder.AppendTextWithHint("10456", System.Speech.Synthesis.SayAs.SpellOut);

                synth.Speak(builder);
            }
        }