UNPKG

echogarden

Version:

An easy-to-use speech toolset. Includes tools for synthesis, recognition, alignment, speech translation, language detection, source separation and more.

40 lines 1.76 kB
import * as WaveCodec from '@echogarden/wave-codec'; import { SampleFormat } from '@echogarden/wave-codec'; ///////////////////////////////////////////////////////////////////////////////////////////// // Low level audio sample conversions ///////////////////////////////////////////////////////////////////////////////////////////// export function encodeToAudioBuffer(audioChannels, targetBitDepth = 16, targetSampleFormat = SampleFormat.PCM) { return WaveCodec.float32ChannelsToBuffer(audioChannels, targetBitDepth, targetSampleFormat); } export function decodeToChannels(audioBuffer, channelCount, sourceBitDepth, sourceSampleFormat) { return WaveCodec.bufferToFloat32Channels(audioBuffer, channelCount, sourceBitDepth, sourceSampleFormat); } export function float32ToUint8Pcm(input) { return WaveCodec.float32ToUint8Pcm(input); } export function int16PcmToFloat32(input) { return WaveCodec.int16PcmToFloat32(input); } export function float32ToInt16Pcm(input) { return WaveCodec.float32ToInt16Pcm(input); } export function int24PcmToFloat32(input) { return WaveCodec.int24PcmToFloat32(input); } export function float32ToInt24Pcm(input) { return WaveCodec.float32ToInt24Pcm(input); } export function int32PcmToFloat32(input) { return WaveCodec.int32PcmToFloat32(input); } export function float32ToInt32Pcm(input) { return WaveCodec.float32ToInt32Pcm(input); } export function interleaveChannels(channels) { return WaveCodec.interleaveChannels(channels); } export function deinterleaveChannels(interleavedChannels, channelCount) { return WaveCodec.deinterleaveChannels(interleavedChannels, channelCount); } export { SampleFormat } from '@echogarden/wave-codec'; //# sourceMappingURL=AudioBufferConversion.js.map