Ansi Music

 BBS: Inland Empire Archive
Date: 09-09-92 (09:50)             Number: 219
From: LUIS ESPINOZA                Refer#: NONE
  To: KENNY BINGHAM                 Recvd: NO  
Subj: Ansi Music                     Conf: (2) Quik_Bas
On (06 Sep 92) Kenny Bingham wrote to Rich Geldreich...

 KB> Can you send me some code that will allow a program that I'm working
 KB> on to read a standard ansi music file and then play the music? I have
 KB> it now to whereas I can read the file in and if the ansi stuff has
 KB> already been stripped so that theres nothing left but the notes it
 KB> will work. What I would like to do is be able to read the whole file
 KB> in and only activate the play command for the music part of the file.

        You know I was playing with that idea the other day, and I did
 come up with a program. I made it because some local sysops would like
 to listen to ANSI Music, and it can't be heard locally, and programs
 such as ANSISND (ANSIALL) needed to be modified in order to sound right
 on a system. But anywayz here is the program (Oh yeah, it sends
 anything that isn't ANSI music to CONS:, just a few minor bugs to work
 out)....


IF DIR$(COMMAND$) = "" THEN
  PRINT "File name required"
  END 1
END IF

OPEN COMMAND$ FOR INPUT AS #1
OPEN "CONS:" FOR OUTPUT AS #2

CLS

DO WHILE NOT EOF(1)
  LINE INPUT #1, a$
  a = 0
  DO
    a = INSTR(a + 1, a$, CHR$(27))
    IF a AND MID$(a$, a + 1, 2) = "[M" THEN
        b = INSTR(a, a$, CHR$(14))
        l$ = LEFT$(a$, a - 1)
        m$ = MID$(a$, a + 2, b - (a + 2))
        r$ = MID$(a$, b + 1)
        PRINT #2, l$;
        PLAY m$
        a = 0
        a$ = r$
    ELSE
      b = INSTR(a + 1, a$, CHR$(27))
      IF b THEN
        l$ = LEFT$(a$, b - 1)
        a$ = MID$(a$, b)
        a = 0
        PRINT #2, l$;
      ELSE
        PRINT #2, a$
        a$ = ""
      END IF
    END IF
  LOOP UNTIL a$ = ""

LOOP
CLOSE
END






--- PPoint 1.33
 * Origin: The Rubber Room (1:207/213.5)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET