Sound question

One last question: Unlike many other people who like to know about adding a sound file (.wav, .mp3), I would like to know how to get my program to just make that *lovely* beep sound that I was all to found of in QBASIC.
I would like to know how to get just a simple beep when the user clicks a wrong button.

Since I am so old school and out of touch with C#, I can only provide an example of it in QBASIC

CLS
BEEP
END

Any simple way of doing this in C#




Answer this question

Sound question

  • su45937

    Why end the madness anytime soon Hmmmm..........Now if only I could disable my laptop from being powered down........
    I'm proving to be quite the evil genious....

  • sql server2000

    V.Tortola wrote:
    A developer torturing to its users ... great!!

    bah! lol...indeed sounds like it. Why don't you just attach a robotic USB arm to the computer, and use the SerialPorts class to maybe smack the user (just kidding)



  • Kirill Sukhonosenko

    LOL! Kinda reminds me of a program I wrote for QBASIC about 1-1/2 years ago to annoy the *** out of my dad.
    Had it so it would constaintly beep until a key was pressed while the screen flashed

    WAKE UP!!!!

    in 256 colors flashing randomly while he tried to sleep on the couch. Scared the *** out of him! Was well worth the scoulding to see the look on his face.



  • Kirk Lipscomb

    there isnt much you can really do in this case apart from increase the frequency and increase the duration for the system beep and maybe maximize your form and randomly change colors every second using a timer or something until a key was pressed on the form which would end it all.

  • NoDozing

    lol QBASIC -> C#

    in .NET 2.0 there is a soundplayer class which you can play sounds, including system default ones but would play on the computer speakers than the computer itself. Would this be suitable

    System.Media.SystemSounds.Beep.Play();

    to get it to play the beep through the system speaker, you would need to P/Invoke kernel32.dll and use the Beep() API. Import the System.Runtime.InteropServices

     

    [DllImport("kernel32.dll")]
    public static extern bool Beep(int freq,int duration);

    ...

    ...


    Beep(1000,1000);



  • Neeraj Jain

    A developer torturing to its users ... great!!


  • David J Oldfield

    The beep was not as annoying as I hoped ;)

    It works great. If you can think of another system sound thats a ton more annoying, I could use it as an alarm clock! Any ideas



  • DavidThi808

    you can increase or decrease the freq from the first parameter to increase the pitch

  • Sound question