public void Say(string text)
    {
        VoiceMood vm = GetMoodSource(current_mood).GetComponent <VoiceMood>();

        if (vm != null)
        {
            Speech.instance.QueueMessage(new Speech.IncomingMessage {
                type = Speech.IncomingMessageType.SetVoice, message = vm.voice
            });
            Speech.instance.QueueMessage(new Speech.IncomingMessage {
                type = Speech.IncomingMessageType.SetPitch, param1 = vm.pitch
            });
            Speech.instance.QueueMessage(new Speech.IncomingMessage {
                type = Speech.IncomingMessageType.SetRange, param1 = vm.range
            });
            Speech.instance.QueueMessage(new Speech.IncomingMessage {
                type = Speech.IncomingMessageType.SetRate, param1 = vm.rate
            });
            Speech.instance.QueueMessage(new Speech.IncomingMessage {
                type = Speech.IncomingMessageType.SetWordGap, param1 = vm.wordgap
            });
            Speech.instance.QueueMessage(new Speech.IncomingMessage {
                type = Speech.IncomingMessageType.SetIntonation, param1 = vm.intonation
            });
            //Speech.instance.QueueMessage(new Speech.IncomingMessage{ type = Speech.IncomingMessageType.SetCapitals, param1 = vm.capitals });
        }
        Speech.instance.Say(text, VoiceGeneratedCallback);
    }
Beispiel #2
0
 private void setCurrentVoice(VoicePersona voice)
 {
     currentVoice  = availableVoices.Where(azv => azv.ShortName == voice.VoiceName).FirstOrDefault();
     speed         = voice.Speed;
     semitonePitch = voice.SemitoneAdjust;
     if (voice.Mood != VoiceMood.Unavailable)
     {
         mood = voice.Mood;
     }
 }
Beispiel #3
0
 public VoicePersona(IVoiceProvider provider, string name, int CharLimit, VoiceSex sex, int sampleRate = 16000, VoiceMood voiceMood = VoiceMood.Unavailable)
 {
     VoiceProvider   = provider;
     this.VoiceName  = name;
     this.CharLimit  = CharLimit;
     this.VoiceSex   = sex;
     this.SampleRate = sampleRate;
     SemitoneAdjust  = 0;
     this.Speed      = VoiceSpeed.Normal;
     this.Mood       = voiceMood;
 }