コード例 #1
0
ファイル: Program.cs プロジェクト: joejoemister/Jarvis
        public static void Speak(string message, VoiceGender voiceGender)
        {
            synth.SelectVoiceByHints(voiceGender);
            string memAvailableVocalMessage = message;

            synth.Speak(memAvailableVocalMessage);
        }
コード例 #2
0
        public static void setupVoices()
        {
            ModConfig config = Helper.ReadConfig <ModConfig>();

            currentCulture = CultureInfo.CreateSpecificCulture(config.lang);
            culturelang    = config.lang.Split('-')[0];
            voices         = new Dictionary <string, SpeechProfile>();

            foreach (SpeechConfig npc in config.voices)
            {
                VoiceGender gender = (npc.gender == 0) ? VoiceGender.Male : VoiceGender.Female;

                VoiceAge age = VoiceAge.NotSet;

                if (npc.age == 3)
                {
                    age = VoiceAge.Senior;
                }
                else if (npc.age == 0)
                {
                    age = VoiceAge.Adult;
                }
                else if (npc.age == 1)
                {
                    age = VoiceAge.Teen;
                }
                else if (npc.age == 2)
                {
                    age = VoiceAge.Child;
                }

                voices.Add(npc.name, new SpeechProfile(npc.voicename, gender, age, 0, currentCulture));
            }
        }
コード例 #3
0
 /// <summary>
 /// Speaks with a selected voice, message and speech rate
 /// </summary>
 /// <param name="message"></param>
 /// <param name="voice_gender"></param>
 /// <param name="rate"></param>
 public static void Talk(string message, VoiceGender voice_gender, int rate)
 {
     int old_rate = synth.Rate;
     synth.Rate = rate;
     Talk(message, voice_gender);
     synth.Rate = old_rate;
 }
コード例 #4
0
        public void SelectVoiceByHints(VoiceGender gender, VoiceAge age, int voiceAlternate, CultureInfo culture)
        {
            Helpers.ThrowIfNull(culture, nameof(culture));

            if (voiceAlternate < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(voiceAlternate), SR.Get(SRID.PromptBuilderInvalidVariant));
            }
            if (!VoiceInfo.ValidateGender(gender))
            {
                throw new ArgumentException(SR.Get(SRID.EnumInvalid, "VoiceGender"), nameof(gender));
            }

            if (!VoiceInfo.ValidateAge(age))
            {
                throw new ArgumentException(SR.Get(SRID.EnumInvalid, "VoiceAge"), nameof(age));
            }

            TTSVoice ttsVoice = VoiceSynthesizer.GetEngine(null, culture, gender, age, voiceAlternate, true);

            if (ttsVoice == null)
            {
                // No match - throw
                throw new InvalidOperationException(SR.Get(SRID.SynthesizerSetVoiceNoMatch));
            }
            VoiceSynthesizer.Voice = ttsVoice;
        }
