Back | Reverse | Quick Reply | Post Reply |

PC Speaker songs!
Link | by niniel1 on 2007-11-14 22:30:47
I apologize in advance for the length of this header.

As your all know, a computer has two speakers: the one that you plug in the back and the one ingrained into the motherboard.
You can make the one ingrained into the motherboard play a song, which is awesome.
The easiest way to do this is through the AutoHotKey program, which you can download online.

Then, simply open up Notepad, write the key you want to start the song then::, for example
space::
Next line, write SoundBeep, frequency in hertz, duration in milliseconds.
return
Note: #t:: means press windows key and t, #means windows, wierd, huh?
You can grab a piece of sheet music, look up the values online at websites like www.vibrationdata.com/piano.htm, and then simply find a ratio of half notes, quarters, eights, etc that fits the desired tempo, and get programming.

To run, save the program, right click, open as, browse for autohotkey, open, then press the key you wrote at the top.

An example of one note, (open up notepad, copy paste, open through Autohotkey, press w):

w::
SoundBeep, 523, 400
return

You just played high C!

Heres a song, go ahead and try it out:

#t::
SoundBeep, 349, 400
Sleep, 33
SoundBeep, 392, 133
Sleep, 33
SoundBeep, 440, 267
Sleep, 33
SoundBeep, 440, 267
Sleep, 33
SoundBeep, 392, 133
Sleep, 33
SoundBeep, 349, 133
Sleep, 33
SoundBeep, 392, 133
Sleep, 33
SoundBeep, 440, 133
Sleep, 33
SoundBeep, 349, 267
Sleep, 33
SoundBeep, 262, 267
Sleep, 33
SoundBeep, 349, 400
Sleep, 33

SoundBeep, 392, 133
Sleep, 33
SoundBeep, 440, 267
Sleep, 33
SoundBeep, 440, 267
Sleep, 33
SoundBeep, 392, 133
Sleep, 33
SoundBeep, 349, 133
Sleep, 33
SoundBeep, 392, 133
Sleep, 33
SoundBeep, 440, 133
Sleep, 33
SoundBeep, 349, 533
Sleep, 33
return

If anyone else writes a song, post it in this thread so others can listen to it!

Re: PC Speaker songs!
Link | by gendou on 2007-11-14 22:33:01 (edited 2007-11-14 22:35:01)
cool.
could this be done as a batch file, too?


Re: PC Speaker songs!
Link | by niniel1 on 2007-11-14 23:36:26
Yup!
It's a tad more complicated, but more versatile as well. Some of this you may already know, but I want to write this so that anyone can make a beep as a batch file.

Write:
BEEP (switches)

Beep will play a default frequency of 262 hertz, kinda boring. To change this, use these switches:
/F=frequency in hertz. For example, BEEP /F262 plays middle C with 262 hertz.
/L=length in milliseconds. For example, BEEP /F262 /L500

NOTE: In place of frequency, you can use this switch:
/H[-|+|++]n[@|#]
H denotes octave, by default the octave of middle C
Either -,+, or ++ can be put in afterwards.
- denotes one octave below middle C
+ denotes oen above
++ denotes two above
n denotes the note to play
@ denotes a flat
# denotes a sharp

For example:
/H++D@= D flat, two octaves above middle C


More switches:
/K= keep beeping after note ends, removes staccato affect
/R= rest, play no sound for time specified by /L


You can even put in text to run with your program with these switches:
/p' message'= message to be said, for example /p' black' would say black
/V= verbose mode, prints text: "beeping at ## Hz for ## milliseconds"
/C= clear text printed by /P and /V
/N=print a new line, "skip" lines
/?= bring up a help screen, show syntax of beep, overrides other switches

At the start of the program, you have to put @ECHO OFF, and at the end put ECHO


Example:

@ECHO OFF

BEEP /HE /L500 /P'Mar' /K
BEEP /HD /L100 /P'y' /K
BEEP /HC /L300 /P' ha' /K
BEEP /HD /L300 /P'd' /K
BEEP /HE /L300 /P' too'
BEEP /HE /L300 /P' much'
BEEP /HE /L700 /P' ham,' /N

BEEP /HD /L300 /P'too'
BEEP /HD /L300 /P' much'
BEEP /HD /L700 /P' ham,' /N /K

BEEP /HE /L300 /P'too' /K
BEEP /HG /L300 /P' much'
BEEP /HG /L700 /P' ham,' /N /K

BEEP /HE /L500 /P'Mar' /K
BEEP /HD /L100 /P'y' /K
BEEP /HC /L300 /P' ha' /K
BEEP /HD /L300 /P'd' /K
BEEP /HE /L300 /P' too'
BEEP /HE /L300 /P' much'
BEEP /HE /L300 /P' ham,' /N

BEEP /HE /L300 /P'at' /K
BEEP /HD /L300 /P' this'
BEEP /HD /L300 /P' year's' /K
BEEP /HE /L300 /P' Thanks' /K
BEEP /HD /L300 /P'giv' /K
BEEP /HC /L1000 /P'ing.' /N

ECHO.

Back | Reverse | Quick Reply | Post Reply |

Copyright 2000-2024 Gendou | Terms of Use | Page loaded in 0.0023 seconds at 2024-12-28 21:05:21