"Songs" For Ultra-SiMPLE

(NOTE: The programs discussed on this page might not work properly on all computers.)


The "toys" library in the PLAYPEN project (in Pro-SiMPLE) contains the "song" task that allows you to play any of ten very short musical pieces through your computer's tiny built-in speaker. Unfortunately, Ultra-SiMPLE doesn't provide you with access to that speaker. But now you can incorporate those same "songs" into your Ultra-SiMPLE programs by playing them through your sound card.

First, you will need to check the "SOUNDS" folder (inside your "SiMPLE" folder) to make sure that it contains the "tones.mid" file. (If you don't have the "tones.mid" file, you can download it by right-clicking the following link and selecting "Save Target As..."):

(Right-click Me and Select "Save Target As...")

Then, just "PUT" the following task into one of your libraries, (or simply append the task listing to the end of your source listing):

Task Listing

Presto! You can now incorporate the same ten "songs" that you used in the PLAYPEN into your Ultra-SiMPLE programs!


Want to create your own songs? No problem!

The "tones.mid" file contains 61 musical notes (five octaves) that you can freely use. (Note #24 is middle C.) All you have to do is open the "tones.mid" file and specify which notes you want to be played (and how long you want them to be heard). Then, when you're finished, close the file.

For example, the following program will play notes #24, #26, and #28, each for 500 milliseconds:

            handle = open mci ("\\simple\\sounds\\tones.mid")
            start mci (handle, 24*2998L); delay (500)
            start mci (handle, 26*2998L); delay (500)
            start mci (handle, 28*2998L); delay (500)
            stop  mci (handle); close mci (handle)
And that's how easy it is to create your own music!



  [ Webmaster | FAQ's | Home Page | Contact Us ]