Class SpeechRecorder
Inheritance
object
SpeechRecorder
Assembly: .dll
Syntax
public class SpeechRecorder : MonoBehaviour
Fields
microphone
Declaration
protected string microphone
Field Value
recordingDuration
Declaration
[Range]
protected int recordingDuration
Field Value
Properties
IsRecording
Whether the recorder is currently recording audio.
This property will return true if the recorder is actively recording audio from the microphone.
Declaration
public bool IsRecording { get; }
Property Value
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.
Declaration
public KeyCodeTrigger KeyCodeTrigger { get; }
Property Value
Type |
Description |
KeyCodeTrigger |
|
Microphone
The ID or name of the microphone device to use for recording.
If not set, the default microphone will be used.
Declaration
public string Microphone { get; set; }
Property Value
Recorder
Declaration
public RealtimeAudioRecorder Recorder { get; }
Property Value
Type |
Description |
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.
Declaration
public int RecordingDuration { get; set; }
Property Value
RecordingTrigger
Declaration
public RecordingTriggerType RecordingTrigger { get; set; }
Property Value
Type |
Description |
RecordingTriggerType |
|
VoiceDetectionSettings
Declaration
public VoiceDetectionTrigger VoiceDetectionSettings { get; }
Property Value
Type |
Description |
VoiceDetectionTrigger |
|
Methods
Initialize(AIComponent, IDebugLogger)
Declaration
public void Initialize(AIComponent aiComponent, IDebugLogger logger)
Parameters
Type |
Name |
Description |
AIComponent |
aiComponent |
|
IDebugLogger |
logger |
|
IsRecordingBlocked()
Declaration
protected virtual bool IsRecordingBlocked()
Returns
StartRecording()
Start recording audio from the microphone
Declaration
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.
Declaration
public UniTask<AudioClip> StopRecordingAsync()
Returns
Type |
Description |
UniTask<AudioClip> |
|