API reference

AudioResampler Class

A script that handles upsampling or downsampling audio input. It also determines samplerate if needed.

Constructors

AudioResampler ()
Signature
Meta.WitAi.Data.AudioResampler.AudioResampler()

Events

OnByteResampled : Action< byte >
Event callback for sample individual byte enqueueing
Signature
Action<byte> Meta.WitAi.Data.AudioResampler.OnByteResampled
OnLevelChanged : Action< float, float >
Event callback for min/max level change
Signature
Action<float, float> Meta.WitAi.Data.AudioResampler.OnLevelChanged
OnResampled : Action< float >
Event callback for sample enqueueing
Signature
Action<float> Meta.WitAi.Data.AudioResampler.OnResampled

Methods

Resample ( fromEncoding , fromMinLevel , fromMaxLevel , toEncoding , samples , offset , length , enqueueBytes , variableSampleRate )
Resamples input samples into the desired output encoding
Signature
Vector2 Meta.WitAi.Data.AudioResampler.Resample(AudioEncoding fromEncoding, float fromMinLevel, float fromMaxLevel, AudioEncoding toEncoding, float[] samples, int offset, int length, bool enqueueBytes, IAudioVariableSampleRate variableSampleRate=null)
Parameters
fromEncoding: AudioEncoding  Source encoding of incoming audio data
fromMinLevel: float  Min audio threshold expected, used to normalize level
fromMaxLevel: float  Max audio threshold expected, used to normalize level
toEncoding: AudioEncoding  Desired output encoding
samples: float []  Incoming data samples
offset: int  Offset of the sample array
length: int  Length of sample array to be used
enqueueBytes: bool  Whether we need to enqueue each byte
variableSampleRate: IAudioVariableSampleRate  Used for scripts with custom sample rate
Returns
Vector2  Returns the min/max of the sample in Vector2