61

I'm running some lengthy video encodes using the Handbrake command line interface. After all my encodes are done, I would like to have the PC speaker beep, as I usually turn my large external speakers off.

On Linux I would install the "beep" package, but so far I haven't found such a program for Windows 7.

Possibly related links:

Edit: The question seems to have morphed into "How to make Windows 7 beep the PC speaker?", for which the answer provided by HarryMC is the most appropriate.

8
  • 6
    Ctrl+G>enter gets a system beep in command prompt. Multiples of Ctrl+G gets multiple beeps.
    – Moab
    Jan 1, 2011 at 15:41
  • @Dennis Williamson: Yes, but I'm using Windows 7 in this case. I'm mostly aware of my options as far as Linux goes.
    – oKtosiTe
    Jan 1, 2011 at 17:30
  • 2
    @Moab: That doesn't make the PC speaker beep, but the default sound output device.
    – oKtosiTe
    Jan 1, 2011 at 17:31
  • 3
    Some systems default to the PC speaker if there are no other speakers attached.
    – Moab
    Jan 1, 2011 at 18:10
  • 1
    @oKtosiTe Interesting. On my computer with PC speaker and 64bit 7, I hear beep from it when using ^G in CMD.
    – AndrejaKo
    Jan 1, 2011 at 19:40

12 Answers 12

14
+50

It would help to know whether your Windows 7 is 64-bit or 32-bit.

From Default Beep PC Speaker changed in windows 7 – How to get back to old style :

The default beep is controlled by a driver under, c:\windows\system32\drivers\beep.sys. Maybe if you switched it out with a driver from XP/Vista it would increase the volume.

To see this driver you have to open device manager then click on View > Show hidden devices. Then under Non-Plug and Play Drivers you’ll see “Beep.” This is the driver that runs your beep. Right click on it then choose properties and go to the driver tab, then click on Driver Details… This shows the file version which looks like it’s been change with Windows 7. So replace it with an older version and see what happens.

Procedure to follow :

  1. Boot from an UBCD4WIN disc (or BartPE if you don’t have an SATA hard drive)
  2. Take ownership of the “C:\Windows\System32\Drivers\Beep.sys” file and give the local “Administrators” Group “Full Control” permissions.
  3. Rename “Beep.sys” to “Beep.old” (just in case)
  4. Copy “Beep.sys” from an XP machine to this location.
8
  • The Windows 7 I'm working on is 32 bit. Will try to swap beep.sys out with the one from Windows XP.
    – oKtosiTe
    Jan 7, 2011 at 12:26
  • Luckily I dual boot with XP and Arch Linux, so I think I can skip over the Live CD bit. :-)
    – oKtosiTe
    Jan 7, 2011 at 12:33
  • 3
    When I tried this on 64-bit Windows 7, it resulted in the "Beep" device not working. Anyone try this on 64-bit?
    – Jason
    Oct 29, 2014 at 18:54
  • @Jason: Have you tried the beep.sys from a 64-bit XP/Vista?
    – harrymc
    Oct 29, 2014 at 19:16
  • 3
    @Jason: Probably a problem with driver signing that prevents unsigned XP drivers from working on Windows 7 64-bit. This solution is therefore not applicable to Windows 7 or later 64-bit versions.
    – harrymc
    Oct 30, 2014 at 16:47
27

In Windows 7, Beep was rewritten to pass the beep to the default sound device for the session. This is normally the sound card, except when run under Terminal Services, in which case the beep is rendered on the client.

(source) (An article on why) For those who can't be bothered to read: It was to reduce manufacturing cost

But if you are content with having the beep come out of your speakers a simple batch file can do it.

You can write a DOS batch file that beeps by doing the following: at the DOS prompt type:
echo @echo (Alt-7)>beep.bat

but instead of typing the characters: "(Alt-7)", you hold down the Alt key and press 7 on the numeric keypad. Don't use the 7 on the qwerty part of the keyboard, it has to be on the keypad, and Num Lock has to be on.

(source)

