UNPKG

2.01 kBTypeScriptView Raw
1import { Param } from "../context/Param.js";
2import { Seconds, Time } from "../type/Units.js";
3import { ToneAudioNode, ToneAudioNodeOptions } from "./ToneAudioNode.js";
4export interface DelayOptions extends ToneAudioNodeOptions {
5 delayTime: Time;
6 maxDelay: Time;
7}
8/**
9 * Wrapper around Web Audio's native [DelayNode](http://webaudio.github.io/web-audio-api/#the-delaynode-interface).
10 * @category Core
11 * @example
12 * return Tone.Offline(() => {
13 * const delay = new Tone.Delay(0.1).toDestination();
14 * // connect the signal to both the delay and the destination
15 * const pulse = new Tone.PulseOscillator().connect(delay).toDestination();
16 * // start and stop the pulse
17 * pulse.start(0).stop(0.01);
18 * }, 0.5, 1);
19 */
20export declare class Delay extends ToneAudioNode<DelayOptions> {
21 readonly name: string;
22 /**
23 * Private holder of the max delay time
24 */
25 private _maxDelay;
26 /**
27 * The amount of time the incoming signal is delayed.
28 * @example
29 * const delay = new Tone.Delay().toDestination();
30 * // modulate the delayTime between 0.1 and 1 seconds
31 * const delayLFO = new Tone.LFO(0.5, 0.1, 1).start().connect(delay.delayTime);
32 * const pulse = new Tone.PulseOscillator().connect(delay).start();
33 * // the change in delayTime causes the pitch to go up and down
34 */
35 readonly delayTime: Param<"time">;
36 /**
37 * Private reference to the internal DelayNode
38 */
39 private _delayNode;
40 readonly input: DelayNode;
41 readonly output: DelayNode;
42 /**
43 * @param delayTime The delay applied to the incoming signal.
44 * @param maxDelay The maximum delay time.
45 */
46 constructor(delayTime?: Time, maxDelay?: Time);
47 constructor(options?: Partial<DelayOptions>);
48 static getDefaults(): DelayOptions;
49 /**
50 * The maximum delay time. This cannot be changed after
51 * the value is passed into the constructor.
52 */
53 get maxDelay(): Seconds;
54 /**
55 * Clean up.
56 */
57 dispose(): this;
58}