コード例 #1
0
    void Start()
    {
        dicRecognizer = new DictationRecognizer();
        dicRecognizer.InitialSilenceTimeoutSeconds = 10;
        // 確定
        dicRecognizer.DictationResult += (text, confidence) =>
        {
            gameObject.GetComponent <UnityEngine.UI.Text>().text = text;
            GUIUtility.systemCopyBuffer = text;
//			System.Diagnostics.Process.Start(path);
        };
        // 推測
        dicRecognizer.DictationHypothesis += (text) => {
            // 推測時にする処理
        };
        // 停止時
        dicRecognizer.DictationComplete += (completeCause) =>
        {
            // 要因がタイムアウトなら再び起動
            if (completeCause == DictationCompletionCause.TimeoutExceeded)
            {
                dicRecognizer.Start();
            }
        };
        dicRecognizer.Start();
    }
コード例 #2
0
    /// <summary>
    /// Called when the game is started. <para/>
    /// We setup the voice recog
    ///
    /// preconditions: Language Engine exists.
    ///
    /// postconditions: dictationRecognizer is setup.
    /// </summary>
    private void Start()
    {
        Debug.Log(string.Format("SpeechToText::Start"));

        // create the DictationRecognizer, it will start recog text from the mic.
        dictationRecognizer = new DictationRecognizer();

        // When speech has been recognized.
        dictationRecognizer.DictationResult += OnDictationResult;

        // make sure to rerun the dictation if it finishes
        dictationRecognizer.DictationComplete += (DictationCompletionCause cause) =>
        {
            Debug.Log("DictationCompletionCause: " + cause);

            if (/*cause != DictationCompletionCause.Canceled && */ cause != DictationCompletionCause.Complete)
            {
                dictationRecognizer.Start();
            }
        };

        // catch errors and debug them.
        dictationRecognizer.DictationError += (string error, int hresult) =>
        {
            Debug.LogError("DictationError: " + error);
        };

        // start it now.
        dictationRecognizer.Start();
    }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     /*_gestureRecognizer = new GestureRecognizer();
     *  _gestureRecognizer.TappedEvent += _gestureRecognizer_TappedEvent;
     *  _gestureRecognizer.StartCapturingGestures(); */
     _dictationRecognizer.Start();
 }
コード例 #4
0
    public void StartSpeech()
    {
        dictationRecogniser.Start();
        Statistics = new SpeechStatistics {
            StartTime = Time.time
        };
        Status = SpeechStatus.Speeking;

        lastWordSaid = Time.time;
    }
コード例 #5
0
    void Start()
    {
        m_DictationRecognizer = new DictationRecognizer();
        m_DictationRecognizer.InitialSilenceTimeoutSeconds = 600;
        m_DictationRecognizer.AutoSilenceTimeoutSeconds    = 600;

        //m_Hypotheses = new Text();
        //m_Recognitions = new Text();
        resultText     = "";
        hypothesisText = "";

        m_DictationRecognizer.DictationResult += (text, confidence) =>
        {
            //Debug.LogFormat("Dictation result: {0}", text);
            // m_Recognitions.text += text + "\n";
            //print("found a result");
            lock (myLock)
            {
                resultText += text + " ";
            }
        };

        m_DictationRecognizer.DictationHypothesis += (text) =>
        {
            //Debug.LogFormat("Dictation hypothesis: {0}", text);
            // m_Hypotheses.text += text;
            print("here");
            lock (myLock)
            {
                hypothesisText = text;
            }
        };

        m_DictationRecognizer.DictationComplete += (completionCause) =>
        {
            //print("in complete");

            /**
             * if (completionCause != DictationCompletionCause.Complete)
             *  print(completionCause);
             */
            //Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause);
            m_DictationRecognizer.Start();
        };

        m_DictationRecognizer.DictationError += (error, hresult) =>
        {
            Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
        };

        m_DictationRecognizer.Start();

        StartCoroutine("CutClips");
    }
