title: Real low level sound generation in C#?
body: <p>Anyone knows of a sensible way to create an ARBITRARY sound wave in C# and play it back from the speakers?</p>
  
  <p>This issue has been coming back to every now and then for years, I always end up giving it up after a lot of failure without finding a solution.</p>
  
  <p>What I want to do is like a reverse-visualizer, that is, I don't want to generate "numbers" from sound, I want to generate sound from numbers.</p>
  
  <p>Like get a function that I provide with sample rate, sample size, and the sound data (an array of integers for example), and it would generate the appropriate wav file from it (real-time sound playback would be ideal, but I'd be more than pleased with this too). </p>
  
  <p>I know the wav file specifications are all over the interweb, and did make several attempts creating the above function, had some success for low frequencies, but once I start messing with bits per sample etc... it becomes a HUGE, uncontrollable mess.</p>
  
  <p>Is this not already done in any way?
  I wouldn't mind what it uses, as long as there's a .NET managed wrapper for it (and I can access it from the most recent VS to time).
  XNA doesn't support low level audio this way. Also found several examples that claim to achieve something similar, but they either don't work at all, or do something entirely different.</p>
  
  <p>Thank you.</p>