Homework 2 is about synthesizing an auditory streaming illusion using FM tones.

Built-in FM instruments

This page demo's a real-time FM synthpatch with mouse / touchpad interface.
After clicking the start button, play tones by clicking the mouse button. Move the mouse laterally to change the pitch (and stereo pan position). Helpful hint: find a spot on the page where you can move the mouse without affecting the contents of the live code editor, for example, below the buttons.
See the Chuck UGen documentation of BeeThree and friends. These are implementations of the STK (Synthesis ToolKit) C++ FM classes.

////////////////////////////////////////////////////
suggestions (test these patches by replacing BeeThree)
FMVoices HevyMetl PercFlut Rhodey TubeBell Wurley
////////////////////////////////////////////////////
live code
global int mouseX, mouseY; global Event playNote, finishNote; float panValue; BeeThree fm => Pan2 stereo => dac; fm.freq(440.0); fun void runFM() { while (true) { playNote => now; panValue => stereo.pan; fm.noteOn(1.0); finishNote => now; fm.noteOff(1.0); } } spork ~ runFM(); fun void RespondToMouseMovement() { while( true ) { mouseX*0.5 => fm.freq; Math.sin(mouseX*0.5) => panValue; // mouseY*0.5 => index; 10::ms => now; } } spork ~ RespondToMouseMovement(); 1::week => now;