1 | import { Param } from "../../core/context/Param.js";
|
2 | import { ToneAudioNode, ToneAudioNodeOptions } from "../../core/context/ToneAudioNode.js";
|
3 | import { Decibels, Positive, Time } from "../../core/type/Units.js";
|
4 | export interface CompressorOptions extends ToneAudioNodeOptions {
|
5 | attack: Time;
|
6 | knee: Decibels;
|
7 | ratio: Positive;
|
8 | release: Time;
|
9 | threshold: Decibels;
|
10 | }
|
11 | /**
|
12 | * Compressor is a thin wrapper around the Web Audio
|
13 | * [DynamicsCompressorNode](http://webaudio.github.io/web-audio-api/#the-dynamicscompressornode-interface).
|
14 | * Compression reduces the volume of loud sounds or amplifies quiet sounds
|
15 | * by narrowing or "compressing" an audio signal's dynamic range.
|
16 | * Read more on [Wikipedia](https://en.wikipedia.org/wiki/Dynamic_range_compression).
|
17 | * @example
|
18 | * const comp = new Tone.Compressor(-30, 3);
|
19 | * @category Component
|
20 | */
|
21 | export declare class Compressor extends ToneAudioNode<CompressorOptions> {
|
22 | readonly name: string;
|
23 | /**
|
24 | * the compressor node
|
25 | */
|
26 | private _compressor;
|
27 | readonly input: DynamicsCompressorNode;
|
28 | readonly output: DynamicsCompressorNode;
|
29 | /**
|
30 | * The decibel value above which the compression will start taking effect.
|
31 | * @min -100
|
32 | * @max 0
|
33 | */
|
34 | readonly threshold: Param<"decibels">;
|
35 | /**
|
36 | * The amount of time (in seconds) to reduce the gain by 10dB.
|
37 | * @min 0
|
38 | * @max 1
|
39 | */
|
40 | readonly attack: Param<"time">;
|
41 | /**
|
42 | * The amount of time (in seconds) to increase the gain by 10dB.
|
43 | * @min 0
|
44 | * @max 1
|
45 | */
|
46 | readonly release: Param<"time">;
|
47 | /**
|
48 | * A decibel value representing the range above the threshold where the
|
49 | * curve smoothly transitions to the "ratio" portion.
|
50 | * @min 0
|
51 | * @max 40
|
52 | */
|
53 | readonly knee: Param<"decibels">;
|
54 | /**
|
55 | * The amount of dB change in input for a 1 dB change in output.
|
56 | * @min 1
|
57 | * @max 20
|
58 | */
|
59 | readonly ratio: Param<"positive">;
|
60 | /**
|
61 | * @param threshold The value above which the compression starts to be applied.
|
62 | * @param ratio The gain reduction ratio.
|
63 | */
|
64 | constructor(threshold?: Decibels, ratio?: Positive);
|
65 | constructor(options?: Partial<CompressorOptions>);
|
66 | static getDefaults(): CompressorOptions;
|
67 | /**
|
68 | * A read-only decibel value for metering purposes, representing the current amount of gain
|
69 | * reduction that the compressor is applying to the signal. If fed no signal the value will be 0 (no gain reduction).
|
70 | */
|
71 | get reduction(): Decibels;
|
72 | dispose(): this;
|
73 | }
|