Class
AudioBufferSource
This source can be used to add audio data from an AudioBuffer to the output track. This is useful when working with the Web Audio API.
Extends: AudioSource
Constructor
ts
constructor(
encodingConfig: AudioEncodingConfig,
options: AudioBufferSourceOptions = {},
): AudioBufferSource;Creates a new AudioBufferSource whose AudioBuffer instances are encoded according to the specified AudioEncodingConfig and AudioBufferSourceOptions.
Methods
add()
ts
add(
audioBuffer: AudioBuffer,
): Promise<void>;Converts an AudioBuffer to audio samples, encodes them and adds them to the output. The first AudioBuffer will be played at the configured start timestamp (the default is 0), and each subsequent AudioBuffer will be placed directly after the previous one.
Returns: A Promise that resolves once the output is ready to receive more samples. You should await this Promise to respect writer and encoder backpressure.