コード例 #5
0
 //A function that takes in a message and a selected voice
 public static void Justin_Speak(String message, VoiceGender voiceGender)
 {
     //Change voice back to male
     synth.SelectVoiceByHints(voiceGender);
     //Actually speaks the current CPU Load
     synth.Speak(message);
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: joejoemister/Jarvis
        // Speaks with a gender voice and rate
        public static void Speak(string message, VoiceGender voiceGender, int rate)
        {
            synth.Rate = rate;
            string memAvailableVocalMessage = message;

            synth.Speak(memAvailableVocalMessage);
        }
コード例 #7
0
        private static void ReadSettingLine(int i, string[] lines)
        {
            if (i < lines.Length)
            {
                switch (i)
                {
                case 0: ascending = bool.Parse(lines[i]); break;

                case 1: icoordEnabled = bool.Parse(lines[i]); break;

                case 2: enableReadback = bool.Parse(lines[i]); break;

                case 3: autoPlay = bool.Parse(lines[i]); break;

                case 4: boardSize = int.Parse(lines[i]); break;

                case 5: computervoice = (VoiceGender)Enum.Parse(typeof(VoiceGender), lines[i]); break;

                case 6: topLeft.X = double.Parse(lines[i]); break;

                case 7: topLeft.Y = double.Parse(lines[i]); break;

                case 8: bottomRight.X = double.Parse(lines[i]); break;

                case 9: bottomRight.Y = double.Parse(lines[i]); break;

                case 10: enableHotkeys = bool.Parse(lines[i]); break;

                case 11: enableOpponentColorRead = bool.Parse(lines[i]); break;
                    //case 12: enableExcitedVoice = bool.Parse(lines[i]); break;
                }
            }
        }
コード例 #8
0
        private void SpeechSave(string Text, decimal Rate, decimal Volume, string SaveLocation, string Language, string Gender)
        {
            string      exceptedLanguage = string.Empty;
            VoiceGender exceptedGender   = VoiceGender.Male;

            switch (Language)
            {
            case ("0"):
                exceptedLanguage = "fr-FR";
                break;

            case ("1"):
                exceptedLanguage = "en-US";
                break;

            case ("2"):
                exceptedLanguage = "ja-JP";
                break;
            }
            switch (Gender)
            {
            case ("0"):
                exceptedGender = VoiceGender.Male;
                break;

            case ("1"):
                exceptedGender = VoiceGender.Female;
                break;
            }
            speaker.Rate = Decimal.ToInt32(Rate);
            speaker.SelectVoiceByHints(exceptedGender, VoiceAge.NotSet, 0, new CultureInfo(exceptedLanguage));
            speaker.Volume = Decimal.ToInt32(Volume);
            speaker.SetOutputToWaveFile(SaveLocation);
            speaker.Speak(Text);
        }
コード例 #9
0
 public object ProcessVoice(string name, CultureInfo culture, VoiceGender gender, VoiceAge age, int variant, bool fNewCulture, List <SsmlXmlAttribute> extraNamespace)
 {
     _writer.WriteStartElement("voice");
     if (!string.IsNullOrEmpty(name))
     {
         _writer.WriteAttributeString("name", name);
     }
     if (fNewCulture && culture != null)
     {
         _writer.WriteAttributeString("xml", "lang", null, culture.Name);
     }
     if (gender != 0)
     {
         _writer.WriteAttributeString("gender", gender.ToString().ToLowerInvariant());
     }
     if (age != 0)
     {
         XmlTextWriter writer = _writer;
         int           num    = (int)age;
         writer.WriteAttributeString("age", num.ToString(CultureInfo.InvariantCulture));
     }
     if (variant > 0)
     {
         _writer.WriteAttributeString("variant", variant.ToString(CultureInfo.InvariantCulture));
     }
     if (extraNamespace != null)
     {
         foreach (SsmlXmlAttribute item in extraNamespace)
         {
             _writer.WriteAttributeString("xmlns", item._name, item._ns, item._value);
         }
     }
     return(null);
 }
コード例 #10
0
        public object ProcessVoice(string name, CultureInfo culture, VoiceGender gender, VoiceAge age, int variant, bool fNewCulture, List <SsmlXmlAttribute> extraNamespace)
        {
            _writer.WriteStartElement("voice");
            if (!string.IsNullOrEmpty(name))
            {
                _writer.WriteAttributeString("name", name);
            }
            if (fNewCulture && culture != null)
            {
                _writer.WriteAttributeString("xml", "lang", null, culture.Name);
            }
            if (gender != VoiceGender.NotSet)
            {
                _writer.WriteAttributeString("gender", gender.ToString().ToLowerInvariant());
            }
            if (age != VoiceAge.NotSet)
            {
                _writer.WriteAttributeString("age", ((int)age).ToString(CultureInfo.InvariantCulture));
            }
            if (variant > 0)
            {
                _writer.WriteAttributeString("variant", (variant).ToString(CultureInfo.InvariantCulture));
            }

            // write all the additional namespace
            if (extraNamespace != null)
            {
                foreach (SsmlXmlAttribute ns in extraNamespace)
                {
                    _writer.WriteAttributeString("xmlns", ns._name, ns._ns, ns._value);
                }
            }
            return(null);
        }
コード例 #11
0
 public L2FVoice(string name, VoiceGender gender, VoiceAge age, string culture, L2FSpeechEngine engine) : base(engine)
 {
     Name    = name;
     Gender  = gender;
     Age     = age;
     Culture = culture;
 }
コード例 #12
0
 /// <summary>
 /// configures the current voice
 /// </summary>
 /// <param name="voiceGender">the voice gender</param>
 /// <param name="cultureInfo">the culture info</param>
 public void SetVoice(VoiceGender voiceGender, CultureInfo cultureInfo)
 {
     _speaker.SetOutputToDefaultAudioDevice();
     _speaker.SelectVoiceByHints(voiceGender, VoiceAge.NotSet, 0, cultureInfo);
     _speaker.Rate   = 1;
     _speaker.Volume = 100;
 }
コード例 #13
0
 public void StartSpeech(string text, bool value, VoiceGender type)
 {
     if (value == true)
     {
         PromptBuilder promptBuilder = new PromptBuilder();
         PromptStyle   promptStyle   = new PromptStyle();
         promptStyle.Volume   = PromptVolume.Soft;
         promptStyle.Rate     = PromptRate.Slow;
         promptStyle.Emphasis = PromptEmphasis.Moderate;
         promptBuilder.StartStyle(promptStyle);
         promptBuilder.EndStyle();
         promptBuilder.AppendTextWithHint(text, SayAs.SpellOut);
         SpeechSynthesizer speechSynthesizer = new SpeechSynthesizer();
         speechSynthesizer.SelectVoiceByHints(type);
         speechSynthesizer.Speak(promptBuilder);
     }
     else
     {
         PromptBuilder promptBuilder = new PromptBuilder();
         PromptStyle   promptStyle   = new PromptStyle();
         promptStyle.Volume   = PromptVolume.Soft;
         promptStyle.Rate     = PromptRate.Slow;
         promptStyle.Emphasis = PromptEmphasis.Moderate;
         promptBuilder.StartStyle(promptStyle);
         promptBuilder.EndStyle();
         promptBuilder.AppendText(text);
         SpeechSynthesizer speechSynthesizer = new SpeechSynthesizer();
         speechSynthesizer.SelectVoiceByHints(type);
         speechSynthesizer.Speak(promptBuilder);
     }
 }
コード例 #14
0
 internal static bool ValidateGender(VoiceGender gender)
 {
     if (gender != VoiceGender.Female && gender != VoiceGender.Male && gender != VoiceGender.Neutral)
     {
         return(gender == VoiceGender.NotSet);
     }
     return(true);
 }
コード例 #15
0
ファイル: WindowsVoice.cs プロジェクト: dbraillon/Aida
 public WindowsVoice(int rate, VoiceGender gender, VoiceAge age, CultureInfo language)
 {
     Language    = language;
     Synthesizer = new SpeechSynthesizer();
     Synthesizer.SetOutputToDefaultAudioDevice();
     Synthesizer.Rate = 1;
     Synthesizer.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult, 0, language);
 }
