Class InputAudioRecorder
- Namespace
- Glitch9.AIDevKit.Generators
public class InputAudioRecorder : MonoBehaviour, IInputAudioRecorder
- Inheritance
-
objectInputAudioRecorder
- Implements
Fields
onIsRecordingChanged
public UnityEvent<bool> onIsRecordingChanged
Field Value
- UnityEvent<bool>
onMicrophoneLevelChanged
public UnityEvent<float> onMicrophoneLevelChanged
Field Value
- UnityEvent<float>
onMicrophonePermissionGranted
public UnityEvent<bool> onMicrophonePermissionGranted
Field Value
- UnityEvent<bool>
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
Core audio recorder that handles microphone input and recording logic.
public StreamingAudioRecorder Recorder { get; }
Property Value
- StreamingAudioRecorder
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
Configure(AudioRecorderSettings)
public void Configure(AudioRecorderSettings settings)
Parameters
settingsAudioRecorderSettings
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
RegisterAudioBufferListener(Action<float[]>)
public void RegisterAudioBufferListener(Action<float[]> listener)
Parameters
listenerAction<float[]>
RegisterRecordingStoppedListener(Action<AudioClip>)
public void RegisterRecordingStoppedListener(Action<AudioClip> listener)
Parameters
listenerAction<AudioClip>
StartRecording()
Start recording audio from the microphone
public void StartRecording()
StopRecordingAsync()
Stop recording audio from the microphone and do the post-processing that derived classes need. If the recorder is not currently recording, this method does nothing.
public UniTask<AudioClip> StopRecordingAsync()
Returns
- UniTask<AudioClip>
UnregisterAudioBufferListener(Action<float[]>)
public void UnregisterAudioBufferListener(Action<float[]> listener)
Parameters
listenerAction<float[]>
UnregisterRecordingStoppedListener(Action<AudioClip>)
public void UnregisterRecordingStoppedListener(Action<AudioClip> listener)
Parameters
listenerAction<AudioClip>