UNPKG

3.41 kBTypeScriptView Raw
1import { StereoFeedbackEffect, StereoFeedbackEffectOptions } from "../effect/StereoFeedbackEffect.js";
2import { Degrees, Frequency, Milliseconds, NormalRange, Time } from "../core/type/Units.js";
3import { ToneOscillatorType } from "../source/oscillator/OscillatorInterface.js";
4import { Signal } from "../signal/Signal.js";
5export interface ChorusOptions extends StereoFeedbackEffectOptions {
6 frequency: Frequency;
7 delayTime: Milliseconds;
8 depth: NormalRange;
9 type: ToneOscillatorType;
10 spread: Degrees;
11}
12/**
13 * Chorus is a stereo chorus effect composed of a left and right delay with an {@link LFO} applied to the delayTime of each channel.
14 * When {@link feedback} is set to a value larger than 0, you also get Flanger-type effects.
15 * Inspiration from [Tuna.js](https://github.com/Dinahmoe/tuna/blob/master/tuna.js).
16 * Read more on the chorus effect on [Sound On Sound](http://www.soundonsound.com/sos/jun04/articles/synthsecrets.htm).
17 *
18 * @example
19 * const chorus = new Tone.Chorus(4, 2.5, 0.5).toDestination().start();
20 * const synth = new Tone.PolySynth().connect(chorus);
21 * synth.triggerAttackRelease(["C3", "E3", "G3"], "8n");
22 *
23 * @category Effect
24 */
25export declare class Chorus extends StereoFeedbackEffect<ChorusOptions> {
26 readonly name: string;
27 /**
28 * the depth of the chorus
29 */
30 private _depth;
31 /**
32 * the delayTime in seconds.
33 */
34 private _delayTime;
35 /**
36 * the lfo which controls the delayTime
37 */
38 private _lfoL;
39 /**
40 * another LFO for the right side with a 180 degree phase diff
41 */
42 private _lfoR;
43 /**
44 * delay for left
45 */
46 private _delayNodeL;
47 /**
48 * delay for right
49 */
50 private _delayNodeR;
51 /**
52 * The frequency of the LFO which modulates the delayTime.
53 */
54 readonly frequency: Signal<"frequency">;
55 /**
56 * @param frequency The frequency of the LFO.
57 * @param delayTime The delay of the chorus effect in ms.
58 * @param depth The depth of the chorus.
59 */
60 constructor(frequency?: Frequency, delayTime?: Milliseconds, depth?: NormalRange);
61 constructor(options?: Partial<ChorusOptions>);
62 static getDefaults(): ChorusOptions;
63 /**
64 * The depth of the effect. A depth of 1 makes the delayTime
65 * modulate between 0 and 2*delayTime (centered around the delayTime).
66 */
67 get depth(): NormalRange;
68 set depth(depth: NormalRange);
69 /**
70 * The delayTime in milliseconds of the chorus. A larger delayTime
71 * will give a more pronounced effect. Nominal range a delayTime
72 * is between 2 and 20ms.
73 */
74 get delayTime(): Milliseconds;
75 set delayTime(delayTime: Milliseconds);
76 /**
77 * The oscillator type of the LFO.
78 */
79 get type(): ToneOscillatorType;
80 set type(type: ToneOscillatorType);
81 /**
82 * Amount of stereo spread. When set to 0, both LFO's will be panned centrally.
83 * When set to 180, LFO's will be panned hard left and right respectively.
84 */
85 get spread(): Degrees;
86 set spread(spread: Degrees);
87 /**
88 * Start the effect.
89 */
90 start(time?: Time): this;
91 /**
92 * Stop the lfo
93 */
94 stop(time?: Time): this;
95 /**
96 * Sync the filter to the transport.
97 * @see {@link LFO.sync}
98 */
99 sync(): this;
100 /**
101 * Unsync the filter from the transport.
102 */
103 unsync(): this;
104 dispose(): this;
105}