コード例 #16
0
 /// <summary>
 /// cTor:
 /// </summary>
 /// <param name="name">Voice Display Name</param>
 /// <param name="lang">Language Code</param>
 /// <param name="desc">Voice Description</param>
 /// <param name="id">Voice ID</param>
 /// <param name="gender"></param>
 public VoiceInfo(string name, string lang, string desc, string id, VoiceGender gender)
 {
     Gender      = gender;
     Name        = name;
     Language    = lang;
     Description = desc;
     Id          = id;
 }
コード例 #17
0
 public SpeechProfile(string name, VoiceGender gender, VoiceAge age, int alternate, CultureInfo culture)
 {
     this.name      = name;
     this.gender    = gender;
     this.age       = age;
     this.alternate = alternate;
     this.culture   = culture;
 }
コード例 #18
0
        // Talk void so that we don't have to copy multiple lines of code for use in multiple cases.
        public static void Talk(string message, VoiceGender voiceGender, int rate)
        {
            SpeechSynthesizer synth = new SpeechSynthesizer();

            synth.SelectVoiceByHints(voiceGender);
            synth.Rate = (rate);
            synth.Speak(message);
        }
コード例 #19
0
ファイル: frmRead.cs プロジェクト: baotinsoft/FullKnowledge
        private void btnRead_Click(object sender, EventArgs e)
        {
            if (btnRead.Text == "Read")
            {
                if (synth == null)
                {
                    synth = new SpeechSynthesizer();
                }
                VoiceGender gender  = chkIsMale.Checked ? VoiceGender.Male : VoiceGender.Female;
                string      culture = "";
                //if (cboLanguage.Text == "English")
                //    culture = "Microsoft";
                //else
                //    culture = "NHMTTS Voice";
                //synth.SelectVoice(synth.GetInstalledVoices().Where(v => v.VoiceInfo.Name.Contains(culture) && v.VoiceInfo.Gender == gender).First().VoiceInfo.Name);

                if (cboLanguage.Text == "English")
                {
                    culture = "en-US";
                }
                else
                {
                    culture = "vi-VN";
                }

                if (!synth.Voice.Culture.Name.Contains(culture))
                {
                    synth.SelectVoice(synth.GetInstalledVoices().Where(v => v.VoiceInfo.Culture.Name == culture && v.VoiceInfo.Gender == gender).First().VoiceInfo.Name);
                }

                // Configure the audio output.
                outputFile = outputFolder + @"\" + id + "_" + DateTime.Now.ToString().Replace('/', '_').Replace(':', '_') + ".wav";
                synth.SetOutputToWaveFile(outputFile);

                // Register for the SpeakCompleted event.
                synth.SpeakCompleted += new EventHandler <SpeakCompletedEventArgs>(synth_SpeakCompleted);


                synth.SpeakAsync(txtTitle.Text + rtbContent.Text);
                btnRead.Text = "Stop";
            }
            else
            {
                btnRead.Text = "Read";
                synth.SpeakAsyncCancelAll();
            }
            //SpeechLib. oVoice = new SpeechLib();
            //SpVoice oVoice = new SpVoice();
            //SpFileStream cpFileStream = new SpFileStream();
            //if (cboLanguage.Text == "English")
            //    oVoice.Voice = oVoice.GetVoices().Item(2);
            //else
            //    oVoice.Voice = oVoice.GetVoices().Item(1);
            //oVoice.Volume = 100;
            //oVoice.Rate = 4;//4

            //oVoice.Speak(txtTitle.Text + rtbContent.Text, SpeechLib.SpeechVoiceSpeakFlags.SVSFDefault);
        }
コード例 #20
0
ファイル: SpeakR.cs プロジェクト: dperish/ScriptCS.SpeakR
 /// <summary>
 /// Selects a voice with specific characteristics.
 /// </summary>
 public void SelectVoiceByHints(VoiceGender gender, VoiceAge age,
                                int voiceAlternate, CultureInfo culture)
 {
     _gender         = gender;
     _age            = age;
     _voiceAlternate = voiceAlternate;
     _culture        = culture;
     SelectVoice();
 }
コード例 #21
0
        public static void SetUp(VoiceGender gender, VoiceAge age)
        {
            //Customise the voice

            //speechSyn.SelectVoice("Vocalizer Expressive Samantha Harpo 22kHz");
            speechSyn.SelectVoiceByHints(gender, age, 0);
            speechSyn.SpeakStarted   += SpeechSyn_SpeakStarted;
            speechSyn.SpeakCompleted += SpeechSyn_SpeakCompleted;
        }
コード例 #22
0
        public static void Speak(VoiceGender gender, string message)
        {
            Synth.SelectVoiceByHints(gender);

            UseGoogle = false; // Google's Text-To-Speech API is unavailable.

            Thread t = new Thread(() => {
                if (UseGoogle == true)
                {
                    string uri =
                        "http://translate.google.com/translate_tts?tl=en&ie=UTF-8&client=t&q=" +
                        System
                        .Web
                        .HttpUtility
                        .UrlEncode(message)
                        .ToString()
                    ;

                    WebClient client = new WebClient();

                    // Send fake request headers for "authentication".
                    client.Headers["Referer"]    = "http://translate.google.com/";
                    client.Headers["User-Agent"] = "stagefright/1.2 (Linux;Android 5.0)";

                    try {
                        client.DownloadFile(uri, TemporaryFile);

                        SoundPlayer sound = new SoundPlayer(TemporaryFile);

                        sound.Play();

                        File.Delete(TemporaryFile);
                    }
                    catch (Exception ex)
                    {
                        UseGoogle = false;

                        System.Windows.Forms.MessageBox.Show(
                            "Turned off Google Text-to-Speech:" + Environment.NewLine +
                            Environment.NewLine +
                            ex.Message + Environment.NewLine +
                            Environment.NewLine +
                            ex.StackTrace
                            );

                        Synth.Speak(message);
                    }
                }
                else
                {
                    Synth.Speak(message);
                }
            });

            t.Start();
        }
