API reference

AudioBuffer Class

Extends MonoBehaviour
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.

Fields

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

Static Fields

AudioBufferProvider : IAudioBufferProvider
A script that will instantiate an audio buffer if needed
Signature
IAudioBufferProvider Meta.WitAi.Data.AudioBuffer.AudioBufferProvider
HasInstance : bool
Check if an instance currently exists, for situations where it wouldn't be appropriate to create a new one.
Signature
bool Meta.WitAi.Data.AudioBuffer.HasInstance
instantiateMic : bool
Determines if the AudioBuffer will attempt to automatically instantiate a mic object if it can't find one when the AudioBuffer object is first enabled.
Signature
bool Meta.WitAi.Data.AudioBuffer.instantiateMic

Properties

_log : IVLogger
[Get]
Signature
IVLogger Meta.WitAi.Data.AudioBuffer._log
[Get]
Returns true if a component has requested audio but
Signature
VoiceAudioInputState Meta.WitAi.Data.AudioBuffer.AudioState
Instance : AudioBuffer
[Get]
Signature
AudioBuffer Meta.WitAi.Data.AudioBuffer.Instance
[Get][Set]
The current audio input source
Signature
virtual IAudioInputSource Meta.WitAi.Data.AudioBuffer.MicInput
MicMaxLevel : float
[Get]
Current max audio level, defaults to -1 when off
Signature
float Meta.WitAi.Data.AudioBuffer.MicMaxLevel
SecondsToSkipSilence : float
[Get][Set]
Signature
float Meta.WitAi.Data.AudioBuffer.SecondsToSkipSilence

Methods

CreateMarker ()
Create a marker at the current audio input time.
Signature
RingBuffer<byte>.Marker Meta.WitAi.Data.AudioBuffer.CreateMarker()
Returns
RingBuffer< byte >.Marker  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.
CreateMarker ( offset )
Creates a marker with an offset
Signature
RingBuffer<byte>.Marker Meta.WitAi.Data.AudioBuffer.CreateMarker(float offset)
Parameters
offset: float  Number of seconds to offset the marker by
Returns
RingBuffer< byte >.Marker
IsRecording ( component )
Returns true if a component has registered to receive audio data and if the mic is actively capturing data that will be shared
Signature
bool Meta.WitAi.Data.AudioBuffer.IsRecording(Component component)
Parameters
component: Component  The source of the StartRecording
Returns
bool  True if this component has called StartRecording
OnApplicationQuit ()
Signature
void Meta.WitAi.Data.AudioBuffer.OnApplicationQuit()
Returns
void
StartRecording ( 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.
Signature
void Meta.WitAi.Data.AudioBuffer.StartRecording(Component component)
Parameters
component: Component  A component to use as a key that will keep the audio buffer actively recording
Returns
void
StopRecording ( 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.
Signature
void Meta.WitAi.Data.AudioBuffer.StopRecording(Component component)
Parameters
component: Component  The component used to start recording
Returns
void