コード例 #6
0
    /// <summary>
    /// Turns on the dictation recognizer and begins recording audio from the default microphone.
    /// </summary>
    /// <returns>The audio clip recorded from the microphone.</returns>
    public AudioClip StartRecording()
    {
        PhraseRecognitionSystem.Shutdown();

        dictationRecognizer.Start();

        dictationDisplay.text = "Dictation is starting. It may take time to display your text the first time, but begin speaking now...";

        hasRecordingStarted = true;
        return(Microphone.Start(deviceName, true, messageLength, samplingRate));
    }
コード例 #7
0
    private void DictationRecognizer_DictationError(string error, int hresult)
    {
        Debug.Log("Error: " + error);
        var dictationHandlers = (from i in FindObjectsOfType(typeof(MonoBehaviour))
                                 where i is IMyDictationHandler
                                 select((IMyDictationHandler)i)).ToArray();

        foreach (var i in dictationHandlers)
        {
            i.OnDictationError(error, hresult);
        }
        dictationRecognizer.Start();
    }
コード例 #8
0
ファイル: Speech2Text.cs プロジェクト: hbksaar/Membran
    void onDictationComplete(DictationCompletionCause cause)
    {
        if (cause != DictationCompletionCause.Complete)
        {
            Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", cause);
        }

        if (cause == DictationCompletionCause.TimeoutExceeded)
        {
            dictationRecognizer.Stop();
            dictationRecognizer.Start();
        }
    }
コード例 #9
0
    void Start()
    {
        Debug.Log("start");
        LoadSupportedLanguages();
        //SetTargetLang("chinese simplified");
        //StartCoroutine(TranslateText("Waiting for speech"));
        dictationRecognizer = new DictationRecognizer();

        dictationRecognizer.DictationHypothesis += (text) =>
        {
            Debug.LogFormat("Dictation hypothesis: {0}", text);
            WriteOut(text);
        };


        dictationRecognizer.DictationResult += (text, confidence) =>
        {
            Debug.LogFormat("Dictation result: {0}", text);
            var bits = text.Split(' ');
            if (bits[0] == "translate" && (bits.Length == 3 || bits.Length == 4))
            {
                string name = bits[2];
                if (text.EndsWith("simplified chinese") || text.EndsWith("chinese simplified"))
                {
                    name = "chinese simplified";
                }
                else if (text.EndsWith("traditional chinese") || text.EndsWith("chinese traditional"))
                {
                    name = "chinese traditional";
                }
                SetTargetLang(name);
                return;
            }
            englishS = "english: " + text + ". ";
            WriteOut();
            StartCoroutine(TranslateText(text));
        };

        dictationRecognizer.DictationComplete += (completionCause) =>
        {
            Debug.LogErrorFormat("Dictation completed: {0}.", completionCause);
            dictationRecognizer.Start();
        };

        dictationRecognizer.DictationError += (error, hresult) =>
        {
            Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
        };

        dictationRecognizer.Start();
    }
コード例 #10
0
 public void StartDetection()
 {
     Debug.Log("Starte Dictation Mode");
     //Debug.Log(dictationRecognizer.ToString());
     dictationRecognizer.Start();
     //Debug.Log("Dictation started");
 }
コード例 #11
0
    //public ChatBot bot;

    //SpeechToTextResult m_LastResult;

    void Start()
    {
        m_DictationRecognizer = new DictationRecognizer(ConfidenceLevel.High, DictationTopicConstraint.Dictation);

        m_DictationRecognizer.DictationResult += (text, confidence) =>
        {
            Debug.LogFormat("Dictation result: {0}", text);
            m_Recognitions.text += text + "\n";
            //bot.SendChat(text);
        };

        m_DictationRecognizer.DictationHypothesis += (text) =>
        {
            Debug.LogFormat("Dictation hypothesis: {0}", text);
            m_Hypotheses.text += text + "\n";
        };

        m_DictationRecognizer.DictationComplete += (completionCause) =>
        {
            if (completionCause != DictationCompletionCause.Complete)
            {
                Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause);
            }
        };

        m_DictationRecognizer.DictationError += (error, hresult) =>
        {
            Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
        };

        // m_LastResult = new SpeechToTextResult("", false);
        m_DictationRecognizer.Start();
    }
