UNPKG

2.32 kBTypeScriptView Raw
1import { ToneAudioNode, ToneAudioNodeOptions } from "../../core/context/ToneAudioNode.js";
2import { ToneAudioBuffer } from "../../core/context/ToneAudioBuffer.js";
3import { Gain } from "../../core/context/Gain.js";
4export interface ConvolverOptions extends ToneAudioNodeOptions {
5 onload: () => void;
6 normalize: boolean;
7 url?: string | AudioBuffer | ToneAudioBuffer;
8}
9/**
10 * Convolver is a wrapper around the Native Web Audio
11 * [ConvolverNode](http://webaudio.github.io/web-audio-api/#the-convolvernode-interface).
12 * Convolution is useful for reverb and filter emulation. Read more about convolution reverb on
13 * [Wikipedia](https://en.wikipedia.org/wiki/Convolution_reverb).
14 *
15 * @example
16 * // initializing the convolver with an impulse response
17 * const convolver = new Tone.Convolver("./path/to/ir.wav").toDestination();
18 * @category Component
19 */
20export declare class Convolver extends ToneAudioNode<ConvolverOptions> {
21 readonly name: string;
22 /**
23 * The native ConvolverNode
24 */
25 private _convolver;
26 /**
27 * The Buffer belonging to the convolver
28 */
29 private _buffer;
30 readonly input: Gain;
31 readonly output: Gain;
32 /**
33 * @param url The URL of the impulse response or the ToneAudioBuffer containing the impulse response.
34 * @param onload The callback to invoke when the url is loaded.
35 */
36 constructor(url?: string | AudioBuffer | ToneAudioBuffer, onload?: () => void);
37 constructor(options?: Partial<ConvolverOptions>);
38 static getDefaults(): ConvolverOptions;
39 /**
40 * Load an impulse response url as an audio buffer.
41 * Decodes the audio asynchronously and invokes
42 * the callback once the audio buffer loads.
43 * @param url The url of the buffer to load. filetype support depends on the browser.
44 */
45 load(url: string): Promise<void>;
46 /**
47 * The convolver's buffer
48 */
49 get buffer(): ToneAudioBuffer | null;
50 set buffer(buffer: ToneAudioBuffer | null);
51 /**
52 * The normalize property of the ConvolverNode interface is a boolean that
53 * controls whether the impulse response from the buffer will be scaled by
54 * an equal-power normalization when the buffer attribute is set, or not.
55 */
56 get normalize(): boolean;
57 set normalize(norm: boolean);
58 dispose(): this;
59}