コード例 #23
0
 public UserSettings(string username, UserGender usergender, string assistantName = "Tars", VoiceGender voiceGender = VoiceGender.Male, int synthVol = 100, int synthRate = 0)
 {
     Username               = username;
     Gender                 = usergender;
     AssistantName          = assistantName;
     SynthesizerVoiceGender = voiceGender;
     //Movies = moviesFolder;
     SynthesizerVolume = synthVol;
     SynthesizerRate   = synthRate;
 }
コード例 #24
0
 internal VoiceInfo(VoiceGender gender, VoiceAge age, int voiceAlternate)
 {
     if (voiceAlternate < 0)
     {
         throw new ArgumentOutOfRangeException("voiceAlternate", SR.Get(SRID.PromptBuilderInvalidVariant));
     }
     _gender  = gender;
     _age     = age;
     _variant = voiceAlternate + 1;
 }
コード例 #25
0
 public TextToSpeech(string text, VoiceGender voiceGender, VoiceAge voiceAge, int voicePosition, string culture, int volume, int rate)
 {
     Text          = text;
     VoiceGender   = voiceGender;
     VoiceAge      = voiceAge;
     VoicePosition = voicePosition;
     CultureInfo   = culture;
     Volume        = volume;
     Rate          = rate;
 }
コード例 #26
0
ファイル: SpeakInfo.cs プロジェクト: layomia/dotnet_runtime
        internal void SetVoice(string name, CultureInfo culture, VoiceGender gender, VoiceAge age, int variant)
        {
            TTSVoice ttsVoice = _voiceSynthesis.GetEngine(name, culture, gender, age, variant, false);

            if (!ttsVoice.Equals(_ttsVoice))
            {
                _ttsVoice      = ttsVoice;
                _fNotInTextSeg = true;
            }
        }
コード例 #27
0
ファイル: Features.cs プロジェクト: iRaxe/OKTRAIO-Reborn
 /// <summary>
 /// Play a sound using the voice assistant
 /// </summary>
 /// <param name="phrase">What it will say</param>
 /// <param name="gender">What gender</param>
 /// <param name="age">What age</param>
 /// <param name="whichCulture">Which culture to use Ex: en-US,pt-BR and etc</param>
 public static void PlayPhrase(string phrase, VoiceGender gender = VoiceGender.Female,
                               VoiceAge age = VoiceAge.Adult, string whichCulture = "en-US")
 {
     using (var playphrase = new SpeechSynthesizer())
     {
         playphrase.SelectVoiceByHints(gender, age, -2, new CultureInfo(whichCulture));
         playphrase.SetOutputToDefaultAudioDevice();
         playphrase.Speak(phrase);
     }
 }
コード例 #28
0
ファイル: TextToSpeech.cs プロジェクト: neowutran/ShinraMeter
 public TextToSpeech(string text, VoiceGender voiceGender, VoiceAge voiceAge, int voicePosition, string culture, int volume, int rate )
 {
     Text = text;
     VoiceGender = voiceGender;
     VoiceAge = voiceAge;
     VoicePosition = voicePosition;
     CultureInfo = culture;
     Volume = volume;
     Rate = rate;
 }
コード例 #29
0
ファイル: VowelConverter.cs プロジェクト: mrsagile/Sagen
        public static void GetFormants(VoiceGender gender, double height, double backness, double roundedness, ref double f1, ref double f2, ref double f3)
        {
            var vowels = gender == VoiceGender.Child ? _vowelsChild : _vowelsAdult;

            if (_weightBuffer == null)
            {
                _weightBuffer = new double[_vowelsAdult.Length];
            }
            f1 = f2 = f3 = 0.0;
            double distSum   = 0.0;
            double minDist   = -1.0;
            double weightSum = 0.0;
            double dist      = 0.0;
            double weight;
            double h, b, r;

            // Calculate the sum of the distances between the input point and all the prism's reference points
            for (int i = 0; i < vowels.Length; i++)
            {
                h = height - vowels[i].Height;
                b = backness - vowels[i].Backness;
                r = roundedness - vowels[i].Roundedness;
                _weightBuffer[i] = dist = Math.Sqrt(h * h + b * b + r * r);
                if (dist <= 0.0)
                {
                    f1 = vowels[i].F1;
                    f2 = vowels[i].F2;
                    f3 = vowels[i].F3;
                    return;
                }
                distSum += dist;
                if (minDist < 0 || dist < minDist)
                {
                    minDist = dist;
                }
            }

            // Calculate secondary weight sum
            // Buffer contains distances
            for (int i = 0; i < vowels.Length; i++)
            {
                dist       = _weightBuffer[i];
                weightSum += _weightBuffer[i] = (1.0 - dist / distSum) / Math.Pow(4.5, dist / minDist);
            }

            // Calculate weights
            // Buffer contains secondary weights
            for (int i = 0; i < vowels.Length; i++)
            {
                weight = _weightBuffer[i] / weightSum;
                f1    += weight * vowels[i].F1;
                f2    += weight * vowels[i].F2;
                f3    += weight * vowels[i].F3;
            }
        }
