// hello, sinewave!! T("sin", 1320).play();
// 880Hz pulse with tremolo(10Hz) T("*", T("pulse", 880, 0.2), T("tri", 10, 0.6, 0.8).kr()).play();
// 660Hz triangle with vibrato(5Hz) T("tri", T("sin", 5, 20, 660).kr()).play();
// computer noise var tone, timerId; tone = T("fami", 440).play(); tone.onplay = function() { timerId = setInterval(function() { tone.freq = (Math.random() * 2000) + 200; }, 100); }; tone.onpause = function() { clearInterval(timerId); };
// chords var c1, c2, c3, c_env, b0, b_env, player, chords = [ /* FM7 | G7onF | Em7 | Am | FM7 | G7onF | E9 | Am | */ ]; chords.index = 0; player = T("+", T("*", c_env = T("adsr", 20, 1740, 0.5), T("+", c1 = T("konami"), c2 = T("konami"), c3 = T("konami"))), T("*", b_env = T("adsr", 0, 220), b0 = T("pulse"))).play(); player.onplay = function() { chords.index = 0; c_env.bang(); }; c_env.onbang = function() { c1.freq = chords[chords.index][0]; c2.freq = chords[chords.index][1]; c3.freq = chords[chords.index][2]; b0.freq = chords[chords.index][3]; chords.index = ++chords.index % chords.length; b_env.bang(); }; c_env.onS = function() { c_env.bang(); }; b_env.onS = function() { b_env.bang(); };