BeepEx - A Beep for all Windows

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]




Search WWW


As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.


Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 


We receive a few cents from each purchase.  Thanks


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa 365 Puzzlers  Calendar 2017

Mensa 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)


Feedback:  Send an e-mail with your comments about this program (or anything else).

Search only




Windows has a synchronous Beep function which allows the caller to specify the frequency and duration of the beep.   Synchronous means that the function does not return until the beep has ended.   Unfortunately, the function ignores frequency and duration if called from Windows 95, 98 or ME.   Even worse, the function operate asynchronously, i.e. it returns immediately.  If the program needs to sound multiple beeps, there is no way to know when the first beep has completed so that the second can begin.     

Here's a program that addresses the situation with a BeepEx procedure that  synchronously plays sounds of a specified frequency and duration under all Windows operating systems.   

The key is to directly address the PC Speaker with a small bit of assembly language code which I found in a unit named BleeperBleeper is one unit in a freeware download by Andy Preston named BleeperInt available from and a few other places.   Bleeper is also included with this demo.  .

The demo allows users to set a frequency and duration and sounds the appropriate beep when a button is clicked.  A second button plays a major scale starting at the specified frequency and playing each note for the specified duration.    

Radio group buttons allow you to test the  Windows version of Beep vs. the new BeepEx.  For Windows  NT. 200 and XP, there should be no difference.  For lower Windows versions, a big difference!  

Addendum April 13, 2007:   Viewer Samuel from one of my favorite European countries, The Netherlands, recently sent me the numeric codes for a Minor scale and said that he was working on a full 88 key piano keyboard.  That may exceed the capacity of a PC speaker to reproduce, but I wish him luck.   I added it and a chromatic scale today.   Also added a "melody player" procedure, PlayTune, which takes an array  integer pairs representing the frequency and duration of each note.   Now if someone just writes a "tune editor" it could play more than one song.  

Download Source Code

Download Executable

Created: February 23, 2004

Modified: May 12, 2018


  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2018, Gary Darby    All rights reserved.