UNPKG

2.42 kBTypeScriptView Raw
1import { Monophonic, MonophonicOptions } from "./Monophonic.js";
2import { MonoSynth, MonoSynthOptions } from "./MonoSynth.js";
3import { Signal } from "../signal/Signal.js";
4import { RecursivePartial } from "../core/util/Interface.js";
5import { Frequency, NormalRange, Positive, Seconds, Time } from "../core/type/Units.js";
6import { Param } from "../core/context/Param.js";
7export interface DuoSynthOptions extends MonophonicOptions {
8 voice0: Omit<MonoSynthOptions, keyof MonophonicOptions>;
9 voice1: Omit<MonoSynthOptions, keyof MonophonicOptions>;
10 harmonicity: Positive;
11 vibratoRate: Frequency;
12 vibratoAmount: Positive;
13}
14/**
15 * DuoSynth is a monophonic synth composed of two {@link MonoSynth}s run in parallel with control over the
16 * frequency ratio between the two voices and vibrato effect.
17 * @example
18 * const duoSynth = new Tone.DuoSynth().toDestination();
19 * duoSynth.triggerAttackRelease("C4", "2n");
20 * @category Instrument
21 */
22export declare class DuoSynth extends Monophonic<DuoSynthOptions> {
23 readonly name: string;
24 readonly frequency: Signal<"frequency">;
25 readonly detune: Signal<"cents">;
26 /**
27 * the first voice
28 */
29 readonly voice0: MonoSynth;
30 /**
31 * the second voice
32 */
33 readonly voice1: MonoSynth;
34 /**
35 * The amount of vibrato
36 */
37 vibratoAmount: Param<"normalRange">;
38 /**
39 * the vibrato frequency
40 */
41 vibratoRate: Signal<"frequency">;
42 /**
43 * Harmonicity is the ratio between the two voices. A harmonicity of
44 * 1 is no change. Harmonicity = 2 means a change of an octave.
45 * @example
46 * const duoSynth = new Tone.DuoSynth().toDestination();
47 * duoSynth.triggerAttackRelease("C4", "2n");
48 * // pitch voice1 an octave below voice0
49 * duoSynth.harmonicity.value = 0.5;
50 */
51 harmonicity: Signal<"positive">;
52 /**
53 * The vibrato LFO.
54 */
55 private _vibrato;
56 /**
57 * the vibrato gain
58 */
59 private _vibratoGain;
60 constructor(options?: RecursivePartial<DuoSynthOptions>);
61 getLevelAtTime(time: Time): NormalRange;
62 static getDefaults(): DuoSynthOptions;
63 /**
64 * Trigger the attack portion of the note
65 */
66 protected _triggerEnvelopeAttack(time: Seconds, velocity: number): void;
67 /**
68 * Trigger the release portion of the note
69 */
70 protected _triggerEnvelopeRelease(time: Seconds): this;
71 dispose(): this;
72}