ReadMe File for
SND2MIDI(C) Version 2.0
CopyLeft Bill Buckels 1999
All Rights Reversed.

Introduction
------------

Snd2Midi is a FreeWare Music File Utility program that is used to convert
"Old Style" PC Speaker .SND files to .MID (MIDI) files.

This utility will allow you to convert the sound files (.SND files) used
by the author's programs (like WorkBook and Mickiano) to play a simple
melody through the PC speaker, into an equivalently simple MIDI file
that you can use in programs that play MIDI through a sound card (i.e.
Windows Media Player , as well as many other programs that accept .MID
(MIDI) files.)

Snd2Midi is one of a collection of "value-added" and mostly FreeWare
utilities that are currently available from the author, partially to
allow folks to get some extra use from his educational software, and
partially as a public service for other technical people who want to
muck-about programming.

Even if you don't use .SND files, but are interested in MIDI from the
technical side, this utility and its related files may prove useful and
informative. (Snd2Midi is provided with several sample .SND files in
case you haven't any handy.)

Snd2Midi is distributed as freeware, with open C language source code,
and several reference documents on MIDI, which may be of interest to
technical musicians and programmers.

The reference documents come complete with an HTML shell index, that can
be used with a web browser to navigate through the various MIDI and
Computer Music related topics.

Installing Snd2Midi
-------------------

Snd2Midi is part of a larger collection called WorkTools, but is
installed separately using the Sn2Midi Archive file, Snd2Midi.Zip.

Install Snd2Midi by "UNZIPPING" Snd2Midi.ZIP complete with pathnames to
the drive of your choice. If you decide to install Snd2Midi to Drive C:,
Snd2Midi will be installed into the directory C:\WorkTool\Snd2Midi.

To run Snd2Midi in DOS, type Snd2Midi.EXE and press [Enter]. To Run
Snd2Midi in Windows, click-on Snd2Midi.EXE.

Getting Started
---------------

Snd2Midi has two ways to enter an input file name; through the command
line, or via a prompt. If no command line arguments are entered,
Snd2Midi will prompt you for your input file (.SND file) name, and for
your patch maps (General Midi Instrument numbers).

Prompted File Name and Patch Entry
----------------------------------

Enter .SND SoundFile Name (Blank to Exit):
Enter Instrument Patches (Blank When Done)

Command Line Usage
------------------

Snd2Midi sndfile.snd
Snd2Midi sndfile.snd STRICT
Snd2Midi sndfile.snd [patch1 patch2 patch3...]
Snd2Midi sndfile.snd [patch1 patch2 patch3...] STRICT

Commands - STRICT KeyWord
-------------------------

The STRICT keyword will force a timing signature and key signature to
written into the MIDI file. This is required by some sequencers.

Commands - Patch Entry
----------------------

Patches are entered as numeric args, either at the prompt or on the
command line.

Patch Range is 1-127 (General Midi Instrument Voice Numbers).
See Appendix C - General Midi Instrument Voice Numbers.

Each Patch will occupy a channel on a separate consecutive track.

You effectively can have up to 9 voices, since channel 10 is the GM
(General Midi) Drum Channel. Snd2Midi has been programmed for 16 voices,
but that is probably not practical. For most sound files, 2 or 3 voices
is probably all you would want, since the melody in the .SND file is
generally pretty simple anyway.

What does the Snd2Midi Package Contain?
--------------------------------------

The Snd2Midi package comes with several practice .SND files, a utility
called Sound.Exe and a number of documents about MIDI, ranging from
hardware information, and technical specifications, to general
information that should interest anyone serious about computer music.

See Appendix A at the end of this ReadMe for a Packing List of the
program and sample files, and source code.

Sound.Exe - A Sound Command for MS-DOS
--------------------------------------

To play back .SND files before converting them, or to play frequency,
duration pairs interactively or in a batch file from MS-DOS, a command
line program called Sound.Exe is included.

Usage 1 is : Sound.Exe [mysound.snd]
Usage 2 is : Sound.Exe [frequency] [duration]

See Appendix B at the end of this ReadMe for additional information
about the Sound Command in GWBASIC. Sound.Exe works similarily in
interactive mode. Source is included, and you can review that for more
information as well.

Licence Agreement, Copyright and Conditions of Use
--------------------------------------------------

Snd2Midi(C) is Copyright 1999 by Bill Buckels. The Snd2Midi program is
not a derivative work of any other author and is the exclusive property
of its author, Bill Buckels.

You have a royalty-free right to use, modify, reproduce and distribute
this program and its source code in any way you find useful, provided
that you agree that Bill Buckels has no warranty obligations or
liability resulting from said distribution in any way whatsoever. If you
don't agree, remove this program, its source code, and any related files
from your computer now.

The music files used in Snd2Midi were produced by Bill Buckels (the
author) and as such are the author's own expression, and a fair use of
content that is believed to be in the public domain.

The documentation provided with Snd2Midi is properly credited for
Authorship, and for Origin, and is either the property of Bill Buckels,
in the Public Domain, used with permission, or otherwise fairly used.

You may use these documents in any way you find useful, provided you do
so in a fair manner that does not interfere with their respective
authors, and that you agree that Bill Buckels has no warranty
obligations or liability whatsoever resulting from any associated loss
or damage.

If you redistribute the Snd2Midi program, please distribute it in its
entirety. If you are missing files, you can download a complete version
from the internet at:

http://www.escape.ca/~bbuckels/kidstuff

Bill Buckels
589 Oxford Street
Winnipeg, Manitoba, Canada R3M 3J2

Email: bbuckels@escape.ca
WebSite: http:www.escape.ca/~bbuckels

Additional Resources for Technical Midi Information
---------------------------------------------------

For a detailed technical description of how Snd2Midi deals with the
creation of Midi Files, the program source code is the best place to
look. The many documents that come with Snd2Midi are also excellent
resources for "getting up to speed" on Midi.

Most of the docs came from the Internet and were reformatted as text
documents, with credits added, for inclusion with Snd2Midi. Don't be
surprised to see some of these same documents in html format if you
visit the following links.

Internet Resources and Links
----------------------------

After you have exhausted the information provided in this package, or
even you simply want to look further, the following Internet Resources
should prove helpful. They will also provide you with additional links
to yet even more great Midi resources (apologies for future broken
links, but these are in good working order at time of this writing,
September 1999):

MIDI Technical Fanatics Brainwashing Center (Jeff Glatt)
http://www.borg.com/~jglatt/

  Technical Docs and Programming
  http://www.borg.com/~jglatt/tech/miditech.htm

  Tutorials For Midi Users
  http://www.borg.com/~jglatt/tutr/miditutr.htm

  Software Programs
  http://www.borg.com/~jglatt/progs/software.htm

Harmony Central MIDI Documentation Page
http://harmony-central.com/MIDI/Doc/doc.html

MMA (MIDI Manufacturers Association Incorporated) home page
http://www.midi.org/

IA-SIG (Interactive Audio Special Interest Group) Web Site
http://www.iasig.org/

EMUSIC-L Home Page (Joe McMahon)
http://metalab.unc.edu/mcmahon/emusic-l/

  EMUSIC-L MIDI Specification 1.0
  http://metalab.unc.edu/mcmahon/emusic-l/info-docs-FAQs/MIDI-doc/

Mechanical Music Digest Archives
http://mmd.foxtail.com/Archives/

Italian MIDI (Good Resource Links)
http://www.science.unitn.it/~oss/midie.html

MIDI-NET
http://www.ontariobiz.on.ca/basicmidi/index.html

There are many, many more great Internet Midi and Computer Music
Resources, and I have included what I consider are some of the best ones
to get you started, or to add to your favorites. You could get swamped
with links otherwise, and spend much time sorting like I have, and
although this is my idea of fun, it may not be yours.

Corporate Websites of MIDI Hardware and Software Vendors
--------------------------------------------------------

Note that if you visit the Corporate WebSites of the MIDI Hardware
vendors and software vendors, you will probably notice as I have that a
great deal of effort has been applied by Marketing and Artist types to
hide the technical and educational resource information.

If it is there, I can't find it from the ones I have visited, and I have
not included any of these corporate sites in the links above. They are
just not geared for "do-it-yourselfers" and basically choke your band
width with lots of graphics and shockwave files and the like.

If I was shopping I might be a little more tolerant of this
interestingly vertical approach to computer music, but educational
information is generally appreciated even by shoppers.

Appendix A - Packing List
-------------------------

Program Files
-------------

Note: The only file that is required to use Snd2Midi.Exe is
Snd2Midi.Exe. All the other files are extras and can be erased if all
you want is the use of the Sn2Midi utility and you don't care about this
other stuff.

\WORKTOOL\Snd2Midi\Snd2Midi.EXE - The Main Appplication
\WORKTOOL\Snd2Midi\README.TXT   - The ReadMe
\WORKTOOL\Snd2Midi\Sound.Exe    - A Sound Command for MS-DOS
\WORKTOOL\Snd2Midi\DOC98.BAT    - Documentation Viewer for WIN98
\WORKTOOL\Snd2Midi\DOC.BAT      - ReadMe Viewer for MS-DOS
\WORKTOOL\Snd2Midi\FILE_ID.DIZ  - FILE ID Description-In-Zip file

Sample .SND SoundFiles
----------------------

\WORKTOOL\Snd2Midi\*.SND

bug.snd      - La Cucaracha - Archie and Mehitabel's lovesong
danube.snd   - The Blue Danube Walz - Strauss
dvorak.snd   - Humoresque by Dvorak
guonod.snd   - Funeral March of a Marionette by Guonod
mexico.snd   - Mexican Hat Dance
mozart.snd   - Symphony #40 by Wolfgang Mozart
popwease.snd - Pop Goes the Weasel
sam.snd      - Yankee Doodle
stars.snd    - The Stars and Stripes Forever - John P. Sousa

Documents (Ascii Text Format) and HTML Viewer Shell
---------------------------------------------------

Windows 98 users can click-on the DOC98.BAT in the Sn2Midi directory.
This starts Explorer and Loads DOC\index.htm noted below.

\WORKTOOL\Snd2Midi\DOC\index.htm
\WORKTOOL\Snd2Midi\DOC\indexmen.htm

Note: An HTML Shell with an index menu is provided for viewing the
reference documents in the DOC directory. You will need to use your Web
Browser to view the documents using the HTML Shell.

Use File/Open/Browse from your web browser. Load
\WORKTOOL\Snd2Midi\DOC\index.htm. That's all there is to it.

\WORKTOOL\Snd2Midi\DOC\*.TXT (as follows)

snd2midi.txt - ReadMe File for SND2MIDI (this file)
sound.txt    - ManPage (ReadMe File) for Sound.Exe
intro.txt    - Introduction into MIDI
mapfaq.txt   - That infernal MIDI Mapper
mapfaq2.txt  - THE WINDOWS MIDI MAPPER
midi06.txt   - Standard MIDI Files 0.06
midi10.txt   - Standard MIDI Files 1.0
midifaq.txt  - What is MIDI?
midispe1.txt - MIDI Specification 1.0
midispe2.txt - MIDI Specification
mmaxmidi.txt - MMA position on XMIDI
patch.txt    - Instrument Patch Assignments
patch2.txt   - Overview of General MIDI
primer.txt   - The USENET MIDI Primer

Note: If you don't have a web browser, you can view the text files using
DOS Edit or Windows Notepad, or any other text viewer.

Source Code
-----------

\WORKTOOL\Snd2Midi\SRC\Snd2Midi.C
\WORKTOOL\Snd2Midi\SRC\Snd2Midi.MAK
\WORKTOOL\Snd2Midi\SRC\Sound.C
\WORKTOOL\Snd2Midi\SRC\Sound.MAK

Appendix B - .SND File Format
-----------------------------

The .SND File Format is a binary file of 3 byte "sound packets". Each
packet is a frequency, duration pair. The frequency is in the form of a
2-byte Intel Word. The duration is in the form of a 1 byte unsigned
char.

The end of file is marked with 2 bytes... 0ffh, 0ffh (frequency = -1).

The Frequency is in hertz. Silence is encoded as 32767.

The Duration is in PC Timer Ticks (interrupt 1Ch), of 18.2 per second.
Maximum duration is 255 ticks (approx. 14 seconds), which is more than
enough time to sustain a single sound on a PC speaker without
experiencing extreme pain and discomfort.

As a matter of fact, some serious minded users of that era were known to
become quite agitated after repeated audible assaults of this nature,
and to permanently disassemble their PC speaker apparatus, sometimes in
a violent manner. Nevertheless...

The .SND file format pretty much matches the GWBASIC SOUND Statement,
which is long established as one of the two standard methods to play
monophonic music on the PC Speaker (The other way was using the GWBASIC
PLAY Statement, which was a "macro" language and couldn't be easily used
in other programming languages besides GWBASIC).

i.e. GWBASIC defined the SOUND statement as follows:

SOUND frequency, duration

Generates a sound through your computer's speaker.

frequency - The frequency of the sound in hertz; a value in the
range 37 through 32,767.

duration - The number of system clock ticks the sound lasts; a value in
the range 0 through 65,535. There are 18.2 clock ticks per second.

The MIX PowerC compiler also offered a sound function as a standard
library function using almost the same format as GWBASIC, and Turbo C
offered a variation, using a seperate delay function.

I wrote my own for Microsoft C. It is provided with the utility
sound.exe. See the source for sound.exe for more details.

At any rate, before sound cards were popular, this was the usual way to
play sound on the PC speaker, so this is why I encoded my music in the
.SND file format. (The 3 byte packet was used to save disk space, which
was also at a premium at that time.)

Appendix C - General Midi Instrument Voice Numbers
--------------------------------------------------

The General Midi Instrument Map is a list of 128 sounds (numbered
0-127), with corresponding MIDI program (voice) numbers. Most of these
are imitative sounds, though the list includes synth sounds, ethnic
instruments and a handful of sound effects.

The sounds fall roughly into sixteen families of eight variations each.
Grouping sounds makes it easy to re-orchestrate a piece using similar
sounds.

General Midi restricts percussion to MIDI Channel 10. Theoretically, the
lower nine channels are for the instruments, and channel 10 is for the
drums.

Instrument Patch Assignments  (Default = Voice 0)
----------------------------

0-7 Piano                          64-71 Reed

0  Acoustic Grand Piano            64  Soprano Sax
1  Bright Acoustic Piano           65  Alto Sax
2  Electric Grand Piano            66  Tenor Sax
3  Honky-Tonk Piano                67  Baritone Sax
4  Rhodes Piano                    68  Oboe
5  Chorused Piano                  69  English Horn
6  Harpsichord                     70  Bassoon
7  Clavinet                        71  Clarinet

8-15 Chromatic Percussion          72-79 Pipe

8  Celesta                         72  Piccolo
9  Glockenspiel                    73  Flute
10 Music Box                       74  Recorder
11 Vibraphone                      75  Pan Flute
12 Marimba                         76  Bottle Blow
13 Xylophone                       77  Shakuhachi
14 Tubular Bells                   78  Whistle
15 Dulcimer                        79  Ocarina

16-23 Organ                        80-87 Synth Lead

16 Hammond Organ                   80  Synth Lead 1 Square Wave Lead
17 Percussive Organ                81  Synth Lead 2 Sawtooth Wave Lead
18 Rock Organ                      82  Synth Lead 3 Caliope Lead
19 Church Organ                    83  Synth Lead 4 Chiff Lead
20 Reed Organ                      84  Synth Lead 5 Charang
21 Accordion                       85  Synth Lead 6 Solo Synth Voice
22 Harmonica                       86  Synth Lead 7 Bright Saw Wave
23 Tango Accordion                 87  Synth Lead 8 Brass and Lead

24-31 Guitar                       88-95 Synth Pad

24 Acoustic Nylon Guitar           88  Synth Pad 1 Fantasia Pad
25 Acoustic Steel Guitar           89  Synth Pad 2 Warm Pad
26 Electric Jazz Guitar            90  Synth Pad 3 Poly Synth Pad
27 Electric Clean Guitar           91  Synth Pad 4 Space Voice Pad
28 Electric Muted Guitar           92  Synth Pad 5 Bowed Glass Pad
29 Overdriven Guitar               93  Synth Pad 6 Metal Pad
30 Distortion Guitar               94  Synth Pad 7 Halo Pad
31 Guitar Harmonics                95  Synth Pad 8 Sweep Pad

32-39 Bass                         96-103 Synth Effects

32 Acoustic Bass                   96  Synth SFX 1 Ice Rain
33 Electric Bass Fingered          97  Synth SFX 2 Sound Track
34 Electric Bass Picked            98  Synth SFX 3 Crystal
35 Fretless Bass                   99  Synth SFX 4 Atmosphere
36 Slap Bass 1                     100 Synth SFX 5 Brightness
37 Slap Bass 2                     101 Synth SFX 6 Goblin
38 Synth Bass 1                    102 Synth SFX 7 Echo Drops
39 Synth Bass 2                    103 Synth SFX 8 Star Theme

40-47 Strings                      105-111 Ethnic

40 Violin                          104 Sitar
41 Viola                           105 Banjo
42 Cello                           106 Shamisen
43 Contrabass                      107 Koto
44 Tremolo Strings                 108 Kalimba
45 Pizzicato Strings               109 Bagpipe
46 Orchestral Harp                 110 Fiddle
47 Timpani                         111 Shanai

48-55 Ensemble                     112-119 Percussive

48 String Ensemble 1               112 Tinkle Bells
49 String Ensemble 2               113 Agogo
50 Synth Strings 1                 114 Steel Drums
51 Synth Strings 2                 115 Woodblock
52 Choir Aahs                      116 Taiko Drum
53 Voice Oohs                      117 Melodic Drum
54 Synth Voice                     118 Synth Drum
55 Orchestral Hit                  119 Reverse Cymbal

56-63 Brass                        120-127 Sound Effects

56 Trumpet                         120 Guitar Fret Noise
57 Trombone                        121 Breath Noise
58 Tuba                            122 Seashore
59 Muted Trumpet                   123 Bird Tweet
60 French Horn                     124 Telephone Ring
61 Brass Section                   125 Helicopter
62 Synth Brass 1                   126 Applause
63 Synth Brass 2                   127 Gunshot

Drum Note Assignments
---------------------

Drum notes are assigned to note numbers. General MIDI Channel 10 is for
percussion. By playing different notes on channel 10, we get different
drum sounds.

MIDI Note #   Drum Sound           MIDI Note #   Drum Sound

35            Acoustic Bass Drum   59            Ride Cymbal 2
36            Bass Drum 1          60            High Bongo
37            Side Kick            61            Low Bongo
38            Acoustic Snare       62            Muted High Conga
39            Hand Clap            63            Open High Conga
40            Electric Snare       64            Low Conga
41            Low Floor Tom 1      65            High Timbale
42            Closed High Hat      66            Low Timbale
43            High Floor Tom 2     67            High Agogo
44            Pedal High Hat       68            Low Agogo
45            Low Tom 3            69            Cabasa
46            Open High Hat        70            Maracas
47            Low-Mid Tom 4        71            Short Whistle
48            Hi-Mid Tom 5         72            Long Whistle
49            Crash Cymbal 1       73            Short Guiro
50            High Tom 6           74            Long Guiro
51            Ride Cymbal 1        75            Claves
52            Chinese Cymbal       76            High Wood Block
53            Ride Bell            77            Low Wood Block
54            Tambourine           78            Mute Cuica
55            Splash Cymbal        79            Open Cuica
56            Cowbell              80            Mute Triangle
57            Crash Cymbal 2       81            Open Triangle
58            Vibraslap

End of ReadMe