Try now in the
Open Cloud »
(no sign-in required)

Synthesize Sounds

Make sounds the way early electronic music synthesizers did.

Run the code to play a 440-hertz tone. Try frequencies other than 440:

SHOW/HIDE DETAILS

A sine waveform gives a pure tone.

This makes a sine wave sound with a frequency of 440 hertz that plays for 1 second. Click the Play button to hear the sound:

In[1]:=
X
Out[1]=

Use EmitSound to play the sound immediately:

In[2]:=
X

HIDE DETAILS
In[1]:=
X

Play the tone with vibrato. Try other strengths of vibrato than 2:

SHOW/HIDE DETAILS

Adding another sine function inside the first one makes the frequency of the tone waver, giving a vibrato effect.

This gives vibrato with a frequency of 8 hertz:

In[1]:=
X

The factor of 2 in the vibrato governs its strength. Make the vibrato much stronger:

In[2]:=
X

HIDE DETAILS
In[1]:=
X

Increase the frequency of the vibrato. Try other values, like 60 or 2,000:

SHOW/HIDE DETAILS

As you increase the frequency of the vibrato, it eventually stops sounding like vibrato and creates a new, completely different sound:

In[1]:=
X
In[2]:=
X
In[3]:=
X
In[4]:=
X

This is how John Chowning discovered FM synthesis, a technique that was used in the first Yamaha music synthesizers.

HIDE DETAILS
In[1]:=
X

Make a synthesizer. Drag the sliders to make new sounds:

SHOW/HIDE DETAILS

This plays a sound with a carrier frequency of 440 hertz, a modulation frequency of 900 hertz, and a modulation index of 2:

In[1]:=
X

Different modulation frequencies give different sounds.

Explore the effects of various modulation frequencies interactively with Manipulate.

Wrap the EmitSound expression with Manipulate, replace the fixed modulation frequency 900 with the variable mf, and specify that mf ranges from 1 to 2000 with an initial value of 900. Now you can drag the slider to change the modulation frequency. ContinuousActionFalse specifies that the sound should only be played when you stop dragging the slider:

In[2]:=
X
Out[2]=

Add controls for the carrier frequency and modulation index:

In[3]:=
X
Out[3]=

HIDE DETAILS
In[1]:=
X
Out[1]=