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

AudioDecoderPcm Class

An audio decoder for raw PCM audio data

Constructors

AudioDecoderPcm ( pcmType , sampleBufferLength )
Constructor that allows selection of pcm type
Signature
Meta.Voice.Audio.Decoding.AudioDecoderPcm.AudioDecoderPcm(AudioDecoderPcmType pcmType, int sampleBufferLength=WitConstants.ENDPOINT_TTS_DEFAULT_SAMPLE_LENGTH)
Parameters
sampleBufferLength: int

Fields

PcmType : readonly AudioDecoderPcmType
Signature
readonly AudioDecoderPcmType Meta.Voice.Audio.Decoding.AudioDecoderPcm.PcmType
WillDecodeInBackground : bool
All pcm decoding should occur in background due to large amount of data
Signature
bool Meta.Voice.Audio.Decoding.AudioDecoderPcm.WillDecodeInBackground

Methods

Decode ( buffer , bufferOffset , bufferLength , onSamplesDecoded )
A method for decoded bytes and calling an AddSample delegate for each
Signature
virtual void Meta.Voice.Audio.Decoding.AudioDecoderPcm.Decode(byte[] buffer, int bufferOffset, int bufferLength, AudioSampleDecodeDelegate onSamplesDecoded)
Parameters
buffer: byte []  A buffer of bytes to be decoded into audio sample data
bufferOffset: int  The buffer start offset used for decoding a reused buffer
bufferLength: int  The total number of bytes to be used from the buffer
onSamplesDecoded: AudioSampleDecodeDelegate  Callback following a sample decode
Returns
void

Static Methods

DecodePcm ( rawData , pcmType )
Decodes an array of pcm data
Signature
static float [] Meta.Voice.Audio.Decoding.AudioDecoderPcm.DecodePcm(byte[] rawData, AudioDecoderPcmType pcmType=AudioDecoderPcmType.Int16)
Parameters
rawData: byte []  Raw array of pcm bytes
pcmType: AudioDecoderPcmType  The pcm decode type to be used
Returns
float []
DecodeSample_Pcm16 ( rawData , index )
Decodes an Int16 sample into a float from 0 to 1
Signature
static float Meta.Voice.Audio.Decoding.AudioDecoderPcm.DecodeSample_Pcm16(byte[] rawData, int index)
Parameters
rawData: byte []  Raw data to be decoded into a single sample
index: int  Offset of the data
Returns
float
DecodeSample_Pcm32 ( rawData , index )
Decodes an Int32 sample into a float from 0 to 1
Signature
static float Meta.Voice.Audio.Decoding.AudioDecoderPcm.DecodeSample_Pcm32(byte[] rawData, int index)
Parameters
rawData: byte []  Raw data to be decoded into a single sample
index: int  Offset of the data
Returns
float
DecodeSample_Pcm64 ( rawData , index )
Decodes an Int64 sample into a float from 0 to 1
Signature
static float Meta.Voice.Audio.Decoding.AudioDecoderPcm.DecodeSample_Pcm64(byte[] rawData, int index)
Parameters
rawData: byte []  Raw data to be decoded into a single sample
index: int  Offset of the data
Returns
float
DecodeSample_PcmU16 ( rawData , index )
Decodes an UInt16 sample into a float from 0 to 1
Signature
static float Meta.Voice.Audio.Decoding.AudioDecoderPcm.DecodeSample_PcmU16(byte[] rawData, int index)
Parameters
rawData: byte []  Raw data to be decoded into a single sample
index: int  Offset of the data
Returns
float
DecodeSample_PcmU32 ( rawData , index )
Decodes an UInt32 sample into a float from 0 to 1
Signature
static float Meta.Voice.Audio.Decoding.AudioDecoderPcm.DecodeSample_PcmU32(byte[] rawData, int index)
Parameters
rawData: byte []  Raw data to be decoded into a single sample
index: int  Offset of the data
Returns
float
DecodeSample_PcmU64 ( rawData , index )
Decodes an UInt64 sample into a float from 0 to 1
Signature
static float Meta.Voice.Audio.Decoding.AudioDecoderPcm.DecodeSample_PcmU64(byte[] rawData, int index)
Parameters
rawData: byte []  Raw data to be decoded into a single sample
index: int  Offset of the data
Returns
float
GetByteCount ( pcmType )
Returns total bytes per sample
Signature
static int Meta.Voice.Audio.Decoding.AudioDecoderPcm.GetByteCount(AudioDecoderPcmType pcmType)
Parameters
Returns
int
GetTotalSamplesPcm ( contentLength , pcmType )
Gets pcm sample count from byte content length (1 sample = 2 bytes)
Signature
static long Meta.Voice.Audio.Decoding.AudioDecoderPcm.GetTotalSamplesPcm(long contentLength, AudioDecoderPcmType pcmType=AudioDecoderPcmType.Int16)
Parameters
contentLength: long  The provided number of bytes
Returns
long

Internal Methods

PcmDecodeDelegate ( buffer , bufferOffset )
Decodes a specific buffer index
Signature
delegate float Meta.Voice.Audio.Decoding.AudioDecoderPcm.PcmDecodeDelegate(byte[] buffer, int bufferOffset)
Parameters
buffer: byte []
bufferOffset: int
Returns
delegate float

Internal Static Methods

GetPcmDecoder ( pcmType )
Returns a decode method depending on the pcm type
Signature
static PcmDecodeDelegate Meta.Voice.Audio.Decoding.AudioDecoderPcm.GetPcmDecoder(AudioDecoderPcmType pcmType)
Parameters
Returns
PcmDecodeDelegate