Skip to content
Type

AudioTransformOptions

Options for transforming audio samples before encoding.

ts
type AudioTransformOptions = {
	numberOfChannels?: number;
	sampleRate?: number;
	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.

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.

Released under the Mozilla Public License 2.0.