Play a basic sound in DOS promt (Batch file)

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
budhax
Posts: 63
Joined: 09 Oct 2006 12:25

Play a basic sound in DOS promt (Batch file)

#1 Post by budhax » 18 Feb 2008 21:45

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.

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#2 Post by DosItHelp » 19 Feb 2008 21:25

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!
:)

davep
Posts: 24
Joined: 29 May 2008 14:03
Location: Nauf Kakalak

#3 Post by davep » 29 May 2008 14:58

Interesting, but I can't reproduce your success.
Microsoft Windows XP [Version 5.1.2600]
Toshiba Satellite A105 X86-based PC

Thebetr1
Posts: 12
Joined: 30 Jun 2008 02:50
Location: My computer
Contact:

#4 Post by Thebetr1 » 30 Jun 2008 04:00

A beeper we made years ago ... guess we were bored

Code: Select all

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

Skeletor
Posts: 3
Joined: 01 Sep 2008 12:50
Location: Manchester(England)

#5 Post by Skeletor » 04 Sep 2008 07:08

I like using .wav files in my dos scripts

sndrec32.exe /play /close ringin.wav

carlitos.dll
Posts: 11
Joined: 02 Jul 2008 07:42

#6 Post by carlitos.dll » 04 Sep 2008 15:55

The author has been removed this message.
Last edited by carlitos.dll on 30 Sep 2011 22:46, edited 1 time in total.

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#7 Post by DosItHelp » 08 Sep 2008 19:57

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: :?:

Post Reply