Setup Voice Activity Detector
Editor
Add
Voice Activity Detectorcomponent to the scene, enable flagAuto Startand connect language model provider and speech source to it.Test voice activity detector.
Create a script called VoiceActivityDetectorListener.cs.
using UnityEngine; public class VoiceActivityDetectorListener : MonoBehaviour { public void OnSpoke() { Debug.Log("spoke"); } public void OnSilenced() { Debug.Log("silenced"); } }Add the
Voice Activity Detector Listenerscript and connect it to theVoice Activity Detectorevents.
Press Play.

Scripting
using Recognissimo.Components;
using UnityEngine;
public class SpeechSourceExample : MonoBehaviour
{
private void Awake()
{
// Create components.
var vad = gameObject.AddComponent<VoiceActivityDetector>();
var languageModelProvider = gameObject.AddComponent<StreamingAssetsLanguageModelProvider>();
var speechSource = gameObject.AddComponent<MicrophoneSpeechSource>();
// Setup speech source and language model provider as in the previous example.
// ...
// Bind speech processor dependencies.
vad.LanguageModelProvider = languageModelProvider;
vad.SpeechSource = speechSource;
// Setup voice control
vad.TimeoutMs = 200;
vad.Spoke.AddListener(() => Debug.Log("Spoke"));
vad.Silenced.AddListener(() => Debug.Log("Silenced"));
vad.StartProcessing();
}
}