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.

Glorfindel
  • 4,089
  • 8
  • 24
  • 37
oKtosiTe
  • 9,408
  • 9
  • 46
  • 70

12 Answers12

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)

Glorfindel
  • 4,089
  • 8
  • 24
  • 37
Nifle
  • 34,203
  • 26
  • 108
  • 137
  • 3
    Sadly, I'm not content with having the beep come out of the speakers. – oKtosiTe Jan 01 '11 at 16:14
  • @oKtosiTe - Then you're probably out of luck – Nifle Jan 01 '11 at 16:23
  • 1
    Is there any alternative to the numpad for the Alt-7? I only have a laptop and no numpad. – Cajunluke Jan 02 '11 at 13:58
  • @Cajun - Use the On-Screen Keyboard that is included in windows, but make sure you hit the *Options key* (on the on-screen keyboard) and turn on the Numpad – Nifle Jan 02 '11 at 15:46
  • 9
    @CajunLuke, yes, don’t use the Alt-key combo at all for [ASCII control codes](http://i.stack.imgur.com/R5VFt.png) (1-31), just press **`Ctrl+G`**; that’s the Ctrl-key combo for BEL. – Synetech Jun 27 '11 at 04:12
  • This does not work if you are in emacs, sadly – sandos Oct 04 '11 at 08:40
  • 4
    On my Win7 box, I NEED to use ALT-007, not ALT-7. – Cameron Dec 09 '13 at 19:51
  • Don't try doing this under cmder either .. open up a good old fashioned naked cmd.exe – Tim Barrass Jan 25 '16 at 16:50
  • @sandos in Emacs press `C-q` `C-g` to insert a BEL character. – Michel de Ruiter Apr 10 '18 at 07:56
  • 2
    C:\ 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. – Jordan Stefanelli Nov 14 '19 at 18:27
  • Like Jordan says, just press in a cmd window. This pastes the special character seen here: https://pastebin.com/zNYsysGc. Running that character in a cmd command will play the beep sound. You can even just copy-paste that character from the pastebin page above (it's rendered there as a square, but as `^G` in cmd). – Venryx May 21 '20 at 00:20
14

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.
harrymc
  • 455,459
  • 31
  • 526
  • 924
  • 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 07 '11 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 07 '11 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 '14 at 18:54
  • @Jason: Have you tried the beep.sys from a 64-bit XP/Vista? – harrymc Oct 29 '14 at 19:16
  • @harrymc No, but the Microsoft Support article implies 64-bit Vista would not work. Finding a 64-bit XP system is like searching for a unicorn. – Jason Oct 29 '14 at 23:36
  • @Jason: It is to be found in [unicorn here](http://www.filedropper.com/beep_5) (first time I use this file-sharing website). Let me know if it worked (or not). – harrymc Oct 30 '14 at 08:12
  • @harrymc Thank you for the effort, but the result is the same: `This device is either not present, not working properly, or does not have all the drivers installed. (Code 24)` – Jason Oct 30 '14 at 15:50
  • 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 '14 at 16:47
12

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

python -c "print '\7'"
lgwest
  • 255
  • 2
  • 7
  • 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 – Adriaan Koster Oct 03 '13 at 11:21
  • 6
    Since `print` is a function in python 3.x, `python -c "print('\7')"` should work. – Max Truxa Sep 09 '14 at 07:08
  • 2
    Doing this on Windows 10 makes my speakers play the Windows error sound. The beep does not come from the motherboard. :( – DaveTheMinion May 28 '17 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 07 '18 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 06 '19 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.

DiMithras
  • 258
  • 1
  • 7
canopee
  • 81
  • 1
  • 1
  • There was a virus in the download link on the target page!!! – ellockie Dec 16 '13 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 '13 at 10:25
  • 4
    And for **x64 version**, try: http://www.waldbauer.com/tmp/dl.php?download=beepxp64 – rustyx Apr 26 '17 at 08: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 '17 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

bwDraco
  • 45,747
  • 43
  • 165
  • 205
KenshinHeng
  • 87
  • 1
  • 1
  • 2
    Edited the answer to clarify; added an image to show how it works. – bwDraco May 08 '15 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 08 '15 at 23:57
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

Pedro Lobito
  • 784
  • 1
  • 9
  • 19
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.

WRFan
  • 37
  • 2
2

Grab NirCmd and run nircmd stdbeep.

digitxp
  • 14,432
  • 9
  • 56
  • 76
  • 4
    I'm afraid that makes the default speakers beep, not the PC speaker. – oKtosiTe Jan 01 '11 at 16:18
  • 1
    Are you sure it's [enabled](http://www.computerhope.com/issues/ch000725.htm)? – digitxp Jan 01 '11 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 01 '11 at 21:08
  • As far as I can tell, it's enabled in every possible way. – oKtosiTe Jan 01 '11 at 21:15
  • @oKTos Can you make it beep anyhow? – digitxp Jan 01 '11 at 23:32
  • @digitxp: Under Windows XP and Arch Linux: yes. Under Windows 7, so far: no. – oKtosiTe Jan 02 '11 at 02:14
  • 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 '11 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 '18 at 18:44
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)

Nifle
  • 34,203
  • 26
  • 108
  • 137
Robert G.
  • 11
  • 1
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)

Venryx
  • 316
  • 2
  • 8
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.

Nzall
  • 2,905
  • 7
  • 35
  • 47
  • 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 '14 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 '14 at 21:33
-1

Another solution:

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

All the glory to Yuliskov's answer

JinSnow
  • 774
  • 11
  • 25