コード例 #30
0
        public static void Speak(String message, VoiceGender gender = VoiceGender.Male, int age = 30)
        {
            // Initialize a new instance of the SpeechSynthesizer.
            SpeechSynthesizer synth = new SpeechSynthesizer();

            synth.SelectVoiceByHints(gender, DetermineAge(age));
            // Configure the audio output.
            synth.SetOutputToDefaultAudioDevice();
            // Speak a string.
            synth.SpeakAsync(message);
        }
コード例 #31
0
ファイル: MeowFile.cs プロジェクト: wrociu/Meow
        public void FeedTheCat(bool bReplaceFile)
        {
            var synth = new SpeechSynthesizer();
            //
            var installedVoices = synth.GetInstalledVoices();

            foreach (var voice in installedVoices)
            {
                string      name    = voice.VoiceInfo.Name;
                VoiceGender gender  = voice.VoiceInfo.Gender;
                var         culture = voice.VoiceInfo.Culture;
                LogOperation("SVoice name: " + name);
                LogOperation("culture: " + culture.ToString());
            }
            synth.SelectVoice("Microsoft Zira Desktop");

            //

            int    timeStampIterator = 1;
            int    totalLinesChanged = 0;
            string meowedFile        = this.fileName + ".meowed";


            Regex rgx = new Regex(this.meowPattern);

            string[]     lines  = System.IO.File.ReadAllLines(this.fileName);
            StreamWriter writer = new StreamWriter(meowedFile);

            LogOperation("Started scanning " + this.fileName);

            synth.SpeakAsync("Started scanning ");

            for (int i = 0; i < lines.Length; i++)
            {
                ApplyLineChanges(ref timeStampIterator, ref totalLinesChanged, rgx, lines, i);

                writer.WriteLine(lines[i]);
            }

            writer.Close();
            LogOperation("Scanning " + this.fileName + " Completed");
            LogOperation(totalLinesChanged.ToString() + " lines changed");
            synth.SpeakAsync(totalLinesChanged.ToString() + " lines changed");

            if (bReplaceFile)
            {
                File.Replace(meowedFile, this.fileName, null);
                LogOperation(this.fileName + " replaced");
            }
            else
            {
                LogOperation(meowedFile + " Created");
            }
        }
コード例 #32
0
        public UWPLocalSpeaker(MediaElement Media, VoiceGender G)
        {
            this.Media = Media;
            var v = (from x in SpeechSynthesizer.AllVoices
                     where (x.Gender == G && x.Language == "ru-RU")
                     select x).FirstOrDefault();

            if (v != null)
            {
                Synthesizer.Voice = v;
            }
        }
コード例 #33
0
ファイル: PlayLineParams.cs プロジェクト: rosebud/mooege
 public void Parse(GameBitBuffer buffer)
 {
     SNOConversation = buffer.ReadInt(32);
     Field1 = buffer.ReadInt(32);
     Field2 = buffer.ReadBool();
     LineID = buffer.ReadInt(32);
     Field4 = buffer.ReadInt(32);
     Field5 = buffer.ReadInt(32);
     Field6 = buffer.ReadInt(32);
     Gender = (VoiceGender)buffer.ReadInt(32);
     VoiceClassID = buffer.ReadInt(32);
     snoSpeakerActor = buffer.ReadInt(32);
     Name = buffer.ReadCharArray(49);
     Field11 = buffer.ReadInt(32);
     Field12 = buffer.ReadInt(32);
     Field13 = buffer.ReadInt(32);
     Field14 = buffer.ReadInt(32);
     Field15 = buffer.ReadInt(32);
 }
