Type
AudioTransformOptions
Options for transforming audio samples before encoding.
ts
type AudioTransformOptions = {
numberOfChannels?: number;
sampleRate?: number;
sampleFormat?: 'u8' | 's16' | 's32' | 'f32';
process?: (sample: AudioSample) => MaybePromise<
AudioSample | AudioSample[] | null
>;
};See AudioSample and MaybePromise.
Used by
Properties
numberOfChannels
ts
numberOfChannels?: number;The desired number of output channels to up/downmix to.
sampleRate
ts
sampleRate?: number;The desired output sample rate in hertz to resample to.
sampleFormat
ts
sampleFormat?: 'u8' | 's16' | 's32' | 'f32';The desired sample format (and therefore bit depth) of the audio samples before they are passed to the encoder. Can be used to control bit depth with certain output codecs such as FLAC.
process
ts
process?: ((sample: AudioSample) => MaybePromise<AudioSample | AudioSample[] | null>);Allows for custom user-defined processing of audio samples, e.g. for applying audio effects or timestamp modifications. Called for each audio sample after resampling and remixing.
Must return an AudioSample, an array of them, or null for dropping the sample.
See AudioSample and MaybePromise.