MIDTXT.BAS July 1997 by Marc Kummel aka Treebeard. Contact mkummel@rain.org, http://www.rain.org/~mkummel/ About MIDTXT: --------------- This is old code from the Vault (1993) to read Standard MIDI Files (SMF). These are the usual .MID files used by Windows. MIDTXT will show MIDI files in a text form with comments that can be studied or printed, and it will prepare a comprehensive report about the contents. It can also play .MID files on a Roland compatible MPU MIDI controller. It works with SMF type 0 and type 1 files, but not type 2. There are some restrictions on file size, and it can only play 8 chunks at once in Type 1 files. Sorry, SoundBlaster cards are NOT supported for MIDI output, but MIDTXT is still a useful utility without MIDI play. Starting MIDTXT: ------------------ Unzip the archive into a directory and type "midtxt" to begin. The default MPU data address is (hex) 330. If yours is different (say hex 300 like mine), then start MIDTXT with /A300 or add SET TBMIDI=300 to your environment. You can also change the address from the Set menu once the program has started. For reasons that are obscure to me now, MIDTXT is command line driven. It would be nice to add routines to find and open a file, but as is you have to specify a file when you start the program, and restart the program to change files. (This is really not unusual for utilities.) By default, MIDTXT will open the first *.MID file it finds in the current directory, which might be the BACH.MID file included in the archive. I recommend that you copy MIDTXT.EXE to a directory in your PATH so you can call it from any directory without fussing with paths. This is the help you see if you type "midtxt /?". The /B/C/N/S/T switches sound good but don't work, and everything else (except the input file) can be selected from the program. The only really useful switch is probably /H which will show 50 lines on VGA. "MIDTXT [filename]" is all you need. Usage: MIDTXT [d:][\path\]infile[.mid] [[d:][\path\]outfile[.ext]] [/options] Options: /A[n] = device base address (hex), default is 330 for MPU, 220 for SB * /B = batch mode, exit after file/play * /C[n] = conversion type: 0=MID 1=.TXT 2=.MSQ 3=.WRK 4=.CMF /D = no display of MIDI events during play /F = write to file (OUTFILE or INFILE.ext) /H = use highest screen resolution (50 lines with VGA) /I = ignore patch change during play /L[n] = print port, 1-4=LPT1-4, 5-8=COM1-4 (default is LPT1) /M = MIDI output * /N = no color /O[n] = output all MIDI to channel n (default is 1) /P[c] = print [compact] /R = report * /S = output to SoundBlaster (Only MPU is now supported.) * /T[n] = track n, with /f or /p only! t0=header; multiple /tn ok.) infile = SMF file (type 0,1) to read, wildcards ok, default ext. is .MID outfile = output text file, default ext. is .TXT * These switches don't do anything yet. The Menus: ------------ Once MIDTXT opens a file, commands are shown on the blue menu bar on the bottom line. Just press the first letter of the command. MIDI files are structured as separate data CHUNKS, and several commands are based on that stucture. Step through the file line by line. Scroll on/off. <0-9> Jump to that chunk number (if it exists). Chunk 0 is the header. rack Jump to the beginning of the current chunk. ast Jump to the last or next chunk. ext ind Search the file for the next eta event,

atch change, or ontroller event. eport Prepare a comprehensive report on the current file. This option counts events of different kinds, looks for stuck notes, lists all controllers that are used, and more.

rint Toggle printer on/off. Lines will print as you scroll or step. Use /L[n] switch to change from LPT1: printer. Of course you can also press {|}. idi Toggle MIDI play on/off. If MIDI play is ON, you will hear each event as you scroll or step through the file. Tempo is ignored, and scrolling is *very* fast. ill Send NOTE OFF to every note of every channel. ut Send the the whole sequence out to MIDI. This is a pretty nice player, (written completely in Basic!), but it will get weird if the tempo is too fast or the sequence is too complicated. Try slowing it down with the <-> key. It plays CANYON.MID just fine on my 486-33. It can only play 8 chunks at once. A menu appears during playback with some new options: toggle Play/Pause ewind back up a bit ast forward skip ahead a bit <+-> adjust tempo faster or slower empo reset normal tempo ark set a mark oto jump to the ark or time/count quit the player et Change various settings. uit Exit the program. (And reset the MPU.) File list: ------------ The files shown below the dotted line are source files that can be deleted if you don't need them. The source contains useful routines for reading and playing MIDI files. MIDTXT was written for MS Basic PDS 7.1. The code requires interrupt support and really wants huge arrays so start PDS with /L and /AH options, or use the XQB.BAT batch file. It won't run as is with QBasic, but interrupts are only used for screen scrolling so there's probably a workaround. QB may need some changes, I haven't tested it. MIDTXT.EXE DOS executable BACH.MID sample MIDI file for default load README.TXT this file TBVAULT.TXT about Treebeard's Basic Vault ----------- MIDTXT.BAS Basic source code XQB.BAT batch file to start PDS and load code MAKE.BAT batch file to compile and link from DOS prompt More Info on MIDI and SMF: ---------------------------- Axel Stoltz, _The Sound Blaster Book_, Abacus, 1992 includes some info on MIDI files and gives sample PASCAL code for a program to read SMF files. This helped me a lot, thanks. Search the Web for more information about MIDI and SMF files. The truth is out there. Conditions: ------------- This program and source code are yours to use and modify as you will, but they are offered as freeware with no warranty whatsoever. Give me credit, but do not distribute any changes under my name, or attribute such changes to me in any way. You're on your own! Send comments and fixes to: Marc Kummel aka Treebeard mkummel@rain.org http://www.rain.org/~mkummel/ For more interesting Basic software with source code, check out Treebeard's Basic Vault at http://www.rain.org/~mkummel/basic/