title: Web Audio API, setting treble and bass
body: <p>I'm trying to learn how to use the web audio api properly and I'm running into a bit of confusion.</p>
  
  <p>In my project, I'm trying to replicate the functionality of an old <strong>1982 <a href="http://classicreceivers.com/wp-content/uploads/2011/08/harman-kardon-hk-590i-corner3.jpg" rel="nofollow">Harman/Kardon receiver</a></strong>. <em>(click link to see photo)</em> </p>
  
  <p>This receiver has separate dials for the treble and bass control. I'll just deal with treble in this question. I'm sure I can figure out the bass equivalent once I'm pointed in the right direction.</p>
  
  <p>In an initialization function I create the context and filter nodes.</p>
  
  <pre><code>window.AudioContext = window.AudioContext || window.webkitAudioContext;
      context = new AudioContext();
      source = context.createMediaElementSource(document.getElementById('audio'));
      gainNode = context.createGain();
  
  //filter nodes
  bassTurnoverFilter = context.createBiquadFilter();
  trebleTurnoverFilter = context.createBiquadFilter();
  loudnessTrebFilter = context.createBiquadFilter();
  loudnessBassFilter = context.createBiquadFilter();
  trebleLevelFilter = context.createBiquadFilter();
  bassLevelFilter = context.createBiquadFilter();
  </code></pre>
  
  <p>I am currently using the <a href="http://www.ohsean.net/plugins/jogdial/" rel="nofollow">jogDial plugin</a> to control the dials. The dials do work and I can get a range for the "treble" variable between 0 and 1 when the dials turn from 0% to 100%.</p>
  
  <p>This is the current mousemove function I am using for the treble dial:</p>
  
  <pre><code>.on("mousemove", function(event){
  
  var treble = (event.target.rotation + 140) / 280;
  
      if(trebleLevelFilter !== undefined){
          trebleLevelFilter.disconnect();
      }
      source.connect(trebleLevelFilter); 
      trebleLevelFilter.type = "highshelf"; 
      trebleLevelFilter.frequency.value = 200; 
      trebleLevelFilter.gain.value = treble; 
      trebleLevelFilter.connect(context.destination);
  });
  </code></pre>
  
  <p>My question, or multi-part question is... 
  which of the 6 <em>types</em> should I use? <strong><em>("lowpass","highpass", "bandpass", "lowshelf", "highshelf", "peaking", "notch", "allpass")</em></strong> I'm guessing it is the highpass or highself.</p>
  
  <p>What frequency should I set? </p>
  
  <p>Is the gain.value what should be dynamic when the dial turns? </p>
  
  <p>Am I going in completely the wrong direction?</p>
  
  <p>I have the gain.value set to the treble variable value, and it seems like it is increasing the volume a little when turned to 100%... but i don't think that is the correct functionality I am trying to accomplish.</p>