TUNE - Directory Compressed music player Copyright 1992 Brian Maguire All Rights Reserved DISCLAIMERS TUNE and this manual are presented without warranties, expressed or implied. The author makes no guarantee as to the fitness of this software. TUNE can be copied freely provided the software, including this manual, is copied in its entirety. The user cannot be charged, in whole or in part, except for the cost of reproduction. No part of this package may be used for commercial purposes without written permission from the author. SUMMARY When I looked at the multitude of games available for the 48 I noticed that many used very little sound. The programs that did use sound used a large amount of memory as well. Since I couldn't find anything on the boards that addressed this problem I wrote a few simple programs in hopes that they might stir up interest. These programs are by no means the most efficient way to play a musical tune. The main concept was to condense a series or real numbers normally used by the BEEP command or system binaries used by the setbeep command into a long hex string. Each note is represented by 10 nibbles in the string (5 for the frequency and 5 for the duration). Since musical notes are limited to a small range of frequencies and durations, I could have used a look up table or conversion function and represented each note with 4 nibbles (two for the freq. and two for the duration). If I ever find time (not likely) I might rewrite the programs and include variables to allow the user to change the tempo and key. A graphical user interface for writing the tunes in musical notation might also be nice (kind of like the equation writer). The directory TUNE contains three programs and an example tune list. This list is the music that is played during the opening screen in ANT. I can be converted into a tune string using the program L->H and played with either the TUNE or TUN1. It also contains a sub-directory with examples. These examples were adapted from earlier music programs on the 48. COMMANDS L->H Converts a list of frequencies and durations into a compacted hex string which can be played with TUNE or TUN1. The input list must have matching freq/duration pairs. To create a rest, a frequency of 0 will cause TUNE and TUN1 to remain silent for the specified frequency. For example { 0 1 } is equivalent to 1 WAIT. INPUT OUTPUT ----- ------ List -> Hex string TUNE Plays a tune string created by L->H and displays the message "PRESS ANY KEY..." in the menu area. The tune is repeated until a key is pressed. There is also a loop that checks the time and turns the 48 off after about 5 minutes. If you want the menu area restored or turned off after exiting TUNE use the system RPL command DispMenu.1 or TURNMENUOFF. INPUT OUTPUT ----- ------ Hex string -> TUN1 This program works almost like TUNE with one exception. When the 48 beeps the keyboard input (with the exception of the [ON] key) is disabled. Because of this, pressing a key while in TUNE may not always exit the program. TUN1 prompts the user to press [ON] instead of "any key". INPUT OUTPUT ----- ------ Hex string -> ANT This list is the music played during the opening screen of ANT. To hear it first convert it into a tune string using L->H and then run TUNE or TUN1. Below is a system RPL listing of the directory MUSIC. It was created using the system RPL development library that will be commercially available soon (cheap plug). Although this directory was created using the development library, the listing can be compiled by any of the other system RPL assemblers by modifying it slightly. %%HP: T(2)A(D)F(.); DIR 'L\->H' :: CK1NoBlame DUPTYPELIST? NcaseSIZEERR DUPNULL{}? caseSIZEERR INNERCOMP # 2h #/ SWAP #1= caseSIZEERR HXS 0 SWAP #1+_ONE_DO ROT COERCE #>HXS SWAP !append$ SWAP (1415F) COERCE #>HXS SWAP !append$ LOOP ; 'TUNE' :: CK1NoBlame DUPTYPEHSTR? NcaseSIZEERR DUP LENHXS DUP#0= caseSIZEERR # Ah #/ DROP #0<> caseSIZEERR "PRESS ANY KEY..." DispCoord1 CLKTICKS SWAP # 1h BEGIN 2DUP 2DUP DUP #4+ SUBHXS HXS># UNROT # 5h #+DUP #4+ SUBHXS HXS># DUP#0=ITE :: DROP UNCOERCE % 8.192 %* %># (1A7ED) ; setbeep #10+ 2DUPSWAP LENHXS #> IT DROPONE CLKTICKS 4PICK bit- HXS 6 DEE752 HXS>HXS %0<> IT :: ROTDROP CLKTICKS UNROT TurnOff ; ATTN? GETTOUCH OR UNTIL 3DROP CLEARMENU FLUSHKEYS ATTN? ?SEMI DROP ATTNFLGCLR ; 'TUN1' :: CK1NoBlame DUPTYPEHSTR? NcaseSIZEERR DUP LENHXS DUP#0= caseSIZEERR # Ah #/ DROP #0<> caseSIZEERR "PRESS ON TO CONTINUE" DispCoord1 CLKTICKS SWAP # 1h BEGIN 2DUP 2DUP DUP #4+ SUBHXS HXS># UNROT # 5h #+DUP #4+ SUBHXS HXS># DUP#0=ITE :: DROP UNCOERCE % 8.192 %* %># (1A7ED) ; setbeep #10+ 2DUPSWAP LENHXS #> IT DROPONE CLKTICKS 4PICK bit- HXS 6 DEE752 HXS>HXS %0<> IT :: ROTDROP CLKTICKS UNROT TurnOff ; ATTN? UNTIL 3DROP FLUSHKEYS ATTNFLGCLR CLEARMENU ; 'ANT' { % 220 % .375 % 329 % .1875 % 0 % .375 % 220 % .1875 % 329 % .1875 % 220 % .1875 % 247 % .375 % 294 % .1875 % 0 % .1875 % 247 % .375 % 294 % .1875 % 0 % .1875 } END [Note: Detlef Mller emailed the following: I really enjoyed 'William Tell and friends'; but I have a little suggestion for TUN1: Change :: ROTDROP CLKTICKS UNROT TurnOff ; into :: TurnOff ROTDROP CLKTICKS UNROT ; This change allows the HP 48 to be turned back on (after the 5-minute timeout) with a fresh 5-minute countdown for the timeout. So I made that change to TUNE and TUN1 on the disk, in both the TUNE directory and the TOONS directory. -jkh-] The sub-directory DEMO contains 15 examples that were adapted from earlier music programs on the 48. Tunes adapted from Leland B. Lightfoot's MUSIK directory. 'BACHMAJ' (1st movement of Bach violin concerto in E major) Tunes adapted from Jeffrey Broido's "MUSIC" directory. 'S1.4thM' (Sym 1, C mi, 4th mvt. By J. Brahms d. 1897) 'TLYOU' ("Till There Was You" by Meridith Wilson) 'JPRDY' (Jeopardy! theme) 'OLDHOUSE' (This Old House) 'INDIAN' ("I'm an Indian, too" By Irving Berlin) 'HLiLo' ("Hi Lili, Hi Lo" By Bronuslaw Kaper) 'YSTDAY' ("Yesterday" By Lennon/McCartney) 'JUDE' ("Hey, Jude" By Lennon/McCartney) 'BDAY' (Happy Birthday) 'MTL6' ("Motel Six" By Tom Bodette) Tunes adapted from Greg Beck's MUSIC directory. 'DISNEY' (The Main Street Electric Parade i.e. Disney song) 'INDY' (The Theme from Indiana Jones) 'OLIMPIC' (The Olympic Theme) 'MLDY' (The Theme from the Tom & Jerry Show?) Enjoy, Brian Maguire 139 Kingsbury Dearborn, MI 48128