title: Easy way to construct a timeline in JavaScript?
body: <p>I am using the <code>AudioContext()</code> object to create a slight soundtrack for a canvas game I am making. In order to do this, however, I need to play certain events at a certain point in time. I currently have:</p>
  
  <pre><code>function playRingTone(){
      var osc = ctx.createOscillator();
      osc.connect(ctx.destination);
      osc.start(0);
      osc.frequency.value = 200;
      setTimeout(function(o){
          console.log(true);
          o.frequency.value = 300; 
          setTimeout(function(o){
              console.log(true);
              o.frequency.value = 350; 
              setTimeout(function(o){
                  console.log(true);
                  o.frequency.value = 375; 
                  setTimeout(function(o){
                      console.log(true);
                      o.frequency.value = 400; 
                      setTimeout(function(o){
                          console.log(true);
                          o.frequency.value = 380; 
                          setTimeout(function(o){
                              console.log(true);
                              o.frequency.value = 360; 
                              setTimeout(function(o){
                                  console.log(true);
                                  o.frequency.value = 375; 
                              },600,o);
                          },200,o);
                      },200,o);
                  },200,o);
              },200,o);
          },1500,o);
      },1000,osc);
  }
  </code></pre>
  
  <p>This, however, is <strong><em>highly</em></strong> cumbersome, and is hard to edit and create. Is there a better way to do it? I am willing to use libraries, but a pure JS way is preferred. Thanks!</p>