コード例 #12
0
    private void Start()
    {
        m_DictationRecognizer = new DictationRecognizer();
        m_DictationRecognizer.DictationResult += (text, confidence) =>
        {
            OnSpeechResult?.Invoke(this, text);
        };

        m_DictationRecognizer.DictationHypothesis += (text) =>
        {
            OnSpeechHypothesis?.Invoke(this, text);
        };

        m_DictationRecognizer.DictationComplete += (completionCause) =>
        {
            if (completionCause != DictationCompletionCause.Complete)
            {
                Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause);
            }
        };

        m_DictationRecognizer.DictationError += (error, hresult) =>
        {
            Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
        };

        m_DictationRecognizer.Start();
    }
コード例 #13
0
    void Start()
    {
        if (!m_enableListening)
        {
            return;
        }
        m_DictationRecognizer = new DictationRecognizer();

        m_DictationRecognizer.DictationResult     += VoiceResult;
        m_DictationRecognizer.DictationHypothesis += VoiceHypothesis;

        m_DictationRecognizer.DictationComplete += (completionCause) =>
        {
            if (completionCause != DictationCompletionCause.Complete)
            {
                Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause);
            }
        };

        m_DictationRecognizer.DictationError += (error, hresult) =>
        {
            Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
        };

        m_DictationRecognizer.Start();
    }
コード例 #14
0
    private void Start()
    {
        Advertise("VoicePub", "/hololens/audio/user_transcript", 1, out pub);

        voicebox = gameObject.GetComponent <TextToSpeech>();

        // Activation phrase for dictation
        Keywords.Add("Hello", () =>
        {
            ros.std_msgs.String msg = new ros.std_msgs.String("Hello!");
            if (pub != null)
            {
                pub.SendMessage(msg);
            }
            voicebox.StartSpeaking("Hello");
        });

        Keywords.Add("record this", () =>
        {
            PhraseRecognitionSystem.Shutdown();
            StartBeep.Play();
            dictationRecognizer.Start();
        });

        dictationRecognizer = new DictationRecognizer();
        dictationRecognizer.DictationComplete   += DictationComplete;
        dictationRecognizer.DictationError      += DictationError;
        dictationRecognizer.DictationHypothesis += DictationHypothesis;
        dictationRecognizer.DictationResult     += DictationResult;

        keywordRecognizer = new KeywordRecognizer(Keywords.Keys.ToArray());
        keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized;
        keywordRecognizer.Start();
    }
コード例 #15
0
 /// <summary>
 /// Open for input
 /// </summary>
 public void TurnOn()
 {
     if (recognizer.Status == SpeechSystemStatus.Stopped)
     {
         recognizer.Start();
     }
 }
コード例 #16
0
    void Start()
    {
        //set voice controls to false
        voiceContolsOn = false;

        //disable all panel items to be shown when name is interpreted
        playerName.enabled           = false;
        progressText.enabled         = false;
        loadingimage.enabled         = false;
        loadingimageprogress.enabled = false;

        //initialise name to empty string - reset previous rounds name if present
        PlayerPrefs.SetString("Name", "");

        // Get scripts to access methods.
        startgame = gameObject.GetComponent <StartGame>();
        pause     = GameObject.Find("Main Camera").GetComponent <Pause>();
        options   = GameObject.Find("VikingSoundHorn").GetComponent <Options>();

        // All all voice commands to Dictionary
        AddAllVoiceCommands();

        //set up dictation recogniser to allow user to input name
        dictationRecognizer = new DictationRecognizer();
        //set timeout period for dictation recognizer
        dictationRecognizer.InitialSilenceTimeoutSeconds = 15;
        dictationRecognizer.DictationResult     += DictationRecognizer_DictationResult;
        dictationRecognizer.DictationHypothesis += DictationRecognizer_DictationHypothesis;
        dictationRecognizer.Start();

        //added timeout to dictation for name - after 15 seconds disable and enable voice commands
        Invoke("DicationTimeout", 15);
    }
