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,158
oKtosiTe
  • 9,776

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,158
Nifle
  • 34,998
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
  • 498,455
12

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

python -c "print '\7'"
lgwest
  • 255
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
  • 268
  • 1
  • 8
canopee
  • 81
  • 1
  • 1
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
  • 46,683
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.

WRFan
  • 47
2

Grab NirCmd and run nircmd stdbeep.

digitxp
  • 14,884
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,998
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
  • 394
  • 3
  • 10
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
  • 3,056
  • 7
  • 39
  • 50
-1

Another solution:

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

All the glory to Yuliskov's answer

JinSnow
  • 912