コード例 #1
0
    void Start()
    {
        _voiceProcessor = VoiceProcessor.Instance;
        _voiceProcessor.OnFrameCaptured += AnalyzeMicSignal;

        _videoPlayer = gameObject.GetComponentInChildren<VideoPlayer>();
        
        MeshRenderer[] meshes = gameObject.GetComponentsInChildren<MeshRenderer>();
        _border = meshes.First(x=>x.name == "Border");
        _screenOverlay = meshes.First(x => x.name == "ScreenOverlay");

        Component[] objs = gameObject.GetComponentsInChildren<Component>();
        _timeline = objs.First(x => x.name == "TimelinePivot");        
        _timelineFull = objs.First(x => x.name == "TimelineFullPivot");
        _timeline.transform.localScale = new Vector3(0, 0.2f, 1);
        _timelineFull.transform.localScale = new Vector3(1, 0.2f, 1);

        _volume = objs.First(x => x.name == "VolumePivot");
        _volumeFull = objs.First(x => x.name == "VolumeFullPivot");
        _volume.transform.localScale = new Vector3(1, 0, 1);
        _volumeFull.transform.localScale = new Vector3(1, 0, 1);

        _stateIcons = gameObject.GetComponentsInChildren<SpriteRenderer>().ToDictionary(x => x.name);
        _playbackSpeedText = gameObject.GetComponentsInChildren<TextMeshPro>().First(x=>x.name == "PlaybackSpeed");
        _notificationText = gameObject.GetComponentsInChildren<Text>().First(x => x.name == "NotificationText");
        _notificationText.text = "Say 'Porcupine, what can I say?' for help";
        _notificationPanel = gameObject.GetComponentsInChildren<Image>().First(x => x.name == "NotificationPanel");

        _helpCanvas = gameObject.GetComponentsInChildren<Canvas>().First(x => x.name == "HelpCanvas");        
        _picovoiceManager = new PicovoiceManager(_keywordPath, OnWakeWordDetected, _contextPath, OnInferenceResult);        
        
        StartCoroutine(FadeIntroNotification());
    }
コード例 #2
0
    public string voiceCommand2 = "uno";  //"izquierda";

    // Start is called before the first frame update
    void Start()
    {
        VoiceProcessor commandProcessor = GameObject.FindObjectOfType <VoiceProcessor>();

        commandProcessor.onVoiceCommandRecognized += OnVoiceCommandRecognized;
        controller = GetComponent <CharacterController>();
    }
コード例 #3
0
        // private constructor
        private PicovoiceManager(Picovoice picovoice, Action <Exception> errorCallback = null)
        {
            _picovoice     = picovoice;
            _errorCallback = errorCallback;

            _voiceProcessor = VoiceProcessor.Instance;
            _voiceProcessor.OnFrameCaptured += OnFrameCaptured;
        }
コード例 #4
0
ファイル: RhinoManager.cs プロジェクト: yyht/rhino
        // private constructor
        private RhinoManager(Rhino rhino, Action <Inference> inferenceCallback, Action <Exception> errorCallback = null)
        {
            _rhino             = rhino;
            _inferenceCallback = inferenceCallback;
            _errorCallback     = errorCallback;

            _voiceProcessor = VoiceProcessor.Instance;
            _voiceProcessor.OnFrameCaptured += OnFrameCaptured;
        }
コード例 #5
0
ファイル: PorcupineManager.cs プロジェクト: xzw168/porcupine
        // private constructor
        private PorcupineManager(Porcupine porcupine, Action <int> wakeWordCallback, Action <Exception> errorCallback = null)
        {
            _porcupine        = porcupine;
            _wakeWordCallback = wakeWordCallback;
            _errorCallback    = errorCallback;

            _voiceProcessor = VoiceProcessor.Instance;
            _voiceProcessor.OnFrameCaptured += OnFrameCaptured;
        }
コード例 #6
0
    void Start()
    {
        _scriptManager   = FindObjectOfType <ScriptManager> ();
        _scriptReader    = FindObjectOfType <ScriptReader> ();
        _voiceProcessor  = FindObjectOfType <VoiceProcessor> ();
        _director        = FindObjectOfType <Director> ();
        _player          = FindObjectOfType <Player> ();
        _responseChecker = FindObjectOfType <ScriptResponseChecker> ();
        _scoreManager    = FindObjectOfType <ScoreManager> ();

        _scriptManager.LoadScript(SelectedScriptIndex);
    }
