Skip to content
Tone.js

PluckSynth

class Instrument ↳ extends Instrument<PluckSynthOptions>

Karplus-Strong string synthesis.

const plucky = new Tone.PluckSynth().toDestination();
plucky.triggerAttack("C4", "+0.5");
plucky.triggerAttack("C3", "+1");
plucky.triggerAttack("C2", "+1.5");
plucky.triggerAttack("C1", "+2");
new PluckSynth(options?: RecursivePartial<PluckSynthOptions>)

Parameters

attackNoise: number

The amount of noise at the attack. Nominal range of [0.1, 20]

Range: 0.1 to 20

↳ inherited from Instrument

input: undefined

The instrument only has an output

read-only

name: "PluckSynth"

The name of the class

Default: "PluckSynth"

↳ inherited from Instrument

output: OutputNode

The output nodes. If the object is a sink, it does not have any output and this.output is undefined.

release: Time

The release time which corresponds to a resonance ramp down to 0

resonance: number

The amount of resonance of the pluck. Also correlates to the sustain duration.

↳ inherited from Instrument

volume: Param<"decibels">

The volume of the output in decibels.

const amSynth = new Tone.AMSynth().toDestination();
amSynth.volume.value = -6;
amSynth.triggerAttackRelease("G#3", 0.2);
dampening: Frequency

The dampening control. i.e. the lowpass filter frequency of the comb filter

Range: 0 to 7000

dispose(): this

clean up

Returns this this

↳ inherited from Instrument

sync(): this

Sync the instrument to the Transport. All subsequent calls of triggerAttack and triggerRelease will be scheduled along the transport.

const fmSynth = new Tone.FMSynth().toDestination();
fmSynth.volume.value = -6;
fmSynth.sync();
// schedule 3 notes when the transport first starts
fmSynth.triggerAttackRelease("C4", "8n", 0);
fmSynth.triggerAttackRelease("E4", "8n", "8n");
fmSynth.triggerAttackRelease("G4", "8n", "4n");
// start the transport to hear the notes
Tone.Transport.start();

Returns this

triggerAttack(note: Frequency, time?: Time): this

Start the instrument’s note.

Parameters

  • note Frequency

    the note to trigger

  • time Time optional

    the time to trigger the note

Returns this

↳ inherited from Instrument

triggerAttackRelease(note: Frequency, duration: Time, time?: Time, velocity?: number): this

Trigger the attack and then the release after the duration.

const synth = new Tone.Synth().toDestination();
// trigger "C4" for the duration of an 8th note
synth.triggerAttackRelease("C4", "8n");

Parameters

  • note Frequency

    The note to trigger.

  • duration Time

    How long the note should be held for before triggering the release. This value must be greater than 0.

  • time Time optional

    When the note should be triggered.

  • velocity number optional

    The velocity the note should be triggered at.

Returns this

triggerRelease(time?: Time): this

Ramp down the resonance to 0 over the duration of the release time.

Parameters

  • time Time optional

Returns this

↳ inherited from Instrument

unsync(): this

Unsync the instrument from the Transport

Returns this

static

getDefaults(): PluckSynthOptions

Returns all of the default options belonging to the class.

Returns PluckSynthOptions