static void Main(string[] args) { var suscriptionId = SecretManager.GetSecret("suscriptionId", "YourSuscriptionIdHere"); var region = SecretManager.GetSecret("regionId", "YourRegionHere"); var luisApplicationId = SecretManager.GetSecret("luisApplicationId", "YourLuisApplicationIdHere"); var luisSecretKey = SecretManager.GetSecret("luisKey", "YourSecretKeyHere"); var crmPassword = SecretManager.GetSecret("crmPassword", "YourCrmPasswordHere"); RecognitionManager recManager = new RecognitionManager(suscriptionId, region, "es-es"); speachManager = new SpeechManager(); ConversationManager conversation = new ConversationManager(luisApplicationId, luisSecretKey, crmPassword); conversation.Context.OnMiddleConversationResponse += Context_OnMiddleConversationResponse; conversation.OnProcessedRequest += Conversation_OnProcessedRequest; bool exit = false; while (!exit) { Console.WriteLine("Talk"); string text = recManager.Recognice().Result; Console.WriteLine($"-{text}"); var response = conversation.NewRequest(text); Console.WriteLine($"\t-{response.Text}"); Console.WriteLine($"-{text}"); speachManager.Speak(response.Text); } }
static void mainSpeech_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { if (!mainSpeech.Grammars.Contains(commandsGrammar)) { mainSpeech.LoadGrammar(commandsGrammar); SpeechManager.Speak("Systems online"); return; } var chat = SkypeCommands.Skype.ActiveChats.OfType <IChat>().FirstOrDefault(); if (chat == null) { return; } var commandKv = typeof(VoiceCommands).GetEnumValuesWithDescription <VoiceCommands>() .FirstOrDefault(o => o.Value == e.Result.Text); var command = commandKv.Key; switch (command) { case VoiceCommands.F**k: SpeechManager.Speak("Hey! You should not say f**k!"); break; case VoiceCommands.Exit: mainSpeech.UnloadGrammar(commandsGrammar); SpeechManager.Speak("Systems offline"); break; } }
private void next() { if (currentWordIndex < ((words?.Length ?? 0) - 1)) { currentWordIndex++; applyWord(); lblCountWord.Text = (currentWordIndex + 1).ToString(); speakCurrentWord(); wm.SaveCurrentWordState(words, currentWordIndex, (byte)currentLevel); } else { SpeechManager.Speak("Parabéns!"); switch (currentLevel) { case Level.Easy: loadLevel(Level.Average); break; case Level.Average: loadLevel(Level.Hard); break; } } lblWrite.Text = ""; }
private void OnWriteSetence(string text) { try { this.pbxPencil.AdjustPencilPosition(lblWrite); if (!canCheck) { return; } text = text.ToLower().Trim(); while (text.Contains(" ")) { text = text.Replace(" ", " "); } string syllables = String.Join(" ", AllSyllables[currentIndex]); if (syllables == text) { SpeechManager.Speak("Correto!"); currentIndex++; if (currentIndex > AllSyllables.Count - 1) { currentIndex = 0; } start(); } } catch { return; } }
public void SpeechPlayback() { if (speech.isReady) { string msg = input.text; speech.voiceName = (VoiceName)voicelist.value; speech.Speak(msg); } else { Debug.Log("SpeechManager is not ready. Wait until authentication has completed."); } }
public void SpeechPlayback(string saythis) { if (speech.isReady) { //string msg = input.text; string msg = saythis; //speech.voiceName = (VoiceName)voicelist.value; //speech.VoicePitch = int.Parse(pitch.text); speech.Speak(msg); } else { Debug.Log("SpeechManager is not ready. Wait until authentication has completed."); } }
IEnumerator Speaking() { string word = null; for (int i = 0; i < slots.Count; i++) { if (!slots[i].GetComponentInChildren <PhoneticManager>()) { word += " "; //yield return new WaitForSeconds(.25f); } else { //For Google Translator word += slots[i].GetComponentInChildren <PhoneticManager>().phoneme; //speech.Speak(slots[i].GetComponentInChildren<PhoneticManager>().audioClip); //yield return new WaitForSeconds(slots[i].GetComponentInChildren<PhoneticManager>().audioClip.length/1.5f); } } string url = "https://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=" + word + "&tl=En-gb"; UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.MPEG); yield return(www.Send()); result.text = word; if (!www.isNetworkError) { audioClip = DownloadHandlerAudioClip.GetContent(www); } speech.Speak(audioClip); yield return(new WaitForSeconds(audioClip.length)); result.text = ""; }
//Based on set language, different speech synthesizer are used. public void Speak(string textToSay) { if (texttospeech_enabled) { switch (language) { //use embeded text to speech case Texts.Languages.ENGLISH: if (IsSpeakingOrInQueue()) { StopSpeaking(); } textToSpeechDefault.StartSpeaking(textToSay); break; //use azure's text to speech cloud case Texts.Languages.CZECH: textToSpeechAzure.Speak(textToSay); break; } } Debug.Log(textToSay); }
private static void Context_OnMiddleConversationResponse(object sender, ConversationResponseEventArgs args) { speachManager.Speak(args.Response.Text); }