UNPKG

1.9 kBTypeScriptView Raw
1import { Gain } from "../../core/context/Gain.js";
2import { NormalRange, Time } from "../../core/type/Units.js";
3import { Envelope, EnvelopeOptions } from "./Envelope.js";
4/**
5 * AmplitudeEnvelope is a Tone.Envelope connected to a gain node.
6 * Unlike Tone.Envelope, which outputs the envelope's value, AmplitudeEnvelope accepts
7 * an audio signal as the input and will apply the envelope to the amplitude
8 * of the signal.
9 * Read more about ADSR Envelopes on [Wikipedia](https://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope).
10 *
11 * @example
12 * return Tone.Offline(() => {
13 * const ampEnv = new Tone.AmplitudeEnvelope({
14 * attack: 0.1,
15 * decay: 0.2,
16 * sustain: 1.0,
17 * release: 0.8
18 * }).toDestination();
19 * // create an oscillator and connect it
20 * const osc = new Tone.Oscillator().connect(ampEnv).start();
21 * // trigger the envelopes attack and release "8t" apart
22 * ampEnv.triggerAttackRelease("8t");
23 * }, 1.5, 1);
24 * @category Component
25 */
26export declare class AmplitudeEnvelope extends Envelope {
27 readonly name: string;
28 private _gainNode;
29 output: Gain;
30 input: Gain;
31 /**
32 * @param attack The amount of time it takes for the envelope to go from 0 to it's maximum value.
33 * @param decay The period of time after the attack that it takes for the envelope
34 * to fall to the sustain value. Value must be greater than 0.
35 * @param sustain The percent of the maximum value that the envelope rests at until
36 * the release is triggered.
37 * @param release The amount of time after the release is triggered it takes to reach 0.
38 * Value must be greater than 0.
39 */
40 constructor(attack?: Time, decay?: Time, sustain?: NormalRange, release?: Time);
41 constructor(options?: Partial<EnvelopeOptions>);
42 /**
43 * Clean up
44 */
45 dispose(): this;
46}