Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Creating a beep sound

Creating a beep sound

Scheduled Pinned Locked Moved C#
question
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sharpiesharpie
    wrote on last edited by
    #1

    how can i create like a beep sound, but make it play through the speakers and not the computer's internal speaker? (so, obviously, Console.Beep() is not what i need).

    M C 2 Replies Last reply
    0
    • S sharpiesharpie

      how can i create like a beep sound, but make it play through the speakers and not the computer's internal speaker? (so, obviously, Console.Beep() is not what i need).

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      You can P/Invoke MessageBeep(). The declaration can be found on pinvoke.net, for example.

      Regards, mav -- Black holes are the places where God divided by 0...

      S 1 Reply Last reply
      0
      • M mav northwind

        You can P/Invoke MessageBeep(). The declaration can be found on pinvoke.net, for example.

        Regards, mav -- Black holes are the places where God divided by 0...

        S Offline
        S Offline
        sharpiesharpie
        wrote on last edited by
        #3

        But those are just system sounds...how can i create my own sound?

        M 1 Reply Last reply
        0
        • S sharpiesharpie

          But those are just system sounds...how can i create my own sound?

          M Offline
          M Offline
          mav northwind
          wrote on last edited by
          #4

          Ok, if the standard beep isn't good enough for you ;P, you can still use the System.Media.SoundPlayer class.

          Regards, mav -- Black holes are the places where God divided by 0...

          S 1 Reply Last reply
          0
          • M mav northwind

            Ok, if the standard beep isn't good enough for you ;P, you can still use the System.Media.SoundPlayer class.

            Regards, mav -- Black holes are the places where God divided by 0...

            S Offline
            S Offline
            sharpiesharpie
            wrote on last edited by
            #5

            Again, i don't want to load an external file, i want to CREATE a sound at runtime

            M 1 Reply Last reply
            0
            • S sharpiesharpie

              how can i create like a beep sound, but make it play through the speakers and not the computer's internal speaker? (so, obviously, Console.Beep() is not what i need).

              C Offline
              C Offline
              Colin Angus Mackay
              wrote on last edited by
              #6

              sharpiesharpie wrote:

              how can i create like a beep sound, but make it play through the speakers and not the computer's internal speaker?

              Is this article on a simple beep[^] what you are looking for?


              Upcoming events: * Glasgow: Geek Dinner (5th March) * Edinburgh: Web Security Conference Day for Windows Developers (12th April) My: Website | Blog | Photos

              1 Reply Last reply
              0
              • S sharpiesharpie

                Again, i don't want to load an external file, i want to CREATE a sound at runtime

                M Offline
                M Offline
                mav northwind
                wrote on last edited by
                #7

                If you said precisely what you want and what you don't want we wouldn't have to guess... :( Anyway, in that case you should start reading about the WAV format. Basically you create a buffer for the audio data, write a WAVEFORMAT (look it up in MSDN) to it and add the samples you want to play. That's the most flexible you can get.

                Regards, mav -- Black holes are the places where God divided by 0...

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups