Convert, (c) 1994 Jesus Villena, Spain
                   Universidad Politecnica de Valencia
                         Facultad de Informatica

                     INTERNET:  usufi4@finf.upv.es

                              Version 1.4B


COPYRIGHT

This program is Freeware and may be distributed without any permission of
their author. Their development has been carried out by and for the INTERNET
collective. Collaborates in their improvement and amplification!!!

This software is provided as-is. Author makes no warranties on this program.
You use this software at your own risk.


INTRODUCTION

Convert is a MSDOS tool which serves in order to interchange samples between
several formats of sound.  The translation between the several formats offers
the advantage of maintaining the majority of the present information in the
original file if this is possible, i.e. name, loop points, significant
number of bits, number of channels, etc.


MOTIVATION

Convert surged like a domestic project destined to the obtaining of high
quality instruments for the Gravis Ultrasound card starting with files
from professional samplers (Ensoniq EPS, Roland [S] 50, Yamaha TX16W...)
The source code was designed so that out easy their amplification to more
formats. In fact, soon the formats of the most well-known modules were added
(MOD, MTM, FAR, S3M...). A little later they were added the MIDI standard
formats (SDS and SDX) and other formats offered by several manufacturers
(AIFF, IFF, SMP...).

At the same time that was added more available formats for the input files,
these same formats, if it was possible, they were available also like
output, so that virtually, any input format would be converted in any
output format.


FEATURES

        - Great quantity of input and output formats:  seeing list.

        - Automatic recognition of the input format:  it is not necessary
        specify the type of the input file, Convert detects it automatically.

        - Possibility of converting in one pass great quantity of files and
        carry them to some target directory:  They are accepted wildcards
        in order to specify the input files, and a output directory which
        will be filled with the resulting files.

        - Ease of use: their utilization is clearly intuitive in order to avoid
        remember difficult combinations of input parameters (for example,if you
        want to use the samples that there is in a file ". PAT" in order to
        utilize them in a module ". MOD", simply specifies -MOD as switch and
        Convert translate each one of the waveforms to the format ". SAM"
        readable for all the mod-editors, without specifying if it is SIGNED or
        UNSIGNED...)

        - The program may work with input files of until 16 bits and
        2 channels (Stereo), doing the necessary conversion of these values for
        generating the output format (this is,a WAV file of 16 bits Stereo will
        be converted in 8 bits Mono upon converting it to VOC, for example).

        - High probability of success: This program has converted with success
        98% of files I have (others conversion programs generated many errors).
        Especially I have all GKH and AIFF files on ftp.reed.edu (now on
        oak.oakland.edu) and it has converted all very well (except some files
        that was corrupted originally).

        - Varios Keyboard Disk Images have been added: Directly supports the
        disk image formats GKH and Giebler Enterprises (both are the most
        common in the internet) for VFX-SD, SD-1, TS-10 (DD y HD), VFX-SD, EPS
        (normal, 16 and 16+), and ASR keyboards and racks units. Convert
        doesn't need, as a difference to other programs, external programs for
        converting these disk images.

       - It Comes in this version with some useful utilities: SND2WAV and JOIN
        SND2WAV converts files that can't carry out Convert (files without
        header) and JOIN links pieces which form a unique sample disk for
        Kurzweil and Ensonig formats.

        - LoopPoints and WaveSample Length shows samples, nor bytes, similary
        to other packages. Sizes are still in bytes.

NEW!!	- Full support for the SoundBlaster AWE32 format. Now, you can read
	and write SBK files (Vienna compatibles) with many features. Try it.

NEW!!   - Stereo support for SBK files, using multiyering capabilities of
	the SoundBlaster AWE32.

NEW!!	- Bidirectional to Forward looping conversion, useful in formats
	without bidirectional capabilities.

NEW!!   - Three pro formats have been added as output: Yamaha TX16W, Yamaha
	SY-85/SY-99 and Ensoniq Instrument file. The files generated with
	this option haven't been tested. Please test it and tell me.


FORMAT IDENTIFICATION

