Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to make a sound from PC Speaker using 9x GUI batch?

Featured Replies

I've been trying to make a beep by using batch file in a DOS window of 95/98 system. All I could get was a very short sound same as the Windows error condition sound.

Without GUI everything is working as it should to, but in DOS window the PC Speaker sounds are less than audible.


  • Author

It says the application performed an illegal operation (or something like that, since I'm working with a polish version of Windows 98).

echo ctrl-G gives an ascii bell - makes a beep in xp but sounds like ding.wav on 98.

  • Author

I wouldn't say it is a ding.wav like sound. It's rather the sound generated when a wrong key is pressed. It's more a tick than a soud. So, it's hardly audible and hardly useful.

Edited by Sfor

Second try:<br /><br />rundll32 shell32.dll,Control_RunDLL user32.dll,MessageBeep,-1<br /><br />Instead of -1 you can also try 0, 16, 32, 48, 64

Edit:

Ehm, sorry, this doesn't work.

Edited by Mijzelf

Are you helped by a small executable?

#include <dos.h>
#include <stdlib.h>
#include <stdio.h>

int main( int argc, char **argv )
{
if( argc != 3 )
{
printf( "use beep frequency (Hz) duration (sec)\n" );
return 0;
}

sound( atoi( argv[ 1 ] ) );
sleep( atoi( argv[ 2 ] ) );
nosound();
return 0;
}

Compiled version here

  • Author

Well. The program works. But, a batch made that way is hardly a portable one.

Also, I made my own program in Borland Pascal. The resulting EXE file is just a half size of a COM made by C compler.

Program Beep;

uses CRT;

var Tone,Duration: Word;
Check: Integer;

begin
if ParamCount<=2 then
begin
Writeln;
Writeln ('BEEP Frequency Duration');
Writeln;
Writeln (' Frequency - Hz');
Writeln (' Duration - mS');
Writeln;
Tone:=800;
Duration:=1000;
end
else
begin
VAL (ParamStr(1),Tone,Check);
VAL (ParamStr(2),Duration,Check);
end;
Sound (Tone);
Delay (Duration);
NoSound;
end.

Certain things in 95/98 are backward when it comes to the API, so you have to code for them in assembler instead to get the functionality (which is a pain to be truthful). The program solution is the only valid one for 95/98 for this reason (the HLLs posted have this functionality).

Try AutoHotkey -> SoundBeep [, Frequency, Duration]

Actually, AHK can do a lot of marvellous things. I'm playing with it a lot. ;)

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.