Posted by & filed under Blog, Making Music in the Browser, Tutorials, Web Audio.

Amplitude Modulation is a simple concept that can yield harmonically rich and bizarre timbres not easily achieved via other methods. In this article we’ll expand on the topics introduced in Simple Synthesis – Amplitude Modulation and play around with the concepts behind AM Synthesis. Modulation sources do not need to be low-frequency oscillators or envelope generators.


Amplitude Modulation
As its name implies, Amplitude Modulation is the changing of, or modulation of, a carrier wave’s gain value, or amplitude. In its most basic form, you need two oscillators and one gain node. One oscillator is the ‘carrier’, which is connected to the input of the gain node, and the other is the ‘modulator’, which is connected to the 'gain' AudioParam of the Gain Node.

Sidebands
Am-sidebands
When our modulating oscillator is below the range of human hearing, ~20Hz, the carrier tone will have a tremolo effect, best demonstrated at ~3hz – 5hz.
When our modulator is set to values above 20Hz, instead of just sounding like a very fast tremolo it creates new frequencies that were not present in the original signal. These frequencies are typically referred to as ‘sidebands’ and are derived from the sum and difference between the carrier frequency and the modulator frequency. In total, we end up with three frequencies: the original carrier, lower (difference) sideband, and upper (sum) sideband.
For example, if our carrier is set to 220Hz (A3) and our modulator is set to 329.6Hz (E4), we get the following three frequencies; carrier – modulator = 109.6Hz (~A2), carrier = 220Hz (A3), and carrier + modulator = 549.6Hz (~C#5). Even though our example resulted in a relatively diatonic set of notes, the vast majority of carrier / modulator combinations will result in much more adventurous frequency set.

Keyboard Tracking

Keyboard Tracking is used to change a parameter based on the note you are pressing on your keyboard, and is typically used to modulate a filter. There are three basic types of tracking that we’ll be dealing with:

  • ‘fixed-carrier’ tracking
  • ‘fixed-modulator’ tracking
  • ‘carrier and modulator’ tracking

The first two types are the easiest to understand since only one parameter is changing in response to a key press. In ‘fixed-carrier’ tracking, the keyboard changes the modulator while the carrier’s frequency remains constant. In ‘fixed-modulator’ tracking, our keyboard affects only the carrier’s frequency. When both the Carrier and the Modulator track the keyboard equally, the relationships between the Difference, Carrier and Sum remain constant. We derive this relationship with the simple formula below:

ratio = carrierFreq / modulatorFreq
scaling = 1 / ratio
trackedModulatorFreq = keyboardCarrierFreq * scaling

Playground

Ok, enough reading, let’s listen to what we can do with Amplitude Modulation! Below is a simple two oscillator example built using the Web Audio and Web MIDI APIs. I’ve included a variety of presets for you to play around with and change in addition to the ability to play around with the three types of key tracking previously mentioned.
Some presets sound better in different octave ranges, so be sure to play around with octaves.

Go ahead and press ‘start’ below!

As of this writing only Chrome and Opera (33+) support the Web MIDI API fully.
If you are having issues with getting your browser to see your controller, refresh or restart your browser with your controller attached.
For iOS (no Web MIDI support), use the K-Board graphic below.

Resources:
https://www.keithmcmillen.com/blog/simple-synthesis-part-9-amplitude-modulation/
https://www.soundonsound.com/sos/mar00/articles/synthsecrets.htm

Am-sidebands“. Licensed under CC BY-SA 3.0 via Commons