The formats which Convert works in this version are the following:

	Alias	    Meaning
	-----       -------------------------------------------
        669         669 Tracker Module
        AIFF        Audio Interchange Format File (AIFF)
        AU          Sun/Next Audio File
        DMF         Delusion Digital Music File
        DSF         Delusion Digital Sound File
        DSM         Digital Sound Module
	DSP	    Dynamic Studio Professional Module
        FAR         Farandole Composer Module
        FSM         Farandole Composer WaveSample
        F2R         Farandole Linear Module
        F3R         Farandole Blocked Linear Module
        GKH	    Ensoniq Disk Image (VFX, SD, EPS, ASR, TS)
        IFF         Interchange Format File (IFF)
        INS	    Ensoniq Instrument File
        KRZ         Kurzweil K2000 File
        MED         MED/OctaMED Module
        MOD         Protracker/Fastracker/Startrekker Module
        MTM         MultiTracker Module
        OKT         Oktalizer Module
        PAC         SBStudio II Package or Song
        PAT         Gravis Ultrasound Patch
        PSM         Protracker Studio Module
        RAW         PCM Signed Raw Sound File
        SBK         Emu SoundFont Bank (AWE32 Bank)
        SDK         Roland S-550/S-50/W-30 Disk Image
        SDS         MIDI Sample DUMP Standard File
        SDX         Sample DUMP Exchange File
        SF          IRCAM Sound File"
        SMP         Samplevision File
        SND         PCM Unsigned Raw Sound File
        SOU         SBStudio II Sound File
        STM         Scream Tracker 1 & 2
        S3I	    Digiplayer/ST3 Sample File
        S3M         Scream Tracker v3 Module
	SYW	    Yamaha SY-85/SY-99 Wave File
        TXW         Yamaha TX-16W Wave File
        ULT         UltraTracker Module
        UNI         UNIMOD Module
        UWF         UltraTracker WaveSample
        VOC         Creative Lab's Sound File
        WAV         Microsoft Windows RIFF WAVE
	XI	    Fastracker 2.0 Instrument File
	XM	    Fastracker 2.0 Module


SYNTAX

The form of invoking to this tool is the following:

          CONVERT [[InputPath/@SearchFile] [OutputPath] [OutFmt] [Switches]]

Where:

InputPath is the name of the files to convert.  InputPath consists of a route
and a file name, which accept the usual wilcards of DOS.  Examples of
InputPath would be: \SAMPLES\*.*, ..\SAMPLES\ENSONIQ\*.INS, SAMPLE?.*, etc.

SearchFile is optional to InputPath and is a text file which let you specify
files to convert, one file path in each line. Comments can be included behind
simbol #. Order can be achieved also specifying number=filepath. This order
is supplied mainly to support AWE32 program numbers, although is valid for
the rest of formats. E.g:

     ---File sample.ini---
        # Sample File to obtain the bank sample.bank
        # Use convert @sample.ini -sbk
        0=c:\sounds\bdrum1.wav
        1=c:\insts\snare2.aif
        8=d:\krz\voices.krz
        # This bank will have the sound bdrum1.wav as program 0
        # the sound snare1.aif as program 1
        # and sounds included in voices.krz as programs 8,9,...


OutputPath specifies the destination directory where Convert will place the
files converted.  If this directory don't exist, Convert creates it.

OutFmt is a switch that allows to specify the output format for the files
to convert to.

Switches are -8 and -1 , and serves actually to force 8 bits and mono
conversion.

OutFmt may be one of the following:

