Example #1
0
 void OnSpeechToTextResults(LexiconSpeechResult speechResult)
 {
     if (speechResult.IsFinal)
     {
         Debug.Log("Speech Transcript: " + speechResult.Transcript);
     }
 }
Example #2
0
        void OnSpeechToTextResult(LexiconSpeechResult speechResult)
        {
            foreach (GameObject markerObject in markers)
            {
                Destroy(markerObject);
            }
            markers.Clear();

            foreach (LexiconSpeechResult.WordResult wordResult in speechResult.WordResults)
            {
                if (positionEntity.FindValueByName(wordResult.Word, true) != null)
                {
                    FocusPosition focusPosition = focusManager.GetFocusData <FocusPosition>(wordResult.RealtimeStart);
                    if (focusPosition != null)
                    {
                        GameObject markerObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                        markerObject.transform.position   = focusPosition.Position;
                        markerObject.transform.localScale = new Vector3(markerScale, markerScale, markerScale);
                        markerObject.transform.parent     = this.transform;
                        markerObject.GetComponent <Renderer>().material      = markerMaterial;
                        markerObject.GetComponent <SphereCollider>().enabled = false;
                        markers.Add(markerObject);
                    }
                }
            }
        }
Example #3
0
 void OnSpeechToTextResult(LexiconSpeechResult speechResult)
 {
     foreach (LexiconSpeechResult.WordResult wordResult in speechResult.WordResults)
     {
         if (selectionEntity.FindValueByName(wordResult.Word, true) != null)
         {
             FocusSelection focusSelection = focusManager.GetFocusData <FocusSelection>(wordResult.RealtimeStart);
             if (focusSelection != null)
             {
                 LexiconSelectable selectable = focusSelection.SelectedObject.GetComponent <LexiconSelectable>();
                 selectable.Select();
                 selectedObjects.Add(selectable);
             }
         }
     }
 }
        void OnSpeechToTextResult(LexiconSpeechResult speechResult)
        {
            foreach (GameObject labelObject in labels)
            {
                Destroy(labelObject);
            }
            labels.Clear();

            foreach (GameObject markerObject in markers)
            {
                Destroy(markerObject);
            }
            markers.Clear();

            foreach (LexiconSpeechResult.WordResult wordResult in speechResult.WordResults)
            {
                FocusPosition focusPosition = focusManager.GetFocusData <FocusPosition>(wordResult.RealtimeStart);
                //DwellPosition dwellPosition = focusManager.GetFocusData<DwellPosition>(wordResult.realtimeStart);
                if (focusPosition != null)
                {
                    GameObject labelObject = new GameObject("WordAlignmentLabel");
                    labelObject.transform.position   = focusPosition.Position;
                    labelObject.transform.localScale = new Vector3(labelScale, labelScale, labelScale);
                    labelObject.transform.parent     = this.transform;
                    TextMesh textMesh = labelObject.AddComponent <TextMesh>();
                    textMesh.text     = wordResult.Word;
                    textMesh.color    = labelColor;
                    textMesh.font     = labelFont;
                    textMesh.fontSize = labelFontSize;
                    textMesh.GetComponent <Renderer>().sharedMaterial = labelFont.material;
                    labels.Add(labelObject);

                    GameObject markerObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                    markerObject.transform.position   = focusPosition.Position;
                    markerObject.transform.localScale = new Vector3(markerScale, markerScale, markerScale);
                    markerObject.transform.parent     = this.transform;
                    markerObject.GetComponent <Renderer>().material = markerMaterial;
                    markerObject.GetComponent <Collider>().enabled  = false;
                    markers.Add(markerObject);
                }
            }
        }
 void OnSpeechToTextResults(LexiconSpeechResult speechResult)
 {
     outputText.text = speechResult.Transcript;
 }