Author
Topic: Beep sounds (Read 641 times)

"A long time ago, all PC computers shared a common 8254 programable interval timer chip for the generation of primitive sounds. The Beep function was written specifically to emit a beep on that piece of hardware.

On these older systems, muting and volume controls have no effect on Beep; you would still hear the tone. To silence the tone, you used the following commands:

net stop beep

sc config beep start= disabled

Since then, sound cards have become standard equipment on almost all PC computers. As sound cards became more common, manufacturers began to remove the old timer chip from computers. The chips were also excluded from the design of server computers. The result is that Beep did not work on all computers without the chip. This was okay because most developers had moved on to calling the MessageBeep function that uses whatever is the default sound device instead of the 8254 chip.

Eventually because of the lack of hardware to communicate with, support for Beep was dropped in Windows Vista and Windows XP 64-Bit Edition.

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."

So it is old, but can be used. So you can try this little game (very simple and useless probably) or watch the code. Btw, some values (in the permitted range) will not produce audible sound (if any) and others will not produce the sound with the desired lenght (but this is not my fault) . Come on! is just a game! But you can comment whatever you want (as the forum permits ). Enjoy (or not )

.dataalign 1mens00 byte 'Welcome',0ah,0dh byte '=======',0ah,0dh,0ah byte 'With this simple program you will be able to do some sounds.',0ah,0dh byte 'Just choose the frequency desired and then the',0ah,0dh byte 'time lapse for the tone you have just chose.',0ah,0dh inpbuff byte 256 dup(' ')conname byte 'BEEP SOUNDS',0toneprom byte 0ah,'###############################################################',0d,0ah byte 'Enter the tone for the sound you will create.',0ah,0dh byte 'This tone must be a number that represents the frequency',0ah,0dh byte 'of the tone, using hertz (hz) as the measured unit.',0ah,0dh byte 'Allowed values are in the range of 37-32767: 'msgerror byte 0ah,0dh,'Error, some value was not correct!',0d,0ah byte 'Press ENTER key to continue with the program.'timeprom byte 0ah,'###############################################################',0d,0ah byte 'Enter the time for the sound (the lapse of the sound).',0ah,0dh byte 'It should be a number that represents milliseconds (ms) of sound.',0ah,0dh byte 'This will be the length of the sound: 'caption byte 'CONFIGURATION DETECTED',0content byte 'The beep of your computer is off. This program will not work with the beep off.',0ah,0dh byte 'You can turn it on and later turn it off again.',0ah,0dh byte 'Turn the beep on?',0msgcap byte 'PROGRAM INFORMATION',0msgcont byte 'This program can not continue.',0ah,0dh byte 'You can try it later again.',0mboxcap byte 'CONFIRM PLEASE',0mboxcon byte 'Do you wish to play again?',0mbxcon byte 'Do you wish to turn off the beep again?',0

align 4sayonara: call FreeConsole ; The program finish here, so sayonara to the console window too.

align 4goodbye: push 0 ; Exit code to Windows. call ExitProcess

align 4 checkit: ; We check here the syntax of the entry (just numbers allowed). push ebp mov ebp,esp mov ecx,chrsread dec ecx ; Discard 0ah and 0dh. dec ecx mov esi,[ebp+8] ; This is the address that was stored in esi (that was pushed) I did this ; like an automatic thing (i haven't think yet if it is usefull).

Another problem found, that was corrected: 174 characters are written in the first call to writeconsole (it said 176 before). So no more unwanted character "1" will appear again after pushing the yes button, to play again.