Make sounds the way early electronic music synthesizers did.
Run the code and press the Play button to play a 440-hertz tone. Try frequencies other than 440:
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:
Use EmitSound to play the sound immediately:
Play the tone with vibrato. Try strengths of vibrato other than 2:
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:
The factor of 2 in the vibrato governs its strength. Make the vibrato much stronger:
Increase the frequency of the vibrato. Try other values, like 60 or 2,000:
As you increase the frequency of the vibrato, it eventually stops sounding like vibrato and creates a new, completely different sound:
This is how John Chowning discovered FM synthesis, a technique that was used in the first Yamaha music synthesizers.
Make a synthesizer. Drag the sliders to make new sounds:
This plays a sound with a “carrier frequency” of 440 hertz, a “modulation frequency” of 900 hertz and a “modulation index” of 2:
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:
Add controls for the carrier frequency and modulation index: