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:
Play[Sin[2 Pi 440 t + 2 Sin[2 Pi 900 t]], {t, 0, 1}]
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:
Manipulate[
EmitSound[Play[Sin[2 Pi 440 t + 2 Sin[2 Pi mf t]], {t, 0, 1}]];
"Drag and release the slider!",
{{mf, 900, "modulation frequency"}, 1, 2000},
ContinuousAction -> False
]
Add controls for the carrier frequency and modulation index:
Manipulate[
EmitSound[Play[Sin[2 Pi cf t + b Sin[2 Pi mf t]], {t, 0, 1}]];
"Drag and release a slider!",
{{cf, 440, "carrier frequency"}, 80, 900},
{{mf, 900, "modulation frequency"}, 1, 2000},
{{b, 2, "modulation index"}, 0, 10},
ContinuousAction -> False
]
Manipulate[
EmitSound[Play[Sin[2 Pi cf t + b Sin[2 Pi mf t]], {t, 0, 1}]];
"Drag and release a slider!",
{{cf, 440, "carrier frequency"}, 80, 900},
{{mf, 900, "modulation frequency"}, 1, 2000},
{{b, 2, "modulation index"}, 0, 10},
ContinuousAction -> False
]