UNPKG

@diffusionstudio/core-v4

Version:

2D motion graphics and video rendering engine

38 lines (37 loc) 1.48 kB
/** * Converts an AudioBuffer to a Float32Array. * For 2 channels it will result in something like: * [L[0], R[0], L[1], R[1], ... , L[n], R[n]] */ export declare function interleave(input: AudioBuffer): Float32Array; /** * Converts a Float32Array to 16-bit PCM. */ export declare function floatTo16BitPCM(dataview: DataView, buffer: Float32Array, offset: number): DataView; /** * Converts the specified AudioBuffer to a Blob. * * Note that changing the MIME type does not change the actual file format. * The output is a WAVE in any case */ export declare function audioBufferToWav(buffer: AudioBuffer, type?: string): Blob; /** * Convert an audio buffer into a planar float 32 array */ export declare function bufferToF32Planar(input: AudioBuffer): Float32Array; /** * Conver an audio buffer inter a interleaved int 16 array */ export declare function bufferToI16Interleaved(audioBuffer: AudioBuffer): Int16Array; /** * Merges the channels of the audio blob into a mono AudioBuffer */ export declare function blobToMonoBuffer(blob: Blob, sampleRate?: number, scalingFactor?: number): Promise<AudioBuffer>; /** * Change the sample rate of an audio buffer * @param buffer The buffer to resample * @param sampleRate The desired sample rate * @param numberOfChannels The desired number of channels * @returns The resampled audio buffer */ export declare function resampleBuffer(buffer: AudioBuffer, sampleRate?: number, numberOfChannels?: number): AudioBuffer;