コード例 #34
0
ファイル: PlayLineParams.cs プロジェクト: wow4all/mooege
 public void Parse(GameBitBuffer buffer)
 {
     SNOConversation = buffer.ReadInt(32);
     Field1 = buffer.ReadInt(32);
     Field2 = buffer.ReadBool();
     Field3 = buffer.ReadBool();
     LineID = buffer.ReadInt(32);
     Speaker = buffer.ReadInt(32);
     Field5 = buffer.ReadInt(32);
     TextClass = (Class)buffer.ReadInt(32);
     Gender = (VoiceGender)buffer.ReadInt(32);
     AudioClass = (Class)buffer.ReadInt(32);
     SNOSpeakerActor = buffer.ReadInt(32);
     Name = buffer.ReadCharArray(49);
     Field11 = buffer.ReadInt(32);
     AnimationTag = buffer.ReadInt(32);
     Duration = buffer.ReadInt(32);
     Field14 = buffer.ReadInt(32);
     Field15 = buffer.ReadInt(32);
 }
コード例 #35
0
 public L2FVoice(string name, VoiceGender gender, VoiceAge age, string culture, L2FSpeechEngine engine)
     : base(engine)
 {
     Name = name;
     Gender = gender;
     Age = age;
     Culture = culture;
 }
コード例 #36
0
ファイル: Startup.cs プロジェクト: MrPlayer141/Jarvis
 /// <summary>
 /// Speaks with a selected voice at a selected speed
 /// </summary>
 /// <param name="message"></param>
 /// <param name="voiceGender"></param>
 /// <param name="rate"></param>
 public static void JarvisSpeak(string message, VoiceGender voiceGender, int rate)
 {
     synth.Rate = rate;
     JarvisSpeak(message, voiceGender);
 }
コード例 #37
0
ファイル: Startup.cs プロジェクト: MrPlayer141/Jarvis
        bool IDE = true; //Settings.SettingsJarvis.Default.fastStart;

        #endregion Fields

        #region Methods

        /// <summary>
        /// Speaks with a selected voice
        /// </summary>
        /// <param name="message"></param>
        /// <param name="voiceGender"></param>
        public static void JarvisSpeak(string message, VoiceGender voiceGender)
        {
            synth.SelectVoiceByHints(voiceGender);
            synth.Speak(message);
        }
コード例 #38
0
		private async Task SpeakAsync(string text, VoiceGender gender, bool waitUntilCompleted)
		{
			this.speaker.SetVoice( gender );
			SpeechSynthesisStream stream = await this.speaker.SynthesizeText( text );
			this.mediaElement.SetSource( stream, stream.ContentType );

			if( waitUntilCompleted )
			{
				TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
				this.mediaElement.MediaEnded += ( sender, args ) =>
				{
					tcs.TrySetResult( true );
				};
				this.mediaElement.Play();

				await tcs.Task;
			}
			else
			{
				this.mediaElement.Play();
			}
		}
コード例 #39
0
 private bool ConvertWithSystemSpeech(string FileContent, string voiceName, VoiceGender gender,CultureInfo ci,int rate, string tempfile)
 {
     Console.WriteLine("Converting with: System Speech");
     try
     {
         EncodingFormat eformat = EncodingFormat.Pcm;
         var speech = new SpeechSynthesizer();
         var installedVoices = speech.GetInstalledVoices();
         VoiceInfo selectedVoice = null;
         foreach (var voice in installedVoices)
         {
             if (voice.VoiceInfo.Name == voiceName)
             {
                 selectedVoice = voice.VoiceInfo;
                 break;
             }
             else if (voice.VoiceInfo.Culture == ci)
             {
                 if (voice.VoiceInfo.Gender == gender)
                 {
                     selectedVoice = voice.VoiceInfo;
                     break;
                 }
             }
         }
         speech.SelectVoice(selectedVoice.Name);
         var safi = new SpeechAudioFormatInfo(eformat, 22000, 16, 1, 22000 * 4, 4, null);
         speech.SetOutputToWaveFile(tempfile, safi);
         speech.Speak(FileContent);
         speech.SetOutputToNull();
         return true;
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return false;
     }
 }
