title: Generate a non-sinusoidal tone
body: <p>Is it possible to generate a tone based on a specific formula? I've tried googling it, but the only things I could find were about normal sine waves, such as <a href="https://stackoverflow.com/q/6343450/1256925">this other SO question</a>. So I was wondering if it is possible to generate tones based on other kinds of formulas?</p>
  
  <p>On that other SO question, I did find a link to <a href="http://chromium.googlecode.com/svn/trunk/samples/audio/index.html" rel="nofollow noreferrer">this demo page</a>, but it seems like that page just downloads sound files and uses them to just alter the pitch of the sounds.</p>
  
  <p>I've already tried combining sine waves by using multiple oscillators, based on <a href="https://stackoverflow.com/a/16573282/1256925">this answer</a>, which works just as expected:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>window.ctx = new webkitAudioContext();
  window.osc = [];
  
  function startTones() {
    osc[0] = ctx.createOscillator(),
    osc[1] = ctx.createOscillator()
    osc[0].frequency.value = 120;
    osc[1].frequency.value = 240;
    osc[0].connect(ctx.destination);
    osc[1].connect(ctx.destination);
    osc[0].start(0);
    osc[1].start(0);
  }
  
  function stopTones() {
    osc[0].stop(0);
    osc[1].stop(0);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button onclick="startTones();"&gt;Start&lt;/button&gt;
  &lt;button onclick="stopTones();"&gt;Stop&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>So now I was wondering, is it possible to make a wave that's not based on adding sine waves like this, such as a sawtooth wave (<code>x - floor(x)</code>), or a multiplication of sine waves (<code>sin(PI*440*x)*sin(PI*220*x)</code>)?</p>
  
  <p>PS: I'm okay with not supporting some browsers - as long as it still works in at least one (although more is better).</p>