title: Audio Visualizer C#
body: <p>I'm writing an audio visualizer in C#/Asp.net/JavaScript (as a website). Since my animations should move smoothly along with the music I thought it would make more sense to preprocess the MP3 in the code behind, write the values/frequencies to a text file or something, then use javascript to read the values and modify the animation accordingly. Basically I want to do something like this bar thing: <a href="https://lh4.ggpht.com/Qhm4EeDUgVlvLcX4MiZ1idGDUo5cD5PmLAIZIfnJlilzU789OPXAUK_emJSOT3CK4Vs=h900" rel="nofollow">https://lh4.ggpht.com/Qhm4EeDUgVlvLcX4MiZ1idGDUo5cD5PmLAIZIfnJlilzU789OPXAUK_emJSOT3CK4Vs=h900</a>
  I need some kind of number value to use as the height of the bars and it should change as the music continues.
  I'm using Naudio for this. Here's my code:</p>
  
  <pre><code>using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using NAudio;
  using System.IO;
  
  public partial class _Default : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          MP3toWAV(MapPath("~/Music/UctfnI6yUPM.mp3"), MapPath("~/Music/UctfnI6yUPM.wav"));
          Strip(MapPath("~/Music/UctfnI6yUPM.wav"));
      }
      public void MP3toWAV(string file,string output)
      {
          using (NAudio.Wave.Mp3FileReader reader = new NAudio.Wave.Mp3FileReader(file))
          {
              NAudio.Wave.WaveFileWriter.CreateWaveFile(output, reader);
          }
      }
      public void Strip(string path)
      {
          NAudio.Wave.WaveChannel32 wave = new NAudio.Wave.WaveChannel32(new NAudio.Wave.WaveFileReader(path));
          byte[] buffer = new byte[8192];
          int read = 0;
          StreamWriter writer = new StreamWriter(MapPath("~/Result.txt"));
          while (wave.Position &lt; wave.Length)
          {
              read = wave.Read(buffer, 0, 8192);
              for (int i = 0; i &lt; read / 4; i++)
              {
                  writer.Write(BitConverter.ToSingle(buffer, i * 4));
              }
          }
      }
  }
  </code></pre>
  
  <p>Here's part of the output on pastebin:<a href="http://pastebin.com/Ve5tym20" rel="nofollow">http://pastebin.com/Ve5tym20</a>
  I couldn't copy the whole thing because it was a ~90mb text file.
  I'm not quite sure how i'm supposed to use this data and whether or not this is the right data in the first place.
  I have spent the past few days looking up how to do this. I have seen Mark Heath's article on autotune, and I have also looked at the BandedSpectrumAnalyzer project.I got a lot of my code from the article but the BandedSpectrumAnalyzer project was kind of confusing to me (i didnt know what part of it did what)
  Help Please???</p>