コード例 #17
0
    public void StartDictation()
    {
        if (PhraseRecognitionSystem.Status != SpeechSystemStatus.Stopped)
        {
            PhraseRecognitionSystem.Shutdown();
        }

        m_DictationRecognizer = new DictationRecognizer();
        m_DictationRecognizer.DictationResult += (string text, ConfidenceLevel confidence) => {
            m_Recognitions.text += text + "\n";
        };
        m_DictationRecognizer.DictationHypothesis += ((string text) => {
            m_Hypotheses.text += text + "\n";
        });
        m_DictationRecognizer.DictationComplete += ((DictationCompletionCause completionCause) => {
            if (completionCause != DictationCompletionCause.Complete)
            {
                Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause);
            }
        });
        m_DictationRecognizer.DictationError += ((string error, int hresult) => {
            Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
        });

        m_DictationRecognizer.Start();
        m_Recognitions.text = "";
        m_Hypotheses.text   = "";
        enableUI("StartDictation");
    }
コード例 #18
0
    /// <summary>
    /// <c>start</c>
    ///
    /// Description: Builds data before game begins for Speech-to-text system
    ///
    /// Pre-condition: None
    ///
    /// Post-condition: set up the data required to run the dictationReconginzer. Once the
    /// dictationReconginzer is up and running we can begin logging what the player says.
    /// only need to set up this content once, so at beginning of play time we will do this.
    /// Once phrase is spoken, we will log it, and then send it to the dialogueTree.
    ///
    /// </summary>
    /// <returns>NULL</returns>
    public void Start()
    {
        dictationRecognizer = new DictationRecognizer();

        // When speech has been recognized.
        dictationRecognizer.DictationResult += (text, confidence) =>
        {
            phraseSpoken = text;
            // Write the text to the log.
            GameObject.FindGameObjectWithTag("Log").GetComponent <LogSystem>().WriteToFile(phraseSpoken);
            this.text.text = phraseSpoken;

            Debug.Log("what is inside the Phrase Spoken:" + phraseSpoken);
            //if (dialogueTree != null)
            //dialogueTree.inTree(phraseSpoken);
        };

        text.gameObject.SetActive(false);

        if (Microphone.devices.Length == 0)
        {
            text.text = "Warning: There are no audio input devices connected!";
            text.gameObject.SetActive(true);
        }

        dictationRecognizer.Start();
    }
コード例 #19
0
    void Start()
    {
        m_DictationRecognizer = new DictationRecognizer();


        m_DictationRecognizer.DictationResult += (text, confidence) =>
        {
            Debug.LogFormat("Dictation result: {0}", text);
            //m_Recognitions.text += text + "\n";
        };

        m_DictationRecognizer.DictationHypothesis += (text) =>
        {
            //Debug.LogFormat("Dictation hypothesis: {0}", text);
            //m_Hypotheses.text += text;
        };

        m_DictationRecognizer.DictationComplete += (completionCause) =>
        {
            if (completionCause != DictationCompletionCause.Complete)
            {
                Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause);
            }
        };

        m_DictationRecognizer.DictationError += (error, hresult) =>
        {
            Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
        };

        m_DictationRecognizer.Start();
    }
コード例 #20
0
 public void StartRecording()
 {
     Debug.Log("START RECORDING DEBUG");
     dictationRecognizer.Start();
     this.text.text = "START!";
     //return Microphone.Start(deviceName, true, messageLength, samplingRate);
 }
