react-synth
Components

Note

Plays a single note

<Note>

Plays a single note using Web Audio oscillators with ADSR envelope. Inherits synth settings from parent <Synth> component, or uses defaults.

PropTypeDefaultDescription
notestring or numberRequired. Note name ("C4", "A#3") or frequency in Hz
ampnumber0.3Amplitude/volume 0-1
attacknumber0Attack time in beats
attack_levelnumber1Peak level at end of attack (multiplied by amp)
decaynumber0Decay time in beats
decay_levelnumbersustain_levelLevel at end of decay
sustainnumber0Sustain time in beats
sustain_levelnumber1Sustained level (multiplied by amp)
releasenumber1Release time in beats
oscillatorOscillatorTypeOverride synth oscillator type
filterPartial<FilterConfig>Override filter settings (see config)
voicesPartial<VoiceConfig>Override voice settings (see config)

Note Duration: Total duration = attack + decay + sustain + release

{
  /* Simple note */
}
<Note note="A4" />;

{
  /* Note with envelope */
}
<Note note="C4" amp={0.5} attack={0.1} sustain={0.5} release={0.3} />;

{
  /* Note with frequency in Hz */
}
<Note note={440} />;

{
  /* Note with filter override */
}
<Note note="E4" filter={{ cutoff: 800, resonance: 5 }} />;

On this page