title: How do I visualize audio data?
body: <p>I would like to have something that looks something like this. Two different colors are not nessesary.</p>
  
  <p><a href="https://i.stack.imgur.com/eq3Pt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eq3Pt.png" alt="audacity on mac"></a><br>
  <sub>(source: <a href="http://audacity.sourceforge.net/about/images/audacity-macosx.png" rel="nofollow noreferrer">sourceforge.net</a>)</sub>  </p>
  
  <p>I already have the audio data (one sample/millisecond) from a stereo wav in two int arrays, one each for left and right channel. I have made a few attempts but they don't look anywhere near as clear as this, my attempts get to spikey or a compact lump.</p>
  
  <p>Any good suggestions? I'm working in c# but psuedocode is ok.</p>
  
  <p>Assume we have</p>
  
  <ul>
  <li>a function DrawLine(color, x1, y1, x2, y2)</li>
  <li>two int arrays with data right[]  and  left[] of lenght L</li>
  <li>data values between 32767 and -32768</li>
  </ul>
  
  <p>If you make any other assumptions just write them down in your answer.</p>
  
  <pre><code>for(i = 0; i &lt; L - 1; i++) {
    // What magic goes here?
  }
  </code></pre>
  
  <p>This is how it turned out when I applied <a href="https://stackoverflow.com/questions/1035533/how-do-i-visualize-audio-data/1036968#1036968">the solution Han provided</a>. (only one channel)<br>
  <a href="http://www.imagechicken.com/uploads/1245877759099921200.jpg" rel="nofollow noreferrer">alt text http://www.imagechicken.com/uploads/1245877759099921200.jpg</a></p>