home *** CD-ROM | disk | FTP | other *** search
- ============================================================================
-
- MidiWatcher v1.1 by Ed Mackey
-
- ============================================================================
-
- Yes folx, another one of my silly trinkets appears on the net ;-).
-
- MidiWatcher is for people with MIDI keyboards. It requires the midi.library
- v2 or higher by Bill Barton (not included). It should run under almost any
- version of the Amiga's OS.
-
- New for v1.1: Failure programs (see below). Also, improved -d debug
- mode, various bug fixes, tries to find if MidiWatcher
- is already running and exit it, etc. Also I decided to
- release source code with this version. Good luck trying
- to read it!! ;-)
- **** Old save files from v1.0 still work fine!! ****
-
- Basically, this program sits in the background and watches your MIDI IN port
- for certain tunes. When it recognizes a tune, it runs a program.
-
- For instance, if I need my directory utility up, I can do one of three
- things: (1) I can search through subdirectories for its icon (takes too
- much time and is boring), (2) I can press a ToolManager hotkey (takes much
- less time but is still boring), or (3) I can reach over and play a little
- jingle on my MIDI keyboard, and up pops MegaD. The third choice is clearly
- much more fun than either of the others ;-).
-
- This program should be run from the CLI. I suppose it would also run from
- Workbench if you did not need to pass any parameters to it. Personally,
- I recommend putting it in your user-startup file. If you type
- midiwatcher ?
- you will see:
-
- MidiWatcher v1.1 by Ed Mackey. Watch MIDI keyboard for tunes.
- Usage: midiwatcher [-i source] [-f savefile] [-r] [-d]
- -i selects a MidiIn source, defaults to MidiIn
- -f selects a tune save file, defaults to S:midiwatch
- -r turns on RECORD mode and adds a tune to file -f
- -d turns on DEBUG mode (playback only) to see your tunes go.
-
- Here is a more complete description of the options:
-
- Well actually, -i is already described as much as it needs to be. See the
- DOCs for midi.library to learn more about MIDI sources. Note that ALL 16
- channels of your MIDI source will be monitored as if they were all one
- channel. I realize this is somewhat uncool for some people, but remember
- this program is only a trinket. You can also filter out MIDI channels with
- a midi.library patch bay type program. Send me email if you want this
- changed.
-
- -f selects a filename for the database of tunes to be recognized. See -r
-
- -d is DEBUG mode, so you can watch MidiWatcher trying to recognize tunes.
-
- -r puts MidiWatcher in RECORD mode. When in this mode, MidiWatcher saves
- every note it sees until you press CTRL-C. It then writes to the savefile
- something that looks like this:
-
- # Your comments go here (such as name of tune)...
- # You may wish to insert a colon (":") at the point of no return...
- $3c 37 36 37 38 37 3b 3c
- #### Success program...
- @PLAY
- *id midi_event
- >echo "Tune recognized"
- #### Failure program...
- +PLAY
- !id midi_fail
- ]echo "You passed the colon, and then blew it!!"
-
- Only, you know, flush left because it is not in a DOC file. :-)
- The save file will be appended to if it already exists, and created
- otherwise. You should then edit this file with a text editor. Here is
- what the lines mean:
-
- # is a comment line. Just write the name of the tune or whatever here.
-
- $ has some hex numbers which you should not change. These are the note
- numbers extracted from MIDI NoteOn messages during your recording. Note
- there is no tempo or chord information here, just a sequence of NoteOns.
- I don't recommend playing chords unless you can start the individual
- notes of the chord in a certain order all the time. I told you this
- program was a trinket, didn't I?
-
- @ This is an optional line for people with ARexx. It specifies an ARexx
- port, and as you know, ARexx port names are case-sensitive.
-
- * This is an optional line for people with ARexx. It contains a string
- to send as an ARexx message to the port named by the @ line. Note that
- both the @ and * lines must be included for either to have an effect.
- People without ARexx should delete all @ and * lines.
- When a tune with an ARexx message is recognized, the message is prepared
- and sent. MidiWatcher then continues normal processing _without_ waiting
- for the message to return. However, if you send MidiWatcher a CTRL-C
- or a QUIT command (explained later), MidiWatcher will wait for all sent
- ARexx messages to return before quitting.
-
- > This line specifies a CLI command to execute. This line can be omitted
- only if both the @ and * lines are present and no CLI command is needed.
- (Unless you really _want_ a tune that does nothing... ??)
- Note that unlike ARexx messages, the CLI command will prevent MidiWatcher
- from running until the command's completion. This should always be
- avoided like this:
- >run <NIL: >NIL: (your path & program name here)
- This use of the "run" command will make sure that MidiWatcher can keep
- multitasking with your newly-started program.
-
- Note that if both an ARexx message and a CLI command are specified for
- a given tune, the ARexx message will be sent first, and the CLI command
- will be executed immediately after the message is sent. As you can see
- from the example, I use this with Upd to play sound effects and launch
- programs at the same time, each time a tune is recognized.
-
- ----------------------------------------------------------------------------
- Failure Programs
- ----------------------------------------------------------------------------
-
- + ARexx port: just like "@", but for failure programs.
- ! ARexx message: just like "*", but for failure programs.
- ] CLI command: just like ">", but for failure programs.
-
- "Failure Programs" are a new feature of MidiWatcher v1.1. Let's say you
- insert a colon in your line of notes, so it looks like this:
-
- $3c 37 36 37 38 37:3b 3c
-
- The colon ^^^ tells MidiWatcher that if the user gets this far
- in the song, he/she really is trying to play this particular song. If
- he/she messes up, anytime after the colon, MidiWatcher will run the failure
- program specified by the "+", "!", and/or "]" line(s).
-
- In the above example, the colon is between the 6th and 7th notes. So, if
- the user messes up any of the first six notes, nothing happens. If the user
- plays all eight notes correctly, the usual action(s) are taken ("@", "*",
- ">"). BUT, if the user plays the first _six_ notes correctly, and then gets
- the 7th or 8th _wrong_, the "failure program" ("+", "!", "]") will be run.
-
- The usefulness of this is about the same level as the usefulness of anything
- else in this program: If you start to play a tune, and then screw it up,
- you can have your machine shout at you, "STUPID!! YOU SO STUPID!!!!"
- You can get a lovely sound sample of this from Weird Al's movie "UHF".
- ("You get over there and spin the Wheel of Fish!!")
-
- ============================================================================
-
- The ARexx Port
-
- ============================================================================
-
- Aha. Not expecting that one were you?
-
- Well, this program has an ARexx port of it's own, called MIDIWATCHER.
- It currently understands three commands, and these commands must
- always appear in UPPER CASE (sorry guys):
-
- SUSPEND - Release the MidiIn (and hence the serial port, unless some
- other program is using MIDI), and just sit in the
- background until further notice. Returning ARexx messages
- sent by tunes are still freed. If MidiWatcher was already
- in suspend mode, this command is ignored.
-
- RESUME - Leave SUSPEND mode if MidiWatcher was in it. MIDI and your
- serial port are again tied up.
-
- QUIT - Same as sending MidiWatcher's CLI process a CTRL-C.
- Deallocates MIDI, waits for any ARexx messages sent by
- tunes to come home, and exits (in that order ;-).
- Should work even in SUSPEND mode (I hope).
-
- This port is NOT available in RECORD [-r] mode (it's not needed then).
-
- I suppose you could have a tune that caused MidiWatcher to send an ARexx
- message to itself. This would not cause a problem (but of course a
- RESUME message would be useless, as MidiWatcher could not be in SUSPEND
- mode in the first place if it was sending messages).
-
- NOTE: If the serial port is not available to midi.library when
- MidiWatcher is run or when MidiWatcher receives a RESUME
- command, MidiWatcher will have a cow and act like you pushed
- CTRL-C. I suppose I should fix this.... nah....
-
- Anyway, I added this ARexx port as an afterthought, so that I could have
- my terminal program use SUSPEND to grab the serial port and RESUME when
- it was done.
-
- ============================================================================
-
- Have fun with your new trinket. Don't take this program too seriously,
- I only wrote it because I needed a short break from my senior project.
- I disclaim responsibility for any blah blah blah whatever.
- If you like this program send me money blah blah blah whatever.
-
- Have fun!!
- --Ed.
-
- Ed Mackey BBS: Somerton Telecomm II, (215) 464-6775
- PO Box 475 IRC: LineNoise
- Wayne, PA 19087 Internet email: emackey@BIX.com
-