Exemplo n.º 1
0
        public GoogleTTSProvider()
        {
            Name          = "Google Text To Speech";
            ProviderClass = Class.Web;
            HasVoices     = true;
            BackgroundWorker loadVoicesWorker = new BackgroundWorker();

            loadVoicesWorker.DoWork += delegate
            {
                List <CultureInfo> cultures = new List <CultureInfo>();
                cultures.AddRange(CultureInfo.GetCultures(CultureTypes.SpecificCultures));
                cultures.Sort((x, y) => x.DisplayName.CompareTo(y.DisplayName));
                AvailableVoices = cultures.Select(x => new Voice()
                {
                    Name = x.DisplayName, Language = x.Name
                }).ToList();
                if (this.Name == Properties.Settings.Default.LastTTSProvider)
                {
                    if (Properties.Settings.Default.RememberLanguageSettings)
                    {
                        SelectedVoice = AvailableVoices.Find(n => n.Name == Properties.Settings.Default.LastTTSVoice);
                    }
                    else
                    {
                        SelectedVoice = AvailableVoices[0];
                    }
                }
            };
            loadVoicesWorker.RunWorkerAsync();
        }
        public AmazonPollyTTSProvider()
        {
            Name              = "Amazon Polly";
            ProviderClass     = Class.Web;
            HasVoices         = true;
            HasDiscreteSpeed  = false;
            HasDiscreteVolume = false;
            BackgroundWorker loadVoicesWorker = new BackgroundWorker();

            polly = new AmazonPollyClient(AccessKey, SecretKey, Amazon.RegionEndpoint.USEast2);


            loadVoicesWorker.DoWork += delegate
            {
                try
                {
                    foreach (var v in polly.DescribeVoices(new Amazon.Polly.Model.DescribeVoicesRequest()).Voices)
                    {
                        AvailableVoices.Add(new Voice {
                            Name = v.Name, Gender = v.Gender.ToString(), Language = v.LanguageName
                        });
                    }

                    if (this.Name == Properties.Settings.Default.LastTTSProvider)
                    {
                        if (Properties.Settings.Default.RememberLanguageSettings)
                        {
                            SelectedVoice = AvailableVoices.Find(n => n.Name == Properties.Settings.Default.LastTTSVoice);
                        }
                        else
                        {
                            SelectedVoice = AvailableVoices[0];
                        }
                    }
                }
                catch (Exception Ex)
                {
                    Logger.Log(Ex.ToString());
                    AvailableVoices.Add(new Voice {
                        Name = "Amazon Polly Voices are Disabled", Language = "en-US", Gender = "None"
                    });
                    SelectedVoice = AvailableVoices[0];
                    disabled      = true;
                }
            };
            loadVoicesWorker.RunWorkerAsync();
        }
Exemplo n.º 3
0
        public MicrosoftTTSProvider()
        {
            Name              = "Microsoft Windows Text To Speech";
            ProviderClass     = Class.Local;
            HasVoices         = true;
            HasDiscreteSpeed  = true;
            HasDiscreteVolume = true;

            new Task(() =>
            {
                foreach (var v in speechSynth.GetInstalledVoices().Select(v => v.VoiceInfo))
                {
                    AvailableVoices.Add(new Voice {
                        Name = v.Name, Gender = v.Gender.ToString(), Language = v.Culture.Name
                    });
                }
                if (this.Name == Properties.Settings.Default.LastTTSProvider)
                {
                    if (Properties.Settings.Default.RememberLanguageSettings)
                    {
                        SelectedVoice = AvailableVoices.Find(n => n.Name == Properties.Settings.Default.LastTTSVoice);
                    }
                    else
                    {
                        SelectedVoice = AvailableVoices[0];
                    }
                }
            }).Start();

            for (int i = -10; i <= 10; i++)
            {
                AvailableSpeeds.Add(i.ToString());
            }
            SelectedDiscreteSpeed = "0";

            for (int i = 0; i <= 100; i++)
            {
                AvailableVolumes.Add(i.ToString());
            }
            SelectedDiscreteVolume = "100";
        }
        public FromTextToSpeechTTSProvider()
        {
            Name          = "From Text To Speech";
            ProviderClass = Class.Web;
            HasVoices     = true;
            AvailableVoices.Add(new Voice {
                Name = "Emma (UK English)", Language = "IVONA Amy22 (UK English)"
            });
            AvailableVoices.Add(new Voice {
                Name = "Harry (UK English)", Language = "IVONA Brian22 (UK English)"
            });
            AvailableVoices.Add(new Voice {
                Name = "Jade (French)", Language = "IVONA CΘline22 (French)"
            });
            AvailableVoices.Add(new Voice {
                Name = "Gabriel (French)", Language = "IVONA Mathieu22 (French)"
            });
            AvailableVoices.Add(new Voice {
                Name = "Nadine (German)", Language = "IVONA Marlene22 (German)"
            });
            AvailableVoices.Add(new Voice {
                Name = "Michael (German)", Language = "IVONA Hans22 (German)"
            });
            AvailableVoices.Add(new Voice {
                Name = "Valentina (Russian)", Language = "IVONA Tatyana22 (Russian)"
            });
            AvailableVoices.Add(new Voice {
                Name = "John (US English)", Language = "IVONA Eric22"
            });
            AvailableVoices.Add(new Voice {
                Name = "Jenna (US English)", Language = "IVONA Jennifer22"
            });
            AvailableVoices.Add(new Voice {
                Name = "George (US English)", Language = "IVONA Joey22"
            });
            AvailableVoices.Add(new Voice {
                Name = "Alice (US English)", Language = "IVONA Kimberly22"
            });
            AvailableVoices.Add(new Voice {
                Name = "Daisy (US English)", Language = "IVONA Salli22"
            });
            AvailableVoices.Add(new Voice {
                Name = "Alessandra (Italian)", Language = "IVONA Carla22 (Italian)"
            });
            AvailableVoices.Add(new Voice {
                Name = "Giovanni (Italian)", Language = "IVONA Giorgio22 (Italian)"
            });
            AvailableVoices.Add(new Voice {
                Name = "Isabella (Spanish [Modern])", Language = "IVONA Conchita22 (Spanish [Modern])"
            });
            AvailableVoices.Add(new Voice {
                Name = "Mateo (Spanish [Modern])", Language = "IVONA Enrique22 (Spanish [Modern])"
            });
            AvailableVoices.Add(new Voice {
                Name = "Rodrigo (Portuguese)", Language = "IVONA Cristiano22 (Portuguese)"
            });
            SelectedVoice = AvailableVoices[0];

            if (Properties.Settings.Default.RememberLanguageSettings && this.Name == Properties.Settings.Default.LastTTSProvider)
            {
                SelectedVoice = AvailableVoices.Find(n => n.Name == Properties.Settings.Default.LastTTSVoice);
            }
            else
            {
                SelectedVoice = AvailableVoices[0];
            }

            HasDiscreteSpeed = true;
            AvailableSpeeds.AddRange(new String[] { "slow", "medium", "fast", "very fast" });
            SelectedDiscreteSpeed = "medium";
        }