UNPKG

1.77 kBTypeScriptView Raw
1import { ToneAudioNode, ToneAudioNodeOptions } from "../../core/context/ToneAudioNode.js";
2import { Decibels, Time } from "../../core/type/Units.js";
3export interface GateOptions extends ToneAudioNodeOptions {
4 threshold: Decibels;
5 smoothing: Time;
6}
7/**
8 * Gate only passes a signal through when the incoming
9 * signal exceeds a specified threshold. It uses {@link Follower} to follow the ampltiude
10 * of the incoming signal and compares it to the {@link threshold} value using {@link GreaterThan}.
11 *
12 * @example
13 * const gate = new Tone.Gate(-30, 0.2).toDestination();
14 * const mic = new Tone.UserMedia().connect(gate);
15 * // the gate will only pass through the incoming
16 * // signal when it's louder than -30db
17 * @category Component
18 */
19export declare class Gate extends ToneAudioNode<GateOptions> {
20 readonly name: string;
21 readonly input: ToneAudioNode;
22 readonly output: ToneAudioNode;
23 /**
24 * Follow the incoming signal
25 */
26 private _follower;
27 /**
28 * Test if it's greater than the threshold
29 */
30 private _gt;
31 /**
32 * Gate the incoming signal when it does not exceed the threshold
33 */
34 private _gate;
35 /**
36 * @param threshold The threshold above which the gate will open.
37 * @param smoothing The follower's smoothing time
38 */
39 constructor(threshold?: Decibels, smoothing?: Time);
40 constructor(options?: Partial<GateOptions>);
41 static getDefaults(): GateOptions;
42 /**
43 * The threshold of the gate in decibels
44 */
45 get threshold(): Decibels;
46 set threshold(thresh: Decibels);
47 /**
48 * The attack/decay speed of the gate.
49 * @see {@link Follower.smoothing}
50 */
51 get smoothing(): Time;
52 set smoothing(smoothingTime: Time);
53 dispose(): this;
54}