Synthesizer Examples
Over the course of the past several chapters we have gone over how to build simple synthesizers using Tone.js. This page serves as a series of examples and the ideas behind different, more complex synthesizers.
Simple Synths
This is where we left of. We can generate a sound with an oscillator, apply an envelope, maybe a filter, and then send the output to the master speakers.
PolySynth
We can create multiple copies of these in order to generate multiple notes at once. We could do this manually by creating multiple Tone.Synth()
objects with varying settings and identical triggers, or you could utilize the Tone.Polysynth()
object.
This is an example of what the object can do, and what parameters are available.
MonoSynth
This kind of synth applies an envelope to the filter applied to a sound, in addition to the amplitude envelope being applied to the sound’s loudness.
FilterEnvelope()
is similar toScaledEnvelope()
but with musical values.- see: FrequencyEnvelope docs for more information on the object
- parameters only noticeable with longer amplitude envelopes
- baseFrequency - min
- octaves - max
DuoSynth
Utilizes two different monoSynth()
objects and the ratio between them (also called harmonicity) to generate a modulated sound output.
Parameters include;
- vibratoAmount
- vibratoRate
- harmonicity
- ratio between two voices, 1 - 2
- 1 - no change
- 2 - an octave change
- portamento
- glide time between notes, like a slide on a guitar
- glide time between notes, like a slide on a guitar
AMSynth
Creates sound through amplitude modulation, or AM. AM is achieved by combining one signal with another. The example here shows how to use Tone.AMSynth()
to generate various amplitude modulations simply. You can manually create amplitude modulations with more control, but this method is a little more user friendly at first. To modulate a signal, you can send the output of one oscillator to adjust a parameter of another, like with LFOs or sliders from the previous sections.
FMSynth
Frequency Modulation is a more complex version of modulation, but it can result in a larger variety of sound outputs. many of which are great for use in video games. rather than altering the amplitudes of the original frequency, FM will modulate the frequencies.
The modulation index is essentially the amound of modulation occuring. It is the ratio of the frequency of the modulating signal (mf) to the amplitude of the modulating signal (ma) – as in ma/mf.
NoiseSynth
This object generates noise.
MetalSynth
Utilizes a highly filtered FM signal to create noisy, metallic sounds; similar to cymbals.
MembraneSynth
utilizes both amplitude and frequency envelopes to replicate drums and other instruments with a membrane that can be hit.
Now that we have a through understanding of how we can create and customize synthesizers inside of Tone.js, lets discuss how to program automatic melody sequences that we can utilize in our codes.