Table of Contents

Method GetChannel16kSamples

Namespace
LMKit.Media.Audio
Assembly
LM-Kit.NET.dll

GetChannel16kSamples(int, CancellationToken)

Reads and returns normalized samples for a single channel, and resamples to 16 kHz if necessary.

public float[] GetChannel16kSamples(int channelIndex = 0, CancellationToken cancellationToken = default)

Parameters

channelIndex int

Zero-based index of the channel to extract.

cancellationToken CancellationToken

Token to cancel the read operation.

Returns

float[]

Array of floats representing the channel's normalized samples at 16 kHz.

Exceptions

ArgumentOutOfRangeException

Thrown if channelIndex is less than zero or greater than or equal to Channels.

OperationCanceledException

Thrown if the read is cancelled via cancellationToken.

CorruptedAudioException

Thrown if the WAV data chunk ends prematurely.