示例#1
0
        private void SynthesizeHandler(string contentText)
        {
            string content = contentText;
            var    voice   = _voices.ToList().Find(item => item.name.Contains(voices[0]));

            _currentVoice = voice;
            if (string.IsNullOrEmpty(content) || _currentVoice == null)
            {
                return;
            }

            _gcTextToSpeech.Synthesize(content, new VoiceConfig()
            {
                gender       = _currentVoice.ssmlGender,
                languageCode = _currentVoice.languageCodes[0],
                name         = _currentVoice.name
            }
                                       );
        }
示例#2
0
    public void SynthesizeButtonOnClickHandler(string _content, int voicetype)
    {
        if (!string.IsNullOrEmpty(_content) || _currentVoice != null && voicetype < VoicesList.Count)
        {
            var voice = _voices.ToList().Find(item => item.name.Contains(VoicesList[voicetype].ToString()));
            _currentVoice = voice;

            print("Speaking Content " + _content);
            _gcTextToSpeech.Synthesize(_content, new VoiceConfig()
            {
                gender       = _currentVoice.ssmlGender,
                languageCode = _currentVoice.languageCodes[0],
                name         = _currentVoice.name
            },
                                       ssmlToggle.isOn,
                                       double.Parse("1.0", _provider),
                                       double.Parse("1.0", _provider),
                                       _currentVoice.naturalSampleRateHertz);
        }
    }
示例#3
0
    // speakResponse method plays the synthesized phrase to the user through the audiosource on the bot
    void speakResponse(string response)
    {
        Debug.Log("Assistance response : " + response);

        // Synthesize the bot response to an audio format using the configurations in _currentvoice and _provider
        _gcTextToSpeech.Synthesize(response, new VoiceConfig()
        {
            gender       = _currentVoice.ssmlGender,
            languageCode = _currentVoice.languageCodes[0],
            name         = _currentVoice.name
        },
                                   true,
                                   double.Parse("1.0", _provider),
                                   double.Parse("1.0", _provider),
                                   _currentVoice.naturalSampleRateHertz);

        using (StreamWriter responsesOutput = new StreamWriter(@"Assets/OutputData/responsesLog" + simulationStart + ".txt", true))
        {
            responsesOutput.WriteLine("Response : " + DateTime.Now.ToString("hh:mm tt") + " --> " + response + "\n");
        }
    }
示例#4
0
 public void speakword(string word)
 {
     if (needsIAP)
     {
         if (varmanager.Instance.usepaypal())
         {
             Application.OpenURL("https://nati.games/spellingflea/");
         }
         else
         {
             SceneManager.LoadScene("purchase");
         }
     }
     else
     {
         if (word.Length > 0)
         {
             MC.Synthesize(word, myvoice, false, 1, 1, 44000);
         }
     }
 }