コード例 #40
0
 private bool isVoiceInstalled(CultureInfo ci, VoiceGender gender, string voiceName)
 {
     bool result = false;
     try
     {
         var speech = new SpeechSynthesizer();
         var installedVoices = speech.GetInstalledVoices();
         VoiceInfo selectedVoice = null;
         foreach (var voice in installedVoices)
         {
             if (voice.VoiceInfo.Name == voiceName)
             {
                 result = true;
                 selectedVoice = voice.VoiceInfo;
                 break;
             }
             else if (voice.VoiceInfo.Culture == ci)
             {
                 if (voice.VoiceInfo.Gender == gender)
                 {
                     result = true;
                     selectedVoice = voice.VoiceInfo;
                     break;
                 }
             }
         }
         //comment the below condition to include default Microsoft installed voices
         if (selectedVoice != null)
             if (result && selectedVoice.Name.StartsWith("Microsoft", StringComparison.InvariantCultureIgnoreCase))
             {
                 result = false;
             }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return true;
     }
     return result;
 }
コード例 #41
0
ファイル: Speaker.cs プロジェクト: SarthakYadav/Project-Voix
 private static void DataStore_VoiceGenderChanged(VoiceGender voiceGender)
 {
     //handler for the VoiceGenderChanged Event
     mainSynthesizer.SelectVoiceByHints(voiceGender);
 }
コード例 #42
0
 /// <summary>
 /// Sets the current voice to one based on the <paramref name="gender"/> and <paramref name="age"/>.
 /// </summary>
 /// <param name="gender">The gender of the voice to change to.</param>
 /// <param name="age">The age of the voice.</param>
 public override void SelectVoiceByHints(VoiceGender gender, VoiceAge age)
 {
     this.speechSynthesizer.SelectVoiceByHints(gender, age);
 }
コード例 #43
0
 /// <summary>
 /// Sets the current voice to one based on the <paramref name="gender"/>, <paramref name="age"/>, <paramref name="voiceAlternate"/> and <paramref name="culture"/>.
 /// </summary>
 /// <param name="gender">The gender of the voice to change to.</param>
 /// <param name="age">The age of the voice.</param>
 /// <param name="voiceAlternate">The voice alternate.</param>
 /// <param name="culture">The specific culture to select a voice for.</param>
 public override void SelectVoiceByHints(VoiceGender gender, VoiceAge age, int voiceAlternate, CultureInfo culture)
 {
     this.speechSynthesizer.SelectVoiceByHints(gender, age, voiceAlternate, culture);
 }
コード例 #44
0
 public void SetVoice( VoiceGender gender )
 {
     this.synthesizer.Voice = SpeechSynthesizer.AllVoices.First( v => v.Gender == gender );
 }
コード例 #45
0
ファイル: Speech.cs プロジェクト: ktos/sayanything
 public static IAsyncAction Say(string text, string language, VoiceGender gender)
 {
     var text2speech = new SpeechSynthesizer();
     var ssml = string.Format("<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\" xml:lang=\"{0}\"><voice gender=\"{1}\">{2}</voice></speak>", language, gender.ToString().ToLower(), text);
     return text2speech.SpeakSsmlAsync(ssml);
 }
コード例 #46
0
ファイル: SpeechSynthesizerBase.cs プロジェクト: Mikasa/VICI
 /// <summary>
 /// Sets the current voice to one based on the <paramref name="gender"/>, <paramref name="age"/>, <paramref name="voiceAlternate"/> and <paramref name="culture"/>.
 /// </summary>
 /// <param name="gender">The gender of the voice to change to.</param>
 /// <param name="age">The age of the voice.</param>
 /// <param name="voiceAlternate">The voice alternate.</param>
 /// <param name="culture">The specific culture to select a voice for.</param>
 public virtual void SelectVoiceByHints(VoiceGender gender, VoiceAge age, int voiceAlternate, CultureInfo culture)
 {
     throw new NotImplementedException();
 }
コード例 #47
0
ファイル: SpeechSynthesizerBase.cs プロジェクト: Mikasa/VICI
 /// <summary>
 /// Sets the current voice to one based on the <paramref name="gender"/> and <paramref name="age"/>.
 /// </summary>
 /// <param name="gender">The gender of the voice to change to.</param>
 /// <param name="age">The age of the voice.</param>
 public virtual void SelectVoiceByHints(VoiceGender gender, VoiceAge age)
 {
     throw new NotImplementedException();
 }