Class SpeechRecorder
- Namespace
- Glitch9.AIDevKit.Components
public class SpeechRecorder : MonoBehaviour
- Inheritance
-
objectSpeechRecorder
Fields
microphone
protected string microphone
Field Value
- string
recordingDuration
[Range]
protected int recordingDuration
Field Value
- int
Properties
IsRecording
Whether the recorder is currently recording audio. This property will return true if the recorder is actively recording audio from the microphone.
public bool IsRecording { get; }
Property Value
- bool
KeyCodeTrigger
Disregard this property if SilenceDetectionEnabled is false. The interval in milliseconds at which the recorder checks for silence. Default is 500ms, you can adjust this value to control how often the recorder checks for silence. A lower value means more frequent checks, but may increase CPU usage.
public KeyCodeTrigger KeyCodeTrigger { get; }
Property Value
- KeyCodeTrigger
Microphone
The ID or name of the microphone device to use for recording. If not set, the default microphone will be used.
public string Microphone { get; set; }
Property Value
- string
Recorder
public RealtimeAudioRecorder Recorder { get; }
Property Value
- RealtimeAudioRecorder
RecordingDuration
The maximum duration of the recording in seconds. Default is 30 seconds, if you need to speak longer, you can increase this value.
public int RecordingDuration { get; set; }
Property Value
- int
RecordingTrigger
public RecordingTriggerType RecordingTrigger { get; set; }
Property Value
- RecordingTriggerType
VoiceDetectionSettings
public VoiceDetectionTrigger VoiceDetectionSettings { get; }
Property Value
- VoiceDetectionTrigger
Methods
Initialize(AIComponent, IDebugLogger)
public void Initialize(AIComponent aiComponent, IDebugLogger logger)
Parameters
aiComponentAIComponentloggerIDebugLogger
IsRecordingBlocked()
protected virtual bool IsRecordingBlocked()
Returns
- bool
StartRecording()
Start recording audio from the microphone
public void StartRecording()
StopRecordingAsync()
Stop recording audio from the microphone and return the recorded audio clip, then do the post-processing that derived classes need. If the recorder is not currently recording, it will return null.
public UniTask<AudioClip> StopRecordingAsync()
Returns
- UniTask<AudioClip>