11
  • 3
    Sadly, I'm not content with having the beep come out of the speakers.
    – oKtosiTe
    Jan 1, 2011 at 16:14
  • 1
    Is there any alternative to the numpad for the Alt-7? I only have a laptop and no numpad.
    – Cajunluke
    Jan 2, 2011 at 13:58
  • 9
    @CajunLuke, yes, don’t use the Alt-key combo at all for ASCII control codes (1-31), just press Ctrl+G; that’s the Ctrl-key combo for BEL.
    – Synetech
    Jun 27, 2011 at 4:12
  • 4
    On my Win7 box, I NEED to use ALT-007, not ALT-7.
    – Cameron
    Dec 9, 2013 at 19:51
  • 2
    C:\<CTRL+G><enter> will Beep every time, or in newer versions, issue the Windows default error sound. I replace my windows default error sound with a nice smooth 808 kick drum so there's positive reinforcement. The old Windows Beep sound, which was probably full-volume 1-bit PCM, most likely violated OSHA standards for maximum volume for human ears. That sound, repeatedly, would certainly damage a human's ears, at minimum it would cause that band of the frequency spectrum to die out faster during their lifespan. This is anecdotal, but logical af. Nov 14, 2019 at 18:27
12

If you have python 2.x installed this line in a bat-file works

python -c "print '\7'"
5
  • I get "SyntaxError: invalid syntax" when I try this with Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32 Oct 3, 2013 at 11:21
  • 6
    Since print is a function in python 3.x, python -c "print('\7')" should work.
    – Max Truxa
    Sep 9, 2014 at 7:08
  • 2
    Doing this on Windows 10 makes my speakers play the Windows error sound. The beep does not come from the motherboard. :( May 28, 2017 at 23:23
  • Alternative with Perl: perl -e "print qq(\x07)". If you have strawberryperl portable, you can use portableshell.bat -e "print qq(\x07)"
    – Benoit
    Sep 7, 2018 at 12:46
  • I had my Sound Scheme set to No Sounds and was wondering why I wasn't hearing anything. Make sure to have a sound scheme with an audible error sound.
    – mic
    Aug 6, 2019 at 20:19
8

This little VDD driver fixes a problem with the Windows 7 NTVDM where the PC Speaker output is not wrapped correctly.

This may be due to the fact that the functionality of the BEEP.SYS System driver was moved to the Usermode Sound Agent. For further information, see the blog of Larry Osterman.

This driver tries to fix the problem by hooking the NTVDM-Function responsible for the Beep (LazyBeep) and replaces it with our own implementation that has various options to fix the problem.

4
  • There was a virus in the download link on the target page!!!
    – ellockie
    Dec 16, 2013 at 13:28
  • Some virus scans are giving positives on the download, but due to the nature of the program these could be false positives. The source code is included, so everyone is free to check it out as well if they are unsure.
    – slhck
    Dec 29, 2013 at 10:25
  • 4
    And for x64 version, try: waldbauer.com/tmp/dl.php?download=beepxp64
    – rustyx
    Apr 26, 2017 at 8:25
  • 1
    RustyX Thank you so much!! This was the only thing that finally worked! Beautiful! My UPS alarm is working again! All praise beepxp64.
    – Zdenek
    Sep 15, 2017 at 18:19
7

Try start'ing a fake file that doesn't exist. That makes both a popup and the beep sound, but I'm not sure if you want the popup or not...

enter image description here

2
  • 2
    Edited the answer to clarify; added an image to show how it works.
    – bwDraco
    May 8, 2015 at 23:48
  • 8
    Unfortunately, this won't generate a beep from the PC speaker if there is an actual sound device. It would be necessary to disable the sound device in Windows.
    – bwDraco
    May 8, 2015 at 23:57
2

Grab NirCmd and run nircmd stdbeep.

8
  • 4
    I'm afraid that makes the default speakers beep, not the PC speaker.
    – oKtosiTe
    Jan 1, 2011 at 16:18
  • 1
    Are you sure it's enabled?
    – digitxp
    Jan 1, 2011 at 17:56
  • @digitxp: The BIOS beep and the ability to issue beeps from the Linux console lead me to believe it is, but you raise a valid point. I will investigate.
    – oKtosiTe
    Jan 1, 2011 at 21:08
  • 4
    I agree with oKtosiTe; nircmd plays the beep sound through the sound card, NOT the internal speaker; even in XP. From NIRCMD.CHM: Plays the standard beep of Windows.
    – Synetech
    Jun 26, 2011 at 18:56
  • 2
    nircmd beep 1000 1000 does what you want on my computer where beep uses the soundcard (try also nircmdc beep 440 1000). Can anyone with more reputation post an answer based on this?
    – Aur Saraf
    May 13, 2018 at 18:44
2

The following seems to work on windows systems with py2 or py3:

cmd line:

python -c "import winsound; winsound.PlaySound('SystemExit', winsound.SND_ALIAS);"

Docs

2

wonderful, the non-MS driver you mentioned above is working! Beeep! Someone suggested above trying beep.sys from WinXP x64, but you overlooked something (I did too):

https://docs.microsoft.com/en-us/windows/win32/api/utilapiset/nf-utilapiset-beep

support for Beep was dropped in Windows Vista and Windows XP 64-Bit Edition.

Hear that? "Windows XP 64-Bit". This has nothing to do with driver signing, although driver signing is mandatory on x64 systems, which is very annoying, on Win10 x32 I just copied the MS driver from WinXP to Win10 and it was starting all right, but on Win10 the driver MUST be signed, despite all the nonsense mentioned on the internet concerning the "testsigning" and "nointegritychecks" bcdedit params. Let me clarify this once and for all. If the "driver signature enforcement" is not disabled in the advanced menu of the Windows Boot Manager:

a) you can NOT install a driver unless a catalog (cat) file is present. The "this driver package does not contain a catalog file, proceed?" confirmation prompt is NOT presented AT ALL, instead installation fails silently (pnputil, infdefaultinstall). setupapi.dev.log contains weird entry:

Driver package does not contain a catalog file, and Code Integrity is in Test Signing mode.

Driver package failed signature validation. Error = 0xE000022F

or:

The third-party INF does not contain digital signature information.

So? If test signing is on, why not prompt? Go ask Microsoft. Because if "driver signature enforcement" is disabled during boot, the confirmation dialog is presented, and it will say

Driver package does not contain a catalog file, and user does not want to install driver package.

or "wants to install" depending on what the user decides to do

b) You cannot start an UNSIGNED driver. What's ridiculous about this, you CAN start an IMPROPERLY signed driver. Like my certificate I use for driver signing is kind of invalid, despite being granted any and all "keyUsage"-s and "extendedKeyUsage"-s:

keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign

extendedKeyUsage = anyExtendedKeyUsage, 1.3.6.1.4.1.311.10.12.1, serverAuth, clientAuth, codeSigning, emailProtection, timeStamping, OCSPSigning, msCTLSign, msEFS, 1.3.6.1.5.5.8.2.2, 1.3.6.1.4.1.311.10.3.2, msCodeInd, msCodeCom, msEFS, 1.3.6.1.4.1.311.10.3.4.1, 1.3.6.1.4.1.311.10.3.5, 1.3.6.1.4.1.311.10.3.6, 1.3.6.1.4.1.311.10.3.7, 1.3.6.1.4.1.311.10.3.8, 1.3.6.1.4.1.311.10.3.9, 1.3.6.1.4.1.311.10.3.10, 1.3.6.1.4.1.311.10.3.11, 1.3.6.1.4.1.311.10.3.12, 1.3.6.1.4.1.311.10.5.1, 1.3.6.1.4.1.311.10.6.1, 1.3.6.1.4.1.311.10.6.2, 1.3.6.1.4.1.311.20.1, 1.3.6.1.4.1.311.21.19, 1.3.6.1.4.1.311.20.2.1, 1.3.6.1.4.1.311.21.5, 1.3.6.1.4.1.311.21.6, 1.3.6.1.4.1.311.10.3.13, 1.3.6.1.4.1.311.20.2.2, 1.3.6.1.5.5.7.3.5, 1.3.6.1.5.5.7.3.6, 1.3.6.1.5.5.7.3.7

