Пример #1
0
//This is related to the Speech to Text
    void Update()
    {
        if (listening)
        {
            //Verify if the 2 condition to stop listening are there
            if (cooldownSTT >= limitSTT && !String.IsNullOrEmpty(savedLineSTT))
            {
                STTstreamer.StopRecording();
                string tempString = lineSTT.Trim(Environment.NewLine.ToCharArray());
                associatedLogControl.LogText(tempString, new Color(252f / 255, 161f / 255, 157f / 255));
                SendLineAssistant(tempString);
                savedLineSTT      = "";
                lineSTT           = "";
                listening         = false;
                finishedListening = true;
            }//Add 1 (time period) if the 2 texts are equal
            if (lineSTT == savedLineSTT)
            {
                cooldownSTT += Time.deltaTime;
            }
            else//Otherwise, reset time and copy the line from the STT to the line saved.
            {
                cooldownSTT  = 0f;
                savedLineSTT = lineSTT;
            }
            if (!STTstreamer.Active && cooldownSTT > 2f)
            {
                STTstreamer = new ExampleStreaming();
                STTstreamer.SetServiceFromWrapper(stt);
                STTstreamer.StartRecording();
                cooldownSTT = 0f;
            }
        }
    }
Пример #2
0
        /// <summary>
        /// Process a LogRecord object.
        /// </summary>
        /// <param name="log">The log record.</param>

        ///
        public void ProcessLog(LogRecord log)
        {
            if (log._level >= Level)
            {
                string logString = string.Format("[{0}][{1}][{2}] {3}",
                                                 log._timeStamp.ToString("MM/dd/yyyy HH:mm:ss"),
                                                 log._subSystem, log._level.ToString(), log._message);

                if (log._level == LogLevel.ERROR || log._level == LogLevel.CRITICAL)
                {
                    UnityEngine.Debug.LogError(logString);
                    ///shubham
                    ExampleStreaming con = GameObject.FindWithTag("controller").GetComponent <ExampleStreaming>();
                    con.Start();
                }
                else if (log._level == LogLevel.WARNING)
                {
                    UnityEngine.Debug.LogWarning(logString);
                }
                else
                {
                    UnityEngine.Debug.Log(logString);
                    if (logString.Contains("Server state is listening"))
                    {
                        messageBehavior      = GameObject.FindWithTag("fps").GetComponent <TextMeshPro>();
                        messageBehavior.text = "Ready";
                    }
                    else
                    {
                        messageBehavior      = GameObject.FindWithTag("fps").GetComponent <TextMeshPro>();
                        messageBehavior.text = "Processing";
                    }
                }
            }
        }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        ExampleStreaming ex = GameObject.FindWithTag("controller").GetComponent <ExampleStreaming>();

        ex.screen1 = GameObject.FindWithTag("screen1o");


        // display.SetSelected(true);
    }
Пример #4
0
    IEnumerator SetUpSpeechToText()
    {
        TokenOptions iamTokenOptions = new TokenOptions()
        {
            IamApiKey = "pS_euGwN75JNCi4nKzd9EKPnkuaWQnY0qVA5v6rAC0cv"
                        //IamApiKey = "liOt3C4cqS86vauIsjDd11uAny_ezrjp2tarts5LYrmi"
        };

        Credentials credentials = new Credentials(iamTokenOptions, "https://gateway-lon.watsonplatform.net/speech-to-text/api");

        while (!credentials.HasIamTokenData())
        {
            yield return(null);
        }

        stt        = new SpeechToTextService(credentials);
        sttStarted = true;
        //Set up the Example Streamer using the created STTAssistant
        STTstreamer = GameObject.FindGameObjectWithTag("Streamer").GetComponent <ExampleStreaming>();
        STTstreamer.SetServiceFromWrapper(stt);
    }
Пример #5
0
    void Awake()
    {
        if (Singleton.singleton == null)
        {
            Singleton.singleton = this;
        }
        else
        {
            Destroy(this);
        }
        DontDestroyOnLoad(this);

        timeT     = GameObject.Find("TimeText").GetComponent <Text> ();
        dateT     = GameObject.Find("DateText").GetComponent <Text> ();
        checkmark = GameObject.Find("Check");
        StartCoroutine(ShowCheck());

        STT = GameObject.Find("STT").GetComponent <ExampleStreaming>();
        BOT = GameObject.Find("BOT").GetComponent <AIMLTestChat> ();
        TTS = GameObject.Find("TTS").GetComponent <ExampleTextToSpeech> ();

        InsertValues();
    }
Пример #6
0
    /// <summary>
    /// Start is called on the frame when a script is enabled just before
    /// any of the Update methods is called the first time.
    /// </summary>
    void Start()
    {
        ExampleStreaming commandProcessor = GameObject.FindObjectOfType <ExampleStreaming>();

        commandProcessor.onVoiceCommandRecognized += OnVoiceCommandRecognized;
    }
Пример #7
0
 private void Start()
 {
     onoffRec = FindObjectOfType <ExampleStreaming>();
 }