resample

open fun resample(pcm: Array<Byte>, channels: Int, inputSampleRate: Int, outputSampleRate: Int): Array<Byte>

Resample pcm 16 bits little endian (mono or stereo) to the given sample rate. Upsampling interpolates between the 2 nearest frames. Downsampling averages all the frames of each interval to reduce aliasing.

Return

pcm buffer resampled to outputSampleRate

Parameters

pcm

pcm buffer, 16 bits per sample little endian

channels

1 (mono) or 2 (stereo)

inputSampleRate

sample rate of the pcm buffer in Hz

outputSampleRate

desired sample rate in Hz


open fun resample(pcm: Array<Byte>, inputChannels: Int, outputChannels: Int, inputSampleRate: Int, outputSampleRate: Int): Array<Byte>

Resample pcm 16 bits little endian to the given sample rate and convert channels in the same pass. Mono to stereo duplicates the channel, stereo to mono averages both channels. Upsampling interpolates between the 2 nearest frames. Downsampling averages all the frames of each interval to reduce aliasing.

Return

pcm buffer resampled to outputSampleRate with outputChannels channels

Parameters

pcm

pcm buffer, 16 bits per sample little endian

inputChannels

1 (mono) or 2 (stereo)

outputChannels

1 (mono) or 2 (stereo)

inputSampleRate

sample rate of the pcm buffer in Hz

outputSampleRate

desired sample rate in Hz