something about "basicConstraints" Windows doesn't like, probably this:

basicConstraints = CA:true

so the "digital signature" dialog (explorer, right click driver file, "signatures" tab) whines about it:

Die Erweiterung für die Basiseinschränkung eines Zertifikats wurde nicht eingehalten.

Dieses Zertifikat ist ungültig, da eine der Zertifizierungsstellen im Zertifizierungspfad nicht berechtigt ist, Zertifikate auszustellen oder es kann nicht als Endeinheitszertifikat verwendet werden.

but the driver is still started. Microsoft and security. But as I said, the MS driver not beeping is not due to this, but simply because there is no MS beep.sys x64-bit that is actually beeping. Plus, what about this function?

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebeep

Definitely not beeping either, in fact, I get no sound either through the sound card or through the speaker. neither with "Beep", nor with "MessageBeep". MS states:

Beep was rewritten to pass the beep to the default sound device for the session. This is normally the sound card

"Normally the sound card" all right, but what about their own Windows PE? WinPE does not come with an audio driver, so beeping through the sound card will not work, unless you rip out the drivers from Windows 10 Enterprise and integrate them into WinPE or something. Does not matter anyway, 'cause, as I said, the Beep function is NOT beeping through the sound card on my Windows 10 Enterprise either, although the sound card is working there.

1

The answer of "canopee" is THE answer! That driver he links to, is the only one getting the beep() back for windows 7 64bit. I tried it and can confirm that it's working like a charm.

Alternatively you might consider downloading "buzzer.exe" from http://encode.ru/threads/383-A-command-line-tool-for-Windows-which-beeps-through-the-System-Speaker as well, which helps using the pc-speaker from commandline even more. It supports custom frequencies and repeatings.

I am not connected to waldbauer.com or encode.ru in any way, i was just searching for a solution to the missing beep, found it, and wanted to help "spread the word"!.. o)

0

If you turn off your external speakers, you don't use them for anything else. So you can also just disconnect them from your computer so the beep command goes through the PC speaker. No extra software or driver transplants required. You just need to remember to reconnect them afterwards.

2
  • 1
    Disconnecting the speakers doesn't make the sound go through the PC speaker. Windows 7 doesn't even normally address the PC speaker anymore, as has been pointed out in some of the other answers and comments. Besides, I do use them on a regular basis, just not 100% of the time.
    – oKtosiTe
    Jan 22, 2014 at 21:32
  • Not that it matters anymore. The PC in question has since died and I now use an ultrabook on a daily basis, which does not have a dedicated PC speaker. Instead I now use a set of desktop speakers (3.5mm) for notifications and most games and the large, wall-mounted speakers (HDMI) for music and movies.
    – oKtosiTe
    Jan 22, 2014 at 21:33
0

This is based on Nifle's answer, but simplified. Rather than having to mess with the numpad, and writing to a temp batch file, I've just pasted the character itself below.

Special "play bell sound" character: https://pastebin.com/zNYsysGc

There are two ways to use it:
1) Copy the character on the page above, and paste it at the end of a cmd command. (eg. echo "hi"; <special_char>)
2) Enter the character yourself, by just pressing ctrl+g on your keyboard, when in the cmd window.

Running that character in a cmd command will play the beep sound. (I use it to notify me when a long-running task has completed)

EDIT: Also, a fast way to get the special character in your clipboard (eg. for pasting into batch files), is by typing the following command: echo <Ctrl+G> | clip (tip from here)

-1

Another solution:

start wmplayer "C:\Windows\Media\Alarm10.wav" && timeout 5 && taskkill /im wmplayer.exe

All the glory to Yuliskov's answer

2
  • That will create a popup window, likely breaking workflow.
    – oKtosiTe
    Jun 20, 2020 at 10:13
  • @oKtosiTe yes it creates a popup windows, but it doesn't break the workflow (the script continues after that)
    – JinSnow
    Jun 21, 2020 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .