UNPKG

1.47 kBTypeScriptView Raw
1import { Gain } from "../core/context/Gain.js";
2import { Param } from "../core/context/Param.js";
3import { Signal, SignalOptions } from "../signal/Signal.js";
4/**
5 * Subtract the signal connected to the input is subtracted from the signal connected
6 * The subtrahend.
7 *
8 * @example
9 * // subtract a scalar from a signal
10 * const sub = new Tone.Subtract(1);
11 * const sig = new Tone.Signal(4).connect(sub);
12 * // the output of sub is 3.
13 * @example
14 * // subtract two signals
15 * const sub = new Tone.Subtract();
16 * const sigA = new Tone.Signal(10);
17 * const sigB = new Tone.Signal(2.5);
18 * sigA.connect(sub);
19 * sigB.connect(sub.subtrahend);
20 * // output of sub is 7.5
21 * @category Signal
22 */
23export declare class Subtract extends Signal {
24 override: boolean;
25 readonly name: string;
26 /**
27 * the summing node
28 */
29 private _sum;
30 readonly input: Gain;
31 readonly output: Gain;
32 /**
33 * Negate the input of the second input before connecting it to the summing node.
34 */
35 private _neg;
36 /**
37 * The value which is subtracted from the main signal
38 */
39 subtrahend: Param<"number">;
40 /**
41 * @param value The value to subtract from the incoming signal. If the value
42 * is omitted, it will subtract the second signal from the first.
43 */
44 constructor(value?: number);
45 constructor(options?: Partial<SignalOptions<"number">>);
46 static getDefaults(): SignalOptions<"number">;
47 dispose(): this;
48}