title: How to generate sounds according to frequency?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/203890/creating-sine-or-square-wave-in-c-sharp">Creating sine or square wave in C#</a>  </p>
  </blockquote>
  
  
  
  <p>I want to generate sounds. Either something like:</p>
  
  <pre><code>MakeSound(frequency, duration);
  </code></pre>
  
  <p>Or:</p>
  
  <pre><code>MakeSound(MyArrayOfSamples);
  </code></pre>
  
  <p>I've found something called: <code>Microsoft.Directx.DirectSound</code> but have read that it has been discontinued. And I couldn't find it as an option for a reference in Visual Studio (2010). I've found <a href="http://www.microsoft.com/en-us/download/details.aspx?id=9977" rel="noreferrer">this link</a> which according to what I've read, is supposed to include it, but am hesitant to use something from 2006 since it might not be supported anymore. And <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb318658%28v=vs.85%29.aspx" rel="noreferrer">this one</a> says it's for C/C++ (despite also saying: "managed code") and I don't want to waste weeks trying to understand how to wrap that into managed code, just to find out I can't do it. The most promising link I've found is <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb280526%28v=vs.85%29.aspx" rel="noreferrer">WaveFormat</a> but I couldn't find how to use it.</p>
  
  <p>I'm <em>not</em> asking how to get the mathematical representation for the sound wave. Nor am I asking how to play an mp3 file or the like. Nor am I looking for third party software or wrappers. Just for a C# / .net solution for a very specific objective.</p>