Canvas Canvas
// Convenience constants var pi = Math.PI; var tau = 2.0 * pi; // Stereo output var out = [0,0]; // Some parameters var volume = 0.1; var frequency = 440; /// \brief This function is executed 44100 times per second /// and is used to generate the final sound wave. function onGetSample (t) { // Sine wave generator var s_left = volume * Math.sin(tau * t * frequency); var s_right = volume * Math.sin(tau * t * frequency * 1.01); out[0] = s_left; out[1] = s_right; return out; } /// \brief This function is executed 60 times per second (optional). function onGui() { // Future code will go here, maybe... }