Page 1 of 1

Play a basic sound in DOS promt (Batch file)

Posted: 18 Feb 2008 21:45
by budhax
Using the DOS command TYPE for some files you can hear a sound, then (in some cases) the process displaying the file's content stops (few characters later). This is my start point idea to play a sound in DOS.

From an Excel file (.xls) I extracted a character playing a sound, and I surrounded it by letter 'a' and 'b' in this file: http://airfirst.ch/b2/SoundChar.txt
In fact, it is just the BELL character in the ASCII table:
http://www.asciitable.com

So, here is a way to play a system sound in DOS:

Code: Select all

ECHO 

where the character after "ECHO " is this BELL character. It looks like a big dot (in EditPlus editor).

Do you know another way to play a sound in DOS?
Any comment, improvement will be appreciate.
Thanks.

"System sound" means sound played by motherboard's speaker, so you can hear it without external speakers or sound card.

Posted: 19 Feb 2008 21:25
by DosItHelp
budhax,
Nice! You can create the bell character directly with your keyboard, i.e. on the command line type:

Code: Select all

c:>echo [ALT+7]

[ALT+7] - hold down the ALT key, type '7' on the number pad, release the ALT key.
On my box [ALT+7] shows up as:

Code: Select all

c:>echo ^G
However typing '^G' is not the same.

Thanks for sharing!
:)

Posted: 29 May 2008 14:58
by davep
Interesting, but I can't reproduce your success.
Microsoft Windows XP [Version 5.1.2600]
Toshiba Satellite A105 X86-based PC

Posted: 30 Jun 2008 04:00
by Thebetr1
A beeper we made years ago ... guess we were bored

Code: Select all

@ECHO OFF
title Beeper
:top
>nul
pause
goto top

Posted: 04 Sep 2008 07:08
by Skeletor
I like using .wav files in my dos scripts

sndrec32.exe /play /close ringin.wav

Posted: 04 Sep 2008 15:55
by carlitos.dll
The author has been removed this message.

Posted: 08 Sep 2008 19:57
by DosItHelp
Skeletor,
I searched a little more and found the /embedding flag allow to run it without UI:
sndrec32.exe /embedding /play /close "C:\WINDOWS\Media\Windows XP Startup.wav"

What a beauty - thanks for sharing!
:wink:


carlitos.dll,
Very interesting. Question: Why do you need expand command, can't the EXE be create directly?
It should be possible to create any binary file, like WAV files. Any examples?
:wink: :?: