Friday, September 01, 2006

PlaySound.exe replaces Beep.exe

All I want my computer to do is play a sound when it's ready for me to log in. That's not the same as getting a login screen. After all, this is Windows XP and it has lots to load in the background, and if I hurry it along too much some of the stuff doesn't work properly. I guess 512MB RAM just isn't enough any more.
After scouring the net unsuccessfully for a beep.exe that actually plays anything, I wrote one. Actually, it turns out to be pretty easy to do. You can download PlaySound.exe from this link. You get a ZIP file that contains a small VB app called PlaySound.exe and a test .wav file of Linus Torvalds pronouncing Linux. Now all I need is something similar for uBuntu Linux.
To run it, just specify PlaySound.exe and the .wav file you wish to play. By default it plays "c:\windows\media\The Microsoft Sound.wav" or if not found, you get a standard "beep".
You must have the Visual Basic 6 Runtime libraries installed, and it needs winmm.dll, which is a standard part of Windows 98 and Windows XP operating systems. It uses the PlaySoundA function call in this DLL.
Now the only thing I can't figure out is how to get the sound to play once all the services are loaded and it's OK to log in. At present I just wait for the hard drive light to stop working. It takes about 3 minutes from power on.
Update 4-June-2007: I have added a second parameter which causes a delay (in seconds) before the file is played. The link now takes you to the PlaySound page.

3 comments:

  1. Excellently done.

    Thank you much.

    Nicholas

    ReplyDelete
  2. Could you post an executable file that just plays a single beep? Nothing fancy, that way we've got something very portable. Shockingly I have found nothing like this.

    ReplyDelete
  3. I don't have any tools for writing standalone EXE's. You'll have to ask a Delphi or C developer to do this for you.

    Playsound plays a beep if it can't find the sound file you specified, but it relies on the VB6 runtime libraries, so it isn't fully portable.

    ReplyDelete

The last 50 anonymous "comments" have been spam, and were deleted before being published. I have disabled anonymous commenting for a while, until the spammers go away. I appreciate all genuine comments, and publish all comments that are on topic and not spam.