Subject: ~{?(@2#o#k#:HCNR;6O2HCNRSG

From: [email-masked] (HAN ZHU)
Date: 10 Dec 93 02:38:46 GMT

10 'This program is altered from Zeng's original program without permission
20 'For the original program, please see ifcss.org
30 '
40 ' ~{HCNR;6O2HCNRSG~}
50 'The program is altered so that it will sing the above song directly
60 'as a Karaoke.
70 'Apology for any inconvenience to the original authors
80 'Save this file as songprg.bas, then type
90 'qbasic /run songprg.bas
100 '
110 DATA  "{C100}          0//"
120 DATA "~{HCNR;6O2HCNRSG"
130 DATA "<0.v5/  3  2/1/> |1 <1/  2 3/5>  5 <<6 7>>|^1 <<6545>>5.<<6 7 >>"
140 DATA "~{  0.  5=>!!!    M782  K.DQ    JU#,0.SF    SF!!:^SF!!SF#,N*:N"
150 DATA "<^1^1 6/5 5/5- <3 2 2 1>> <22 1v6/3/2-    v5/ 3 2/>"
160 DATA "~{R*5=N^7(MlAt!!2ESVOkFp!!!!Dc5DNB!!Ha#?!!8x  NR9X~}"
170 DATA "<11   1 2/3/5 5-  6/7/  ^1^1^2/^3 5/5-- 6/7/>"
180 DATA "~{;3!!N*NR=b!!SG#,N*NR!!F=LmPm6`!!  3n#,TZIn~}"
190 DATA " <^1^1^2/35/5-  3/3/5 3/2/2--  01 1 2/1/> 1-- <06/7/>"
200 DATA "~{R9N^>!!!5H:r#,6@WT!!@a!!Ao#,!!6@WTHL!!!!J\!#!!6`Ok~}"
210 DATA " <^1^1/ ^1/ ^1/17/6/5/5-  3/5/6 6 6 5/3/ 110. 1/>"
220 DATA "~{K5Iy  NR  Uf!!5D0.  Dc#,6`OkK5Iy6T2;Fp!!Dc#,Dc~}"
230 DATA "<<2 2 2-  2 2 3 2---- 3-56>>6--   ^1/ 7/6---"
240 DATA "~{?^WEK5!!T5GiRQ>!!!!!DQTY!!Px#,!!DQ  TYPx#!~}"
250 DATA "00<<0-- 5 ^15{C+} 1 2   3v5v5v5   4-3 3   2 2 2v6>  3 2   >"
260 DATA "~{    !!>MGkDc    8xNR!!6`R;5c5c!!J1<dTY!!6`R;5c5c!!NJ:r#,"
270 DATA "<<{C+}1 1 1v6   2-1 1---v51v5 1 2   3v5v5v5   4-3 3 2 2 2v6>3 2 >"
280 DATA "~{    2;R*R;GP!!6<4xW_#,>MGkDc8xNR!!6`R;5c5c!!?U<dTY6`R;5c5cNBHa"
290 DATA "<<{C+}1 1 1v6   2-1v6>1>1.{C}0 <3<21>>1  <1/2 3/ 5> 5   6// 7//"
300 DATA "~{    2;R*HCNR!!Hg4KDQ!!J\!#!!!!DcUb!!Qy  R;8vE+  !!HK#,HC  NR"
310 DATA "< ^1^16/5 4/5>5 <<6 7>  ^1^16/5 5/5- <321 1>>2-- <1/21/>1---"
320 DATA "~{;6O2HC!!NR!!SG#,HCNR!!8JPDN*  AKDc  863vNR!!  !!!!Ky  SP!#~}"
500 NUM% = 22
510 '
1000 umax = 2000: DIM u$(umax), v$(umax)
1010 Q = 120: cr$ = CHR$(13)
1020 DEF FNA$ (H) = MID$(STR$(INT(H + .5)), 2)
1025 u = 1: u$(1) = "": L = 1: m = 0: ML = 32767: Q0 = 1: QT = 0
1030 CLS : LOCATE 1, 1': FILES "*.sng"
1031 'INPUT "Song data file: ", mu$: IF mu$ = "" THEN END
1032 'OPEN "i", 1, mu$: CLS
1040 FOR ii = 1 TO NUM% / 2'IF EOF(1) GOTO 1630
1042 READ a$: i0 = 1: v$(u) = v$(u) + cr$ + cr$: PRINT : PRINT
1045 READ b$: b$ = MID$(b$ + SPACE$(80), 1, 80)
1050 FOR i = 1 TO LEN(a$)
1060 t$ = MID$(a$, i, 1)
1070 IF (t$ < "0" OR t$ > "7") AND t$ <> "X" GOTO 1130
1080   IF K = 1 THEN GOSUB 1660: GOTO 1060
1090   K = 1
1100   m = m + VAL(t$) / 7 * 12 - .5
1110   IF t$ = "0" OR t$ = "X" THEN O = 1
1120   GOTO 1590
1130 ON INSTR("/.-+^v<>#b{(| ", t$) GOTO 1150, 1160, 1170, 1180, 1190, 1210, 1220, 1250, 1280, 1300, 1320, 1500, 1590, 1590
1140 PRINT "Irrecognizable note:"
1142 PRINT a$: PRINT SPACE$(i - 1); "^": END
1150 L = L / 2: GOTO 1590
1160 L = L * 1.5: GOTO 1590
1170 L = L + 1: GOTO 1590
1180 P = 1: m = 0: L0 = L: K = 0: GOTO 1590
1190 IF K = 1 THEN GOSUB 1660
1200   m = m + 12: GOTO 1590
1210 IF K = 1 THEN GOSUB 1660
1215 m = m - 12: GOTO 1590  'Lower octave
1220 QT = QT + 1: IF K = 1 THEN GOSUB 1660
1230 IF MID$(a$, i + 2, 1) = "_" THEN QQ = VAL(MID$(a$, i + 1, 1)) / 2: QM(QT) = QQ: Q0 = Q0 * QQ: i = i + 2: GOTO 1590
1240 QM(QT) = 2: Q0 = Q0 * 2: GOTO 1590
1250 IF K = 1 THEN GOSUB 1660
1260 IF QT = 0 THEN Q0 = Q0 / 2: GOTO 1590
1270 Q0 = Q0 / QM(QT): QT = QT - 1: GOTO 1590
1280 IF K = 1 THEN GOSUB 1660
1290  m = m + 1: GOTO 1590
1300 IF K = 1 THEN GOSUB 1660
1310  m = m - 1: GOTO 1590
1320 IF K = 1 THEN GOSUB 1660
1330   M0 = 36
1340   i = i + 1
1350   t$ = MID$(a$, i, 1)
1360   ON INSTR("}+-#b", t$) GOTO 1590, 1550, 1560, 1570, 1580
1370   IF t$ >= "0" AND t$ <= "9" GOTO 1410
1380   IF t$ < "A" OR t$ > "G" GOTO 1140
1390   M0 = M0 + INT(((ASC(t$) - 67) * 12 + 5) / 7)
1400   GOTO 1340
1410   m$ = ""'Tempo to Q
1420   IF t$ < "0" OR t$ > "9" GOTO 1480
1430   IF EL = 1 OR ES = 1 GOTO 1340
1440   v = 1
1450   m$ = m$ + t$
1460   i = i + 1
1470   t$ = MID$(a$, i, 1): GOTO 1420
1480   IF v = 1 THEN Q = VAL(m$): v = 0
1490   GOTO 1360
1500   m$ = "": IF K = 1 THEN GOSUB 1660
1510   i = i + 1
1520   t$ = MID$(a$, i, 1)
1530   IF t$ <> ")" THEN m$ = m$ + t$: GOTO 1510
1540   GOSUB 1890: GOTO 1590
1550   M0 = M0 + 12: GOTO 1340
1560   M0 = M0 - 12: GOTO 1340
1570   M0 = M0 + 1: GOTO 1340
1580   M0 = M0 - 1: GOTO 1340
1590 NEXT i: IF K = 1 THEN GOSUB 1660
1600 NEXT ii 'GOTO 1040
1610 RESTORE
1630 PLAY "MFMN": LOCATE 2, 1
1631 COLOR , 5: FOR i = 1 TO u: PRINT ; : PRINT v$(i); : NEXT
1632 COLOR 0, 7: LOCATE 2, 1
1633 FOR i = 1 TO u
1634 PLAY u$(i)

1635 PRINT v$(i);
1645 NEXT
1646 COLOR 7, 0
1647 REM FOR i = 1 TO u: PRINT u$(i), v$(i): NEXT
1650 GOTO 2000: PRINT : PRINT : INPUT "play again"; a$
1655 IF a$ <> "y" AND a$ <> "Y" GOTO 2000
1656 RESTORE: GOTO 1010
1657 FOR i = 2 TO 24 STEP 2: LOCATE i, 1: PRINT SPACE$(78); : NEXT: GOTO 1630
1660 K = 0'Subroutine to calculate T and L
1670  IF P = 1 THEN L = L + L0: P = 0
1680  Z = Q * Q0 * 4 / L
1690  IF Z >= 32 AND Z <= 16320 GOTO 1750
1700  IF Z > 16320 GOTO 1740
1710  IF ES = 1 GOTO 1730
1720   EL = 1: Q = -INT(-Q * 32 / Z): GOTO 1930'Note too long
1730  LT = 4 * Q / 32 - .5: L1 = L - LT: L = LT: LP = 1: GOTO 1680'Seperate
1740  ES = 1: Q = Q * 16320 / Z - .5: GOTO 1940'Note too short
1750  Y = Z / ML - .5
1760    IF Y >= 40 AND Y < 256 THEN X = ML: GOTO 1790
1770  X = 2 ^ (-INT(-(LOG(-INT(-Z / 255))) / .6931472))
1780    IF X <> ML THEN ML = X: m$ = "L" + FNA$(X): GOSUB 1890
1790  Y = Z / X
1800    IF Y <> MT THEN MT = Y: m$ = "T" + FNA$(Y): GOSUB 1890
1810   m$ = "N" + FNA$(m + M0)
1820   IF O = 1 THEN m$ = "N0"
1830   GOSUB 1890
1840   IF LP = 1 THEN L = L1: LP = 0: GOTO 1680
1850   m = 0: L = 1: O = 0
1860 RETURN
1890 REM IF LEN(U$(U)) + LEN(M$) > 255 THEN U = U + 1: U$(U) = ""
1900 u = u + 1
1902 IF u > umax THEN PRINT "Out of memory at:": GOTO 1142
1905 u$(u) = m$
1910 IF LEFT$(m$, 1) = "N" THEN v$(u) = MID$(b$, i0, i - i0): PRINT MID$(a$, i0, i - i0); : i0 = i
1920 RETURN
1930 PRINT "note too long: ": GOTO 1142
1940 PRINT "note too short: ": GOTO 1142
2000