UNPKG

1.75 kBTypeScriptView Raw
1import { Frequency, NormalRange, Time } from "../core/type/Units.js";
2import { RecursivePartial } from "../core/util/Interface.js";
3import { Instrument, InstrumentOptions } from "./Instrument.js";
4export interface PluckSynthOptions extends InstrumentOptions {
5 attackNoise: number;
6 dampening: Frequency;
7 resonance: NormalRange;
8 release: Time;
9}
10/**
11 * Karplus-Strong string synthesis.
12 * @example
13 * const plucky = new Tone.PluckSynth().toDestination();
14 * plucky.triggerAttack("C4", "+0.5");
15 * plucky.triggerAttack("C3", "+1");
16 * plucky.triggerAttack("C2", "+1.5");
17 * plucky.triggerAttack("C1", "+2");
18 * @category Instrument
19 */
20export declare class PluckSynth extends Instrument<PluckSynthOptions> {
21 readonly name = "PluckSynth";
22 /**
23 * Noise burst at the beginning
24 */
25 private _noise;
26 private _lfcf;
27 /**
28 * The amount of noise at the attack.
29 * Nominal range of [0.1, 20]
30 * @min 0.1
31 * @max 20
32 */
33 attackNoise: number;
34 /**
35 * The amount of resonance of the pluck. Also correlates to the sustain duration.
36 */
37 resonance: NormalRange;
38 /**
39 * The release time which corresponds to a resonance ramp down to 0
40 */
41 release: Time;
42 constructor(options?: RecursivePartial<PluckSynthOptions>);
43 static getDefaults(): PluckSynthOptions;
44 /**
45 * The dampening control. i.e. the lowpass filter frequency of the comb filter
46 * @min 0
47 * @max 7000
48 */
49 get dampening(): Frequency;
50 set dampening(fq: Frequency);
51 triggerAttack(note: Frequency, time?: Time): this;
52 /**
53 * Ramp down the {@link resonance} to 0 over the duration of the release time.
54 */
55 triggerRelease(time?: Time): this;
56 dispose(): this;
57}