OutFmt      Extension     Offered Features (Resume)
------      ---------     --------------------------------------------------
-669        ".snd"         PCM Unsigned Raw, 8 bits, Mono
-AIF        ".aif"         8/16 bits, Mono/Stereo, Rate, Loop
-AU         ".au"          8/16 bits LINEAR, Mono/Stereo, Rate
-DMF, -DSF  ".dsf"         8/16 bits, Mono, Rate, Loop
-DSM	    ".wav"	   8 bits, Mono, Rate, Loop
-FAR, -F2R
-F3R, -FSM  ".fsm"         8/16 bits, Mono, Loop
-GKH, -INS  ".ins"	   16 bits, Mono, Rate, Loop
-IFF        ".iff"         8 bits, Mono/Stereo, Rate
-MOD, -STM
-MED, -OKT  ".sam"         PCM Signed Raw, 8 bits, Mono
-MTM        ".raw"         PCM Unsigned Raw, 8/16 bits, Mono
-PAC, -SOU  ".sou"         8/16 bits, Mono, Loop
-PAT        ".pat"         8/16 bits, Mono, Rate, Loop, Multiple Waveforms
-RAW        ".raw"         PCM Signed Raw, 8/16 bits INTEL, Mono/Stereo
-SBK        ".sbk"         16 bits, Mono, Rate, Loop
-SDS        ".sds"         8/16 bits, Mono, Rate, Loop
-SDX        ".sdx"         8/16 bits, Mono, Rate, Loop
-SF         ".sf"          8/16 bits, Mono/Stereo, Rate
-SMP        ".smp"         16 bits, Mono, Rate, Loop
-SND        ".snd"         PCM Unsigned Raw, 8/16 bits INTEL, Mono/Stereo
-S3M, -S3I  ".smp"         8/16 bits, Mono/Stereo, Rate, Loop
-SYW	    ".w00"	   16 bits, Mono, Rate, Loop
-TXW	    ".w00"	   12 bits, Mono, Rate, Loop
-UWF, -ULT  ".uwf"         8/16 bits, Mono, Loop
-VOC        ".voc"         8 bits, Mono, Rate
-WAV        ".wav"         8/16 bits, Mono/Stereo, Rate, Loop
-XM, -XI    ".xi"	   8/16 bits, Mono, Loop
-OUT        depends        variable (see notes)

Notes:

If you run Convert without parameters, the program shows a small help.

If you have specified only InputPath (or SearchFile) , the program shows
information on the contents of the input files (sample name, number of Bits,
number of channels, loop points, etc...). For example: Convert flute.pat

úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúEXAMPLE Output
CONVERT v1.4B, (c) 1994 Jesus Villena
Converts sounds among several kinds of music and sample files

  File    : FLUTE.PAT
  Text    : Copyright 1992,1993 EYE&I Productions and Advanced Gravis   
  Source  : Gravis Ultrasound Patch

         Name       Length   Rate   Lo Root Hi   Ste 16B Loop   Begin    End
    -------------------------------------------------------------------------- 
    Flute          úúúúúúúúúúúúþþþþ INSTRUMENT þþþþúúúúúúúúúúú                 
00  NoName             6015  41666  A0  G#5 C8    -   x   -->     5564    6014
                                                                               
			1 WaveSample(s) use 12030 Bytes
úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú
This file is a Gravis Ultrasound Patch and has an instrument called Flute, 
which contains an unique waveform called NoName of 6015 samples, sampled at 
41666 Hz at G#5, and can be used inside the range A0..C8. The waveform is 
mono (Ste= - ), 16 bits (16B = x ) and has a Forward Loop (Loop = --> ) from 
the sample 5564 up to the sample 6014


If you haven't specified OutputPath, it will use the current directory as
target.

The output file generated acquires the same name that the input file, if
this has a waveform. If the input file has various waveforms, the name of
each file generated is the original name adding an index that differentiates
it of the others (Caution: this may override existing files with equal names).
If the output format is SBK, the file generated will be named sample.sbk,
except if you use the @SearchFile option to specify file paths; in this
case the name of the ouput file will be the same of the @SearchFile with
".sbk" as extension.

The switch -OUT has a special meaning and it is only accessible from some
formats.  Basically its meaning is to extract all the waveforms that there is
in the input file to individual files, with the same format (or of it same
"family") that the initial.  Logically, this switch only is available for
that formats that may have multiple waveforms on an only file:

        669 --> SND (each instrument to PCM RAW 8 bits Unsigned)
	DMF --> DSF
        FAR, F2R, F3R --> FSM
        GKH --> INS (they are extracted the contained files in the file GKH)
        MOD, STM, MED, OKT --> SAM (each instrument to PCM RAW 8 bits Signed)
        MTM --> RAW (each instrument to PCM RAW 8/16 bits Unsigned)
        PAC --> SOU
        PAT --> PAT (each WaveForm is converted into a new PAT file)
        ULT --> UWF
        S3M --> S3I
	XM  --> XI	


