Play a well-known tune

Highlight the following code and save it as a text file called MELODY.BAS
Put it in the same folder as GW-BASIC.EXE. Load it and run it.

10 REM This is a well-known tune.
20 'Note that 0 is used and so is O (for Octave).
30 'Note that either suffix # or + can indicate a sharp.
40 '
60 PARTTUNE$= "DF#A L2 O4 D L4 O5 DD P4"
70 PLAY "T180 DF#A L2 A L4 O4 AA P4 F#F# P4 O3 D"
80 PLAY "DF#A L2 A L4 O4 AA P4 GG P4 O3 C#"
90 PLAY "C#EB L2 B L4 O4 BB P4 GG P4 O3 C#"
100 PLAY "C#EB L2 B L4 O4 BB P4 F+F+ P4 O3 D"
120 PLAY "O4 AA P4 O3 D"
140 PLAY "O4 BB P4 EEG L8 B P8 ML B1 L4 MN G#A ML L3 O5 F#1"
150 PLAY "L4 MN D O4 F# ML L2 F# MN L4 E ML L2 B MN L4 A"
160 PLAY "D P8 D8 D4"
170 END

Previous | Home