Skip to content

Function: pcmToMonoFloat32() ​

ts
function pcmToMonoFloat32(samples, channels): Float32Array;

Convert an interleaved Int16 PCM block into a mono Float32 array in [-1, 1]. Pass the channel count from the onPcmChunk event.

For 2-channel input, this averages each L/R pair into a single mono sample, which is what most VAD / STT models expect.

Parameters ​

ParameterType
samplesInt16Array
channelsnumber

Returns ​

Float32Array

Released under the MIT License.