ACKNOWLEDGED INPUT FORMATS

So that a file may be automatically acknowledged, It should have a header
that define it.  For it, the files with format PCM RAW is not accepted like
valid input formats (this format are supported using sound2wav utility).
The following are the valid input formats for this version:

Format     Acknowledged features (Resume)
--------   --------------------------------------------------------
669        Several waveforms, 8 bits Mono, Loop, Name, Text
AIFF       1 waveform, 1..16 bits, Mono/Stereo, Rate, Loop, Name, Text
AU         1 waveform, 8/16 bits LINEAR/ULAW, Mono/Stereo, Rate, Text
DMF        Several waveforms, 8/16 bits Mono, Rate, Loop, Name, Text
DSF        1 waveform, 8/16 bits Mono, Rate, Loop, Name
DSM        Several waveforms, 8 bits Mono, Rate, Loop, Name, Text
DSP
FAR        Several waveforms, 8/16 bits Mono, Loop, Name, Text
FSM        1 waveform, 8/16 bits Mono, Loop, Name
F2R        Several waveforms, 8/16 bits Mono, Loop, Name, Text
F3R        Several waveforms, 8/16 bits Mono, Loop, Name, Text
GKH, INS   Several waveforms, 16 bits Mono, Rate, Loop, Name
IFF        1 waveform, 8 bits, Mono/Stereo, Rate, Name, Text
KRZ        Several waveforms, 16 bits Mono, Rate, Loop, Name
MED        Several waveforms, 8 bits Mono, Loop, Name, Text
MOD        Several waveforms, 8 bits Mono, Loop, Name, Text
MTM        Several waveforms, 8/16 bits Mono, Loop, Name, Text
OKT        Several waveforms, 8 bits Mono, Loop, Name
PAC        Several waveforms, 8/16 bits Mono, Loop, Name, Text
PAT        Several waveforms, 8/16 bits Mono, Rate, Loop, Name, Text
PSM        Several waveforms, 8/16 bits Mono, Loop, Name, Text
SBK        Several waveforms, 16 bits Mono, Loop, Name, Text
SDK        Several waveforms, 12 bits Mono, Rate, Loop, Name, Text
SDS        1 waveform, 1..16 bits Mono, Rate, Loop
SDX        1 waveform, 1..16 bits Mono, Rate, Loop, Name, Text
SF         1 waveform, 1..16 bits LINEAR, Mono/Stereo, Rate, Text
SMP        1 waveform, 16 bits Mono, Rate, Loop, Name, Text
SOU        1 waveform, 8/16 bits Mono, Loop, Name
STM        Several waveforms, 8 bits Mono, Rate, Loop, Name, Text
S3I        1 waveform, 8/16 bits, Mono/Stereo, Rate, Name
S3M        Several waveforms, 8/16 bits, Mono/Stereo, Rate, Loop, Name, Text
SYW
TXW        1 waveform, 12 bits Mono, Rate
ULT        Several waveforms, 8/16 bits Mono, Rate, Loop, Name, Text
UNI        Several waveforms, 8/16 bits, Mono/Stereo, Loop, Name, Text
UWF        1 waveform, 8/16 bits Mono, Rate, Loop, Name, Text
VOC        1 waveform, 8 bits Mono, Rate, Loop, Text
WAV        1 waveform, 1..16 bits, Mono/Stereo, Rate, Loop, Name, Text
XI
XM

NOTES

The GKH format accept Giebler Enterprises image format. The first class files
have ".gkh" extension and include various Ensoniq formats. The second class
have ".ed?" extension, where ? is character which indicates disk tipe (e.g.
".eda" is a ASR disk image file of Giebler Enterprises, ".edt" es a TS-10 disk
image,...). These formats basically are an Ensoniq disk image.  For it, when
Convert has to carry out the conversion to other formats, first the internal
files are converted to MSDOS files (INS) and subsequently the conversion is
carried out. I recommend you use the -OUT option with this format in order
to avoid this process every time this file is accesed.