コード例 #21
0
    private IEnumerator _toggleDictation(bool state)
    {
        if (state)
        {
            keywordRecognizer.Stop();
            PhraseRecognitionSystem.Shutdown();

            while (PhraseRecognitionSystem.Status == SpeechSystemStatus.Running)
            {
                yield return(null);
            }

            dictationRecognizer.Start();
        }
        else
        {
            dictationRecognizer.Stop();

            while (dictationRecognizer.Status == SpeechSystemStatus.Running)
            {
                yield return(null);
            }

            PhraseRecognitionSystem.Restart();
            keywordRecognizer.Start();
        }
    }
コード例 #22
0
 public IEnumerator StartRecording()
 {
     //Debug.Log("Dictation Start!");
     _dictationRecognizer.Start();
     yield return(null);
     //Debug.Log("Dictation Stop!");
 }
コード例 #23
0
    /// <summary> ############################################################
    /// ---------------------  Dictation Methods below  ----------------------
    /// </summary> ###########################################################
    public void noteTaking()
    {
        // stop keyword recognizer to prevent dictation recognition conflict
        PhraseRecognitionSystem.Shutdown();

        Debug.Log("Shutting down Phrase Recognition");

        dictationRecognizer = new DictationRecognizer();

        dictationRecognizer.InitialSilenceTimeoutSeconds = 6f;
        dictationRecognizer.AutoSilenceTimeoutSeconds    = 6f;

        dictationRecognizer.DictationResult     += dictationRecognizer_DictationResult;
        dictationRecognizer.DictationHypothesis += dictationRecognizer_DictationHypothesis;
        dictationRecognizer.DictationComplete   += dictationRecognizer_DictationComplete;
        dictationRecognizer.DictationError      += dictationRecognizer_DictationError;

        // Used for debugging to show dictation parameters has been activated.
        // So, dictation can be used in App.
        Debug.Log("Initiliazed Dictation Recognizer");

        // Start dictation recogntion
        dictationRecognizer.Start();

        // Change bool to true for dictation control
        IsRunning = true;

        checkDictationOn();

        // Used for debugging to show dictation recognizer has started.
        Debug.Log("Dictation started");
    }
コード例 #24
0
 /// <summary>
 /// Starts the windows speech to text as a streaming service
 /// </summary>
 public override void EnableSpeechToText()
 {
     if (dictationRecognizer.Status != SpeechSystemStatus.Running)
     {
         dictationRecognizer.Start();
     }
 }
コード例 #25
0
ファイル: MicrophoneRecorder.cs プロジェクト: Selbi182/vrshop
    public void StartSpeechToText()
    {
        // Only allow dictation if a microphone is available and attached to the GameObject
        // Don't allow more than one instance
        bool isOkayToRecord = true;

        if (Microphone.devices.Length < 1)
        {
            Debug.LogError("No microphone found!");
            isOkayToRecord = false;
        }
        if (audioListener == null)
        {
            Debug.LogError("No audio listener found!");
            isOkayToRecord = false;
        }
        if (dictationRecognizer == null)
        {
            Debug.LogError("No dictation recognizer found!");
            isOkayToRecord = false;
        }
        if (dictationRecognizer != null && dictationRecognizer.Status.Equals(SpeechSystemStatus.Running))
        {
            Debug.LogWarning("Dictation recognizer is already in use!");
            isOkayToRecord = false;
        }

        // Launch the recognizer
        if (isOkayToRecord)
        {
            ResetResult();
            dictationRecognizer.Start();
        }
    }
コード例 #26
0
    void Start()
    {
        m_DictationRecognizer = new DictationRecognizer();

        m_DictationRecognizer.DictationResult += (text, confidence) =>
        {
            Debug.LogFormat("Dictation result: {0}", text);
            sprachAusgabe.SetWordsToSay(text);
        };

        m_DictationRecognizer.DictationHypothesis += (text) =>
        {
            Debug.LogFormat("Dictation hypothesis: {0}", text);
        };

        m_DictationRecognizer.DictationComplete += (completionCause) =>
        {
            if (completionCause != DictationCompletionCause.Complete)
            {
                Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause);
            }
        };

        m_DictationRecognizer.DictationError += (error, hresult) =>
        {
            Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
        };

        m_DictationRecognizer.Start();
    }
コード例 #27
0
ファイル: QuestionManager.cs プロジェクト: JeriesHG/ITEE-VIIP
    void Start()
    {
        camera      = GameObject.Find("Main Camera");
        videoPlayer = camera.AddComponent <VideoPlayer>();
        audioSource = gameObject.AddComponent <AudioSource>();
        videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
        videoPlayer.renderMode      = UnityEngine.Video.VideoRenderMode.CameraNearPlane;
        videoPlayer.playOnAwake     = false;
        videoPlayer.source          = VideoSource.Url;
        gender = "Male";

        dictationRecognizer = new DictationRecognizer();
        dictationRecognizer.DictationHypothesis += (text) => {
            print(text);
        };

        dictationRecognizer.DictationResult += (text, confidence) => {
            print(text + " - " + confidence);
        };
        dictationRecognizer.Start();

        palabrasClaves   = new string[] { "Historia", "Fundado", "Francia" };
        reconocedorDeVoz = new KeywordRecognizer(palabrasClaves);
        reconocedorDeVoz.OnPhraseRecognized += OnPhraseRecognized;

        reconocedorDeVoz.Start();

        videoPlayer.loopPointReached += CheckOver;
    }
コード例 #28
0
ファイル: MicrophoneManager.cs プロジェクト: rggammon/HoloBot
    /// <summary>
    /// Turns on the dictation recognizer and begins recording audio from the default microphone.
    /// </summary>
    /// <returns>The audio clip recorded from the microphone.</returns>
    public void StartRecording()
    {
        // Start dictationRecognizer
        dictationRecognizer.Start();

        Debug.Log("Dictation Recognizer is now " + ((dictationRecognizer.Status == SpeechSystemStatus.Running) ? "on" : "off"));
    }
コード例 #29
0
    public void Start()
    {
        m_DictationRecognizer = new DictationRecognizer();

        m_DictationRecognizer.DictationResult += (text, confidence) =>
        {
            Debug.LogFormat("Dictation result: {0}", text);
            m_Recognitions.text += text + "\n";
            allspeech           += text + " ";
        };

        m_DictationRecognizer.DictationHypothesis += (text) =>
        {
            Debug.LogFormat("Dictation hypothesis: {0}", text);
            m_Hypotheses.text += text;
        };

        //m_DictationRecognizer.DictationComplete += (completionCause) =>
        //{
        //    if (completionCause != DictationCompletionCause.Complete)
        //        Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause);
        //};

        //m_DictationRecognizer.DictationError += (error, hresult) =>
        //{
        //    Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
        //};
        m_DictationRecognizer.InitialSilenceTimeoutSeconds = 300f;
        m_DictationRecognizer.AutoSilenceTimeoutSeconds    = 300f;
        m_DictationRecognizer.Start();
    }
コード例 #30
0
    public void StartListening()
    {
        Recognizer.DictationResult += (text, confindence) =>
        {
            TextField.text = text;
            //Debug.LogFormat("Dictation result: {0}" + text);
        };

        Recognizer.DictationHypothesis += (text) =>
        {
            Debug.LogFormat("Dictation hypothesis: {0}", text);
        };

        Recognizer.DictationComplete += (completeCause) =>
        {
            if (completeCause != DictationCompletionCause.Complete)
            {
                Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completeCause);
            }
        };

        Recognizer.DictationError += (error, result) =>
        {
            Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, result);
        };

        Recognizer.Start();
    }