コード例 #7
0
ファイル: ScriptReader.cs プロジェクト: lalaladida/Drama-Club
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        _dataController = FindObjectOfType <DataController> ();
        _voiceProcessor = FindObjectOfType <VoiceProcessor> ();

        CredentialData    serviceCredentials     = _dataController.GetServiceCredentials();
        ServiceCredential textToSpeechCredential = serviceCredentials.textToSpeechCredential;

        Credentials credentials = new Credentials(textToSpeechCredential.username, textToSpeechCredential.password, textToSpeechCredential.url);

        _textToSpeech = new TextToSpeech(credentials);
    }
コード例 #8
0
        /// <summary>
        /// PicovoiceManager constructor
        /// </summary>
        /// <param name="keywordPath">Absolute path to Porcupine's keyword model file.</param>
        /// <param name="wakeWordCallback">
        /// User-defined callback invoked upon detection of the wake phrase.
        /// The callback accepts no input arguments.
        /// </param>
        /// <param name="contextPath">
        /// Absolute path to file containing context parameters. A context represents the set of
        /// expressions(spoken commands), intents, and intent arguments(slots) within a domain of interest.
        /// </param>
        /// <param name="inferenceCallback">
        /// User-defined callback invoked upon completion of intent inference. The callback
        /// accepts a single input argument of type `Map<String, dynamic>` that is populated with the following items:
        /// (1) IsUnderstood: whether Rhino understood what it heard based on the context
        /// (2) Intent: if isUnderstood, name of intent that were inferred
        /// (3) Slots: if isUnderstood, dictionary of slot keys and values that were inferred
        /// </param>
        /// <param name="porcupineModelPath">Absolute path to the file containing Porcupine's model parameters.</param>
        /// <param name="porcupineSensitivity">
        /// Wake word detection sensitivity. It should be a number within [0, 1]. A higher
        /// sensitivity results in fewer misses at the cost of increasing the false alarm rate.
        /// </param>
        /// <param name="rhinoModelPath">Absolute path to the file containing Rhino's model parameters.</param>
        /// <param name="rhinoSensitivity">
        /// Inference sensitivity. It should be a number within [0, 1]. A higher sensitivity value
        /// results in fewer misses at the cost of(potentially) increasing the erroneous inference rate.
        /// </returns>
        /// <param name="errorCallback">Callback that triggers is the engine experiences a problem while processing audio.</param>
        /// <returns>An instance of PicovoiceManager.</returns>
        public PicovoiceManager(string keywordPath, Action wakeWordCallback,
                                string contextPath, Action <Inference> inferenceCallback,
                                string porcupineModelPath        = null, float porcupineSensitivity = 0.5f,
                                string rhinoModelPath            = null, float rhinoSensitivity     = 0.5f,
                                Action <Exception> errorCallback = null)
        {
            _keywordPath          = keywordPath;
            _wakeWordCallback     = wakeWordCallback;
            _contextPath          = contextPath;
            _inferenceCallback    = inferenceCallback;
            _porcupineModelPath   = porcupineModelPath;
            _porcupineSensitivity = porcupineSensitivity;
            _rhinoModelPath       = rhinoModelPath;
            _rhinoSensitivity     = rhinoSensitivity;
            _errorCallback        = errorCallback;

            _voiceProcessor = VoiceProcessor.Instance;
        }
コード例 #9
0
ファイル: RhinoManager.cs プロジェクト: yyht/rhino
        /// <summary>
        /// Free resources that were allocated to Porcupine and the voice processor
        /// </summary>
        public void Delete()
        {
            if (_voiceProcessor != null)
            {
                if (_voiceProcessor.IsRecording)
                {
                    _voiceProcessor.StopRecording();
                }

                _voiceProcessor.OnFrameCaptured -= OnFrameCaptured;
                _voiceProcessor = null;
            }

            if (_rhino != null)
            {
                _rhino.Dispose();
                _rhino = null;
            }
        }
コード例 #10
0
        /// <summary>
        /// Free resources that were allocated to Porcupine and the voice processor
        /// </summary>
        public void Delete()
        {
            if (_voiceProcessor != null)
            {
                if (_voiceProcessor.IsRecording)
                {
                    _voiceProcessor.StopRecording();
                }

                _voiceProcessor.OnFrameCaptured -= OnFrameCaptured;
                _voiceProcessor = null;
            }

            if (_picovoice != null)
            {
                _picovoice.Dispose();
                _picovoice = null;
            }
        }