API reference
API reference
Select your platform
No SDKs available
No versions available

AudioBuffer Class

This class is responsible for managing a shared audio buffer for receiving microphone data. It is used by voice services to grab audio segments from the AudioBuffer's internal ring buffer.
Meta::WitAi::Data::AudioBuffer extends MonoBehaviour.

Overview

Properties

The current audio input source
Returns true if a component has requested audio but
float
Current max audio level, defaults to -1 when off

Data Fields

The audio buffer's encoding settings. Mic.Encoding is re-encoded to match the desired transmission encoding
Events[Get]
Events triggered when AudioBuffer processes and receives audio data.
float
The minimum unsigned frequency handled by the microphone
float
The minimum unsigned frequency handled by the microphone
bool
Returns true if an input audio source (for example Mic) is available

Public Member Functions

void
bool
IsRecording
( Component component )
Returns true if a component has registered to receive audio data and if the mic is actively capturing data that will be shared
void
StartRecording
( Component component )
Adds a component to the active list of recorders. If the AudioBuffer isn't already storing mic data in the ring buffer, it will start to store data in the ring buffer.
void
StopRecording
( Component component )
Releases the recording state on the AudioBuffer for the given component. If no components are holding a lock on the AudioBuffer it will stop populating the ring buffer.
RingBuffer< byte >.Marker
Create a marker at the current audio input time.
RingBuffer< byte >.Marker
CreateMarker
( float offset )
Creates a marker with an offset

Details

Properties

AudioBuffer Meta.WitAi.Data.AudioBuffer.Instance
No description available.
IAudioInputSource Meta.WitAi.Data.AudioBuffer.MicInput
The current audio input source
VoiceAudioInputState Meta.WitAi.Data.AudioBuffer.AudioState
Returns true if a component has requested audio but
float Meta.WitAi.Data.AudioBuffer.MicMaxLevel
Current max audio level, defaults to -1 when off

Fields

AudioEncoding Meta.WitAi.Data.AudioBuffer.AudioEncoding
The audio buffer's encoding settings. Mic.Encoding is re-encoded to match the desired transmission encoding
AudioBufferEvents Meta.WitAi.Data.AudioBuffer.Events
Events triggered when AudioBuffer processes and receives audio data.
float Meta.WitAi.Data.AudioBuffer.MicMinAudioLevel
The minimum unsigned frequency handled by the microphone
float Meta.WitAi.Data.AudioBuffer.MicMaxAudioLevel
The minimum unsigned frequency handled by the microphone
bool Meta.WitAi.Data.AudioBuffer.IsInputAvailable
Returns true if an input audio source (for example Mic) is available

Member Functions

void Meta.WitAi.Data.AudioBuffer.OnApplicationQuit ( )
No description available.
bool Meta.WitAi.Data.AudioBuffer.IsRecording
( Component component )
Returns true if a component has registered to receive audio data and if the mic is actively capturing data that will be shared
Parameters
component
The source of the StartRecording
Returns
True if this component has called StartRecording
void Meta.WitAi.Data.AudioBuffer.StartRecording
( Component component )
Adds a component to the active list of recorders. If the AudioBuffer isn't already storing mic data in the ring buffer, it will start to store data in the ring buffer.
Parameters
component
A component to use as a key that will keep the audio buffer actively recording
void Meta.WitAi.Data.AudioBuffer.StopRecording
( Component component )
Releases the recording state on the AudioBuffer for the given component. If no components are holding a lock on the AudioBuffer it will stop populating the ring buffer.
Parameters
component
The component used to start recording
RingBuffer<byte>.Marker Meta.WitAi.Data.AudioBuffer.CreateMarker ( )
Create a marker at the current audio input time.
Returns
A marker representing a position in the ring buffer that can be read as long as the the ring buffer hasn't wrapped and replaced the start of this marker yet.
RingBuffer<byte>.Marker Meta.WitAi.Data.AudioBuffer.CreateMarker
( float offset )
Creates a marker with an offset
Parameters
offset
Number of seconds to offset the marker by
Did you find this page helpful?
Thumbs up icon
Thumbs down icon