The INS and KRZ formats support multisample instruments , this is, it allows to
assign various waveforms to several ranges of the MIDI keyboard. This feature
is supported upon converting it to PAT if and only if the ranges are not
overlapped. In this way, a complete percussion kit for example would generate
simply one multisample PAT file.

All formats supported can view its internals, although it is compressed or
packed. An error will be displayed if you wants to extract the waves in some
file with unsupported compression or packing.

KRZ format supports stereo waveforms, but this version of convert don't
recognize it, and some waves are incorrectly converted (sounds at lower pitch).

For the SBK format, Convert shows only wavesamples for the RAM area,
do not display ROM based wavesamples because they cannot be extracted (for
this reason, synthgm.sbk which come with SoundBlaster AWE32 don't display
nothing, this bank uses only the General Midi Set stored in the ROM area of
the board and the file only contains instrument info).

I have included the Searchfile (@filename) in this version mainly to let you
to specify which files will compound the SBK bank and which programs will
play each sound. This can be achieved using 'number=sound' (like ultrasnd.ini
but using full path names). Files with multiples waves can missunderstand the
number choosed (only in SBK conversion), E.g:
                        1=tr808.krz
                        2=kiss.wav
if for example tr808.gkh has 15 wavesamples, it will be played through programs
1 to 15. The user wants kiss.wav into program 2, but it can't be because
this is in use already. The program seek an available program (16) and assign
it to kiss.wav.


How to use SBK banks generated with convert?
Once you have obtained a SoundFont Bank (E.g."sample.sbk") you have to download
it into the AWE memory.

First, fill the "USER=" field of the "[AWE32] section
of your "sbwin.ini" file, at windows directory, with the path to the bank
generated (E.g."USER=C:\SB16\SFBANK\sample.sbk").

Second, inside Windows click at the AWE Control Panel and find "User Custom
Synth" in the Synthesizer Bank section. Later click on Stablish and if you
have memory enough, you will have the sounds in the memory.

You can now use Sequencer programs to sound the samples, specifing anyone
program number you have specified.

You can load SBK files generated with Convert inside Vienna too. This version
of Convert supports all feautures of SBK formats and is compatible with Vienna
SF editor.

For a complete guide about formats supported by Convert, see formats.doc.


GRATEFULNESS

I thank the disinterested help of Cris-(tobal) in the previous phase test
and his contribution of formats, Jordi for his beta test and sugered ideas,
as well as all anonymous sources of where I have gotten the specifications of 
the formats (specially to F. Markus Jarsson for KRZ and SYW formats).
I am Sorry for my SPAnglish.


PETITIONS

Since I commented at first, this tool surged with ideas of expansion.  For it
I request to all users that is interested in including other formats to the
program, that they will send to me a description of the format, and if it
is possible, some file(s) for testing. I am specially interested on Maui and
Rio Patch, Drum and Bank format.

Also, I would desire you mail-me any bug or possible improvements of
the program to usufi4@finf.upv.es


START NOW

To start to delight with new and vibrant sounds, this is a small list
where you will find them through the INTERNET.  Personally, I have more
than 200 Mbytes of this sounds!!!

GKH, INS, EFE, AIFF:    ftp.reed.edu in /eps
                        oak.oakland.edu in /pub2/eps
TXW:                    ftp-ls7.informatik.uni-dortmund.de in /pub/tx16w
SDK:                    lotus.UWaterloo.ca in /pub/sgroup
SDS, SDX:               alf.uib.no in /pub/sds
                        sweaty.palm.cri.nz in sds
PAT:                    archive.epas.utoronto.ca in /pub/pc/ultrasound
                        wuarchive.wustl.edu in /systems/ibmpc/ultrasound
KRZ:                    ftp.uwp.edu in /pub/music/lists/kurzweil
                        cs.utk.edu in /pub/martin/K2000
                        bach.nevada.edu in /pub/K2000
SBK:			moon.earthlink.net in /pub/software/AWE32

You will find a wider list on ftp.cs.ruu.nl in the file /pub/MIDI/DOC/archives

HAPPY CONVERSION!!!!!