title: Play a tone while key is down C#
body: <p>I'm building a piano console application that plays a beep/tone with a specific frequency for a specific amount of time. Help
  Eventually play the tone as long as the key is pressed.
  P.S eventually play several tones at once</p>
  
  <pre><code>namespace something
  {
  
   public class piano
   {
  
    [DllImport("kernel32.dll")]
    static extern bool Beep(uint dwFreq, uint dwDuration);
  
    public static void  Main (string [] args)
      {
  
       Console.WriteLine("This is a piano.");
  
    //The following code is wrong but you get the idea
       char x = KeyDown;
       switch(x)
  
       case "q":
       Beep(523,500);
       break;
  
       case "w":
       Beep(587,500);
       break;
  
       //etc
  
       default:
       break;
     }
    }
   }
  </code></pre>