home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI04.ARJ / ictari.04 / MISC / AUDIO.FAQ / SOUND.TXT
Text File  |  1993-04-20  |  47KB  |  1,097 lines

  1. FAQ: Audio File Formats (version 2.10)
  2. ======================================
  3.  
  4. Table of contents
  5. -----------------
  6.  
  7. Introduction
  8. Device characteristics
  9. Popular sampling rates
  10. Compression schemes
  11. Current hardware
  12. File formats
  13. File conversions
  14. Playing audio files on UNIX
  15. Playing audio files on micros
  16. The Sound Site Newsletter
  17. Posting sounds
  18.  
  19. Appendices:
  20.  
  21.   FTP access for non-internet sites
  22.   AIFF Format (Audio IFF)
  23.   The NeXT/Sun audio file format
  24.   IFF/8SVX Format
  25.   Playing sound on a PC
  26.   The EA-IFF-85 documentation
  27.   US Federal Standard 1016 availability
  28.   Creative Voice (VOC) file format
  29.   RIFF WAVE (.WAV) file format
  30.   U-LAW and A-LAW definitions
  31.   AVR File Format
  32.   
  33.  
  34. Introduction
  35. ------------
  36.  
  37. This is version 2 of this FAQ, which I started in November 1991 under
  38. the name "The audio formats guide".  I bumped the major version number
  39. since the Subject and Newsgroups headers have changed to make the
  40. subject more informative and give the guide a wider audience.  I also
  41. added a Table of contents section at the top.
  42.  
  43. I am posting this about once a fortnight, either unchanged (just to
  44. inform new readers), or updated (if I learn more or when new hardware
  45. or software becomes popular).  I post to alt.binaries.sounds.{misc,d}
  46. and to comp.dsp, for maximal coverage of people interested in audio,
  47. and to news.answers, for easy reference.
  48.  
  49. A companion posting with subject "Change to: ..." is occasionally
  50. posted listing the diffs between a new version and the last.  This is
  51. not reposted, and it is suppressed when the diffs are bigger than the
  52. new version.
  53.  
  54. NEWSFLASH: This FAQ is now also available in distributed hypertext
  55. form!  If you have a WWW browser and direct Internet access you can
  56. point it to "http://voorn.cwi.nl/audio-formats/a00.html".  (WWW is the
  57. CERN World-Wide Web initiative; for more info, telnet or ftp to
  58. info.cern.ch.)
  59.  
  60. Send updates, comments and questions to <guido@cwi.nl>; flames to
  61. /dev/null.
  62.  
  63. I'd like to thank everyone who sent me mail with updates for previous
  64. versions.  The list of names is really too long to list you all...
  65.  
  66.   --Guido van Rossum, CWI, Amsterdam <guido@cwi.nl>
  67.   "Lobster thermidor aux crevettes with a mornay sauce garnished with
  68.   truffle pate, brandy and a fried egg on top and spam"
  69.  
  70.  
  71. Device characteristics
  72. ----------------------
  73.  
  74. In this text, I will only use the term "sample" to refer to a single
  75. output value from an A/D converter, i.e., a small integer number
  76. (usually 8 or 16 bits).
  77.  
  78. Audio data is characterized by the following parameters, which
  79. correspond to settings of the A/D converter when the data was
  80. recorded.  Naturally, the same settings must be used to play the data.
  81.  
  82. - sampling rate (in samples per second), e.g. 8000 or 44100
  83.  
  84. - number of bits per sample, e.g. 8 or 16
  85.  
  86. - number of channels (1 for mono, 2 for stereo, etc.)
  87.  
  88. Approximate sampling rates are often quoted in Hz or kHz ([kilo-]
  89. Hertz), however, the politically correct term is samples per second
  90. (samples/sec).  Sampling rates are always measured per channel, so for
  91. stereo data recorded at 8000 samples/sec, there are actually 16000
  92. samples in a second.  I will sometimes write 8 k as a shorthand for
  93. 8000 samples/sec.
  94.  
  95. Multi-channel samples are generally interleaved on a frame-by-frame
  96. basis: if there are N channels, the data is a sequence of frames,
  97. where each frame contains N samples, one from each channel.  (Thus,
  98. the sampling rate is really the number of *frames* per second.)  For
  99. stereo, the left channel usually comes first.
  100.  
  101. The specification of the number of bits for U-LAW (pronounced mu-law
  102. -- the u really stands for the Greek letter mu) samples is somewhat
  103. problematic.  These samples are logarithmically encoded in 8 bits,
  104. like a tiny floating point number; however, their dynamic range is
  105. that of 14 bit linear data.  Source for converting to/from U-LAW
  106. (written by Jef Poskanzer) is distributed as part of the SOX package
  107. mentioned below; it can easily be ripped apart to serve in other
  108. applications.  The official definition is the CCITT standard G.711.
  109.  
  110. There exists another encoding similar to U-LAW, called A-LAW, which
  111. is used as a European telephony standard.  There is less support for
  112. it in UNIX workstations.
  113.  
  114. (See the Appendix for some formulae describing U-LAW and A-LAW.)
  115.  
  116.  
  117. Popular sampling rates
  118. ----------------------
  119.  
  120. Some sampling rates are more popular than others, for various reasons.
  121. Some recording hardware is restricted to (approximations of) some of
  122. these rates, some playback hardware has direct support for some.  The
  123. popularity of divisors of common rates can be explained by the
  124. simplicity of clock frequency dividing circuits :-).
  125.  
  126. Samples/sec     Description
  127.  
  128. 5500            One fourth of the Mac sampling rate (rarely seen).
  129.  
  130. 7333            One third of the Mac sampling rate (rarely seen).
  131.  
  132. 8000            Exactly 8000 samples/sec is a telephony standard that
  133.                 goes together with U-LAW (and also A-LAW) encoding.
  134.                 Some systems use an slightly different rate; in
  135.                 particular, the NeXT workstation uses 8012.8210513,
  136.                 apparently the rate used by Telco CODECs.
  137.  
  138. 11 k            Either 11025, a quarter of the CD sampling rate,
  139.                 or half the Mac sampling rate (perhaps the most
  140.                 popular rate on the Mac).
  141.  
  142. 16000           Used by, e.g. the G.722 compression standard.
  143.  
  144. 18.9 k          CD-ROM/XA standard.
  145.  
  146. 22 k            Either 22050, half the CD sampling rate, or the Mac
  147.                 rate; the latter is precisely 22254.545454545454 but
  148.                 usually misquoted as 22000.  (Historical note:
  149.                 22254.5454... was the horizontal scan rate of the
  150.                 original 128k Mac.)
  151.  
  152. 32000           Used in digital radio, NICAM (Nearly-Instantaneous
  153.                 Companded Audio Multiplex [IBA/BREMA/BBC]) and other
  154.                 TV work, at least in the UK; also long play DAT and
  155.                 Japanese HDTV.
  156.  
  157. 37.8 k          CD-ROM/XA standard for higher quality.
  158.  
  159. 44056           This weird rate is used by professional audio
  160.                 equipment to fit an integral number of samples in a
  161.                 video frame.
  162.  
  163. 44100           The CD sampling rate.  (DAT players recording
  164.                 digitally from CD also use this rate.)
  165.  
  166. 48000           The DAT (Digital Audio Tape) sampling rate for
  167.                 domestic use.
  168.  
  169. Files samples on SoundBlaster hardware have sampling rates that are
  170. divisors of 1000000.
  171.  
  172. While professinal musicians disagree, most people don't have a problem
  173. if recorded sound is played at a slightly different rate, say, 1-2%.
  174. On the other hand, if recorded data is being fed into a playback
  175. device in real time (say, over a network), even the smallest
  176. difference in sampling rate can frustrate the buffering scheme used...
  177.  
  178. There may be an emerging tendency to standardize on only a few
  179. sampling rates and encoding styles, even if the file formats may
  180. differ.  The suggested rates and styles are:
  181.  
  182.     rate (samp/sec) style mono/stereo
  183.  
  184.     8000 8-bit U-LAW mono
  185.     22050 8-bit linear unsigned mono and stereo
  186.     44100 16-bit linear signed mono and stereo
  187.  
  188.  
  189. Compression schemes
  190. -------------------
  191.  
  192. Strange though it seems, audio data is remarkably hard to compress
  193. effectively.  For 8-bit data, a Huffman encoding of the deltas between
  194. successive samples is relatively successful.  For 16-bit data,
  195. companies like Sony and Philips have spent millions to develop
  196. proprietary schemes.
  197.  
  198. Public standards for voice compression are slowly gaining popularity,
  199. e.g. CCITT G.721 and G.723 (ADPCM at 32 and 24 kbits/sec).  (ADPCM ==
  200. Adaptive Delta Pulse Code Modulation.)  Free source code for a *fast*
  201. 32 kbits/sec ADPCM algorithm is available by ftp from ftp.cwi.nl as
  202. /pub/adpcm.shar.  (** NOTE: if you are using v1.0, you should get
  203. v1.1, released 17-Dec-1992, which fixes a serious bug -- the quality
  204. of v1.1 is claimed to be better than uLAW **)
  205.  
  206. There are also two US federal standards, 1016 (Code excited linear
  207. prediction (CELP), 4800 bits/s) and 1015 (LPC-10E, 2400 bits/s).  See
  208. also the appendix for 1016.
  209.  
  210. (Note that U-LAW and silence detection can also be considered
  211. compression schemes.)
  212.  
  213. Here's a note about audio codings by Van Jacobson <van@ee.lbl.gov>:
  214. Several people used the words "LPC" and "CELP" interchangably.  They
  215. are very different.  An LPC (Linear Predictive Coding) coder fits
  216. speech to a simple, analytic model of the vocal tract, then throws
  217. away the speech & ships the parameters of the best-fit model.  An LPC
  218. decoder uses those parameters to generate synthetic speech that is
  219. usually more-or-less similar to the original.  The result is
  220. intelligible but sounds like a machine is talking.  A CELP (Code
  221. Excited Linear Predictor) coder does the same LPC modeling but then
  222. computes the errors between the original speech & the synthetic model
  223. and transmits both model parameters and a very compressed
  224. representation of the errors (the compressed representation is an
  225. index into a 'code book' shared between coders & decoders -- this is
  226. why it's called "Code Excited").  A CELP coder does much more work
  227. than an LPC coder (usually about an order of magnitude more) but the
  228. result is much higher quality speech: The FIPS-1016 CELP we're working
  229. on is essentially the same quality as the 32Kb/s ADPCM coder but uses
  230. only 4.8Kb/s (the same as the LPC coder).
  231.  
  232. Finally, the comp.compression FAQ has some text on the 6:1 audio
  233. compression scheme used by MPEG (a video compression standard-to-be).
  234. It's interesting to note that video compression reaches much higher
  235. ratios (like 26:1).  This FAQ is ftp'able from rtfm.mit.edu
  236. [18.72.1.58] in directory /pub/usenet/news.answers/compression-faq,
  237. files part1 and part2.
  238.  
  239. Comp.compression also carries a regular posting "How to uncompress
  240. anything" by David Lemson <lemson@uiuc.edu>, which (tersely) hints on
  241. which program you need to uncompress a file whose name ends in .<foo>
  242. for almost any conceivable <foo>.  Ftp'able from ftp.cso.uiuc.edu
  243. (128.174.5.59) in the directory /doc/pcnet as the file compression.
  244.  
  245.  
  246. Current hardware
  247. ----------------
  248.  
  249. I am aware of the following computer systems that can play back and
  250. (sometimes) record audio data, with their characteristics.  Note that
  251. for most systems you can also buy "professional" sampling hardware,
  252. which supports much better quality, e.g. >= 44.1 k 16 bits stereo.
  253. The characteristics listed here are a rough estimate of the
  254. capabilities of the basic hardware only (and even here I am on thin
  255. ice, with systems becoming ever more powerful).
  256.  
  257. machine             bits            max sampling rate    #output channels
  258.  
  259. Mac                 8               22k                  1
  260. Apple IIgs          8               32k / >70k           8(st)
  261. PC/Soundblaster v1  8               13k / 22k            1
  262. PC/Soundblaster v2  8               15k / 44.1k          1
  263. PC/PAS-16           16              44.1k                ?(st)
  264. Atari ST            8               22k                  1
  265. Atari STe,TT        8               50k                  2
  266. Atari Falcon 030    16              50k                  8(st)
  267. Amiga               8               ~29k                 4(st)
  268. Sun Sparc           U-LAW           8k                   1
  269. Sun Sparcst. 10     U-LAW,8,16      48k                  1(st)
  270. NeXT                U-LAW,8,16      44.1k                1(st)
  271. SGI Indigo          8,16            48k                  4(st)
  272. Acorn Archimedes    ~U-LAW          ~180k                8(st)
  273. Sony RISC-NEWS      8, 16           37.8k                ?(st)
  274. VAXstation 4000     U-LAW           8k                   1
  275. Tandy 1000/*L*      8               22k                  3
  276. HP9000/705,710,425e U,A-LAW,8       8k                   1
  277.  
  278. 4(st) means "four voices, stereo"; sampling rates xx/yy are
  279. different recording/playback rates; *L* is any type with 'L' in it.
  280.  
  281. All these machines can play back sound without additional hardware,
  282. although the needed software is not always standard; only the Sun,
  283. NeXT and SGI come with standard sampling hardware (the NeXT only
  284. samples U-LAW at 8000 samples/sec from the built-in microphone port;
  285. you need a separate board for other rates).
  286.  
  287. The new VAXstation 4000 (VLC and model 60) series lets you PLAY audio
  288. (.au) files, and the package DECsound will let you do the recording.
  289. In fact, DECsound is given away free with Motif 1.1 and supports the
  290. VAXstation, Sun SPARCstation, DECvoice, and XMedia audio devices.  Sun
  291. sound files work without change.
  292.  
  293. The SGI Personal IRIS 4D/30 and 4D/35 have the same capabilities as
  294. the Indigo.
  295.  
  296. The new Apple Macs have more powerful audio hardware; the latest
  297. models have built-in microphones.
  298.  
  299. Software exists for the PC that can play sound on its 1-bit speaker
  300. using pulse width modulation (see appendix); the Soundblaster board
  301. records at rates up to 13 k and plays back up to 22 k (weird
  302. combination, but that's the way it is).
  303.  
  304. Here's some info about the newest Atari machine, the Falcon030.  This
  305. machine has stereo 16 bit CODECs and a 32 MHz Motorola 56001 that can
  306. handle 8 channels of 16 bit audio, up to 50 khz/channel with
  307. simultaneous playback and record.  The Falcon DMA sound engine is also
  308. compatible with the 8 bit stereo DMA used on the STe and TT. All of
  309. these systems use signed data.
  310.  
  311. On the NeXT, the Motorola 56001 DSP chip is programmable and you can
  312. (in principle) do what you want.  The SGI uses the same DSP chip but
  313. it can't be programmed by users -- SGI prefers to offer it as a shared
  314. system resource to multiple applications, thus enabling developers to
  315. program audio with their Audio Library and avoid code modifications
  316. for execution on future machines with different audio hardware, i.e. a
  317. different DSP.
  318.  
  319. The Amiga also has a 6-bit volume, which can be used to produce
  320. something like a 14-bit output for each voice.  The hardware can also
  321. use one of each voice-pair to modulate the other in FM (period) or AM
  322. (volume, 6-bits).
  323.  
  324. The Acorn Archimedes uses a variation on U-LAW with the bit order
  325. reversed and the sign bit in bit 0.  Being a 'minority' architecture,
  326. Arc owners are quite adept at converting sound/image formats from
  327. other machines, and it is unlikely that you'll ever encounter sound in
  328. one of the Arc's own formats (there are several).
  329.  
  330. CD-I machines form a special category.  The following formats are used:
  331.  
  332.      - PCM 44.1 kHz standard CD format
  333.      - ADPCM - Addaptive Delta PCM
  334.        - Level A 37.8 kHz 8-bit
  335.        - Level B 37.8 kHz 4-bit
  336.        - Level C 18.9 kHz 4-bit
  337.  
  338.  
  339. File formats
  340. ------------
  341.  
  342. Historically, almost every type of machine used its own file format
  343. for audio data, but some file formats are more generally applicable,
  344. and in general it is possible to define conversions between almost any
  345. pair of file formats -- sometimes losing information, however.
  346.  
  347. File formats are a separate issue from device characteristics.  There
  348. are two types of file formats: self-describing formats, where the
  349. device parameters and encoding are made explicit in some form of
  350. header, and "raw" formats, where the device parameters and encoding
  351. are fixed.
  352.  
  353. Self-describing file formats generally define a family of data
  354. encodings, where a header fields indicates the particular encoding
  355. variant used.  Headerless formats define a single encoding and usually
  356. allows no variation in device parameters (except sometimes sampling
  357. rate, which can be a pain to figure out other than by listening to the
  358. sample).
  359.  
  360. The header of self-describing formats contains the parameters of the
  361. sampling device and sometimes other information (e.g. a
  362. human-readable description of the sound, or a copyright notice).  Most
  363. headers begin with a simple "magic word".  (Some formats do not simply
  364. define a header format, but may contain chunks of data intermingled
  365. with chunks of encoding info.)  The data encoding defines how the
  366. actual samples are stored in the file, e.g. signed or unsigned, as
  367. bytes or short integers, in little-endian or big-endian byte order,
  368. etc.  Strictly spoken, channel interleaving is also part of the
  369. encoding, although so far I have seen little variation in this area.
  370.  
  371. Some file formats apply some kind of compression to the data, e.g.
  372. Huffman encoding, or simple silence deletion.
  373.  
  374. Here's an overview of popular file formats.
  375.  
  376.         Self-describing file formats
  377.         ----------------------------
  378.  
  379. extension, name   origin          variable parameters (fixed; comments)
  380.  
  381. .au or .snd       NeXT, Sun       rate, #channels, encoding, info string
  382. .aif(f), AIFF     Apple, SGI      rate, #channels, sample width, lots of info
  383. .aif(f), AIFC     Apple, SGI      same (extension of AIFF with compression)
  384. .iff, IFF/8SVX    Amiga           rate, #channels, instrument info (8 bits)
  385. .voc              Soundblaster    rate (8 bits/1 ch; can use silence deletion)
  386. .wav, WAVE        Microsoft       rate, #channels, sample width, lots of info
  387. .sf               IRCAM           rate, #channels, encoding, info
  388. none, HCOM        Mac             rate (8 bits/1 ch; uses Huffman compression)
  389. none, MIME        Internet        (see below)
  390. .mod or .nst      Amiga           (see below)
  391.  
  392. Note that the filename extension ".snd" is ambiguous: it can be either
  393. the self-describing NeXT format or the headerless Mac/PC format, or
  394. even a headerless Amiga format.
  395.  
  396. I know nothing for sure about the origin of HCOM files, only that
  397. there are a lot of them floating around on our system and probably at
  398. FTP sites over the world.  The filenames usually don't have a ".hcom"
  399. extension, but this is what SOX (see below) uses.  The file format
  400. recognized by SOX includes a MacBinary header, where the file
  401. type field is "FSSD".  The data fork begins with the magic word "HCOM"
  402. and contains Huffman compressed data; after decompression it it is 8
  403. bits unsigned data.
  404.  
  405. IFF/8SVX allows for amplitude contours for sounds (attack/decay/etc).
  406. Compression is optional (and extensible); volume is variable; author,
  407. notes and copyright properties; etc.
  408.  
  409. AIFF, AIFC and WAVE are similar in spirit but allow more freedom in
  410. encoding style (other than 8 bit/sample), amongst others.
  411.  
  412. There are other sound formats in use on Amiga by digitizers and music
  413. programs, such as IFF/SMUS.
  414.  
  415. Appendices describes the NeXT and VOC formats; pointers to more info
  416. about AIFF, AIFC, 8SVX and WAVE (which are too complex to describe
  417. here) are also in appendices.
  418.  
  419. DEC systems (e.g. DECstation 5000) use a variant of the NeXT format
  420. that uses little-endian encoding and has a different magic number
  421. (0x0064732E in little-endian encoding).
  422.  
  423. Standard file formats used in the CD-I world are IFF but on the disc
  424. they're in realtime files.
  425.  
  426. An interesting "interchange format" for audio data is described in the
  427. proposed Internet Standard "MIME", which describes a family of
  428. transport encodings and structuring devices for electronic mail.  This
  429. is an extensible format, and initially standardizes a type of audio
  430. data dubbed "audio/basic", which is 8-bit U-LAW data sampled at 8000
  431. samples/sec.
  432.  
  433. Finally, a somewhat different but popular format are "MOD" files,
  434. usually with extension ".mod" or ".nst" (they can also have a prefix
  435. of "mod.").  This originated at the Amiga but players now exist for
  436. many platforms.  MOD files are music files containing 2 parts: (1) a
  437. bank of digitized samples; (2) sequencing information describing how
  438. and when to play the samples.  See the appendix "The Amiga MOD Format"
  439. for a description of this file format.
  440.  
  441.         Headerless file formats
  442.         -----------------------
  443.  
  444. extension       origin          parameters
  445. or name
  446.  
  447. .snd, .fssd     Mac, PC         variable rate, 1 channel, 8 bits unsigned
  448. .ul             US telephony    8 k, 1 channel, 8 bit "U-LAW" encoding
  449. .snd?           Amiga           variable rate, 1 channel, 8 bits signed
  450.  
  451. It is usually easy to distinguish 8-bit signed formats from unsigned
  452. by looking at the beginning of the data with 'od -b <file | head';
  453. since most sounds start with a little bit of silence containing small
  454. amounts of background noise, the signed formats will have an abundance
  455. of bytes with values 0376, 0377, 0, 1, 2, while the unsigned formats
  456. will have 0176, 0177, 0200, 0201, 0202 instead.  (Using "od -c" will
  457. also show any headers that are tacked in front of the file.)
  458.  
  459. The Apple IIgs records raw data in the same format as the Mac, but
  460. uses a 0 byte as a terminator; samples with value 0 are replaced by 1.
  461.  
  462.  
  463. File conversions
  464. ----------------
  465.  
  466.     SOX
  467.     ---
  468.  
  469. The most versatile tool for converting between various audio formats
  470. is SOX ("Sound Exchange").  It can read and write various types of
  471. audio files, and optionally applies some special effects (e.g. echo,
  472. channel averaging, or rate conversion).
  473.  
  474. SOX recognizes all filename extensions listed above except ".snd",
  475. which would be ambiguous anyway, and ".wav" (but there's a patch, see
  476. below).  Use type ".au" for NeXT ".snd" files.  Mac and PC ".snd"
  477. files are completely described by these parameters:
  478.  
  479.       -t raw -b -u -r 11000
  480.  
  481. (or -r 22000 or -r 7333 or -r 5500; 11000 seems to be the most common
  482. rate).
  483.  
  484. The source for SOX, version 5, was posted to alt.sources, and should
  485. be widely archived.  To save you the trouble of hunting it down, it
  486. can be gotten by anonymous ftp from wuarchive.wustl.edu, in the
  487. directory usenet/alt.sources/articles, files 5581.Z through 5585.Z.
  488. (These files are compressed news articles containing shar files, if
  489. you hadn't guessed.)  I am sure many sites have similar archives, I'm
  490. just listing one that I know of and which carries a lot of this kind
  491. of stuff.  (Also see the appendix if you don't have Internet access.)
  492.  
  493. A compressed tar file containing the same version of SOX is available
  494. by anonymous ftp from ftp.cwi.nl [192.16.184.180], in /pub/sox*.tar.Z.
  495. You may be able to locate a nearer version using archie!
  496.  
  497. Ports of SOX:
  498.  
  499. - The source as posted should compile on any UNIX system with 4-byte
  500.   integers.
  501.  
  502. - A PC version is available by ftp from ftp.cwi.nl (see above) as
  503.   pub/sox4*.zip; also available from the garbo mail server.
  504.  
  505. - The latest Amiga SOX (corresponding to version 5) is available via
  506.   anonymous ftp to wuarchive.wustl.edu, files
  507.   systems/amiga/audio/utils/amisox*.  (See below for a non-SOX
  508.   solution.)
  509.  
  510. SOX usage hints:
  511.  
  512. - Often, the filename extension of sound files posted on the net is
  513.   wrong.  Don't give up, try a few other possibilities using the
  514.   "-t <type>" option.  Remember that the most common file type is
  515.   unsigned bytes, which can be indicated with "-t ub".  You'll have to
  516.   guess the proper sampling rate, but often it's 11k or 22k.
  517.  
  518. - In particular, with SOX version 4 (or earlier), you have to
  519.   specify "-t 8svx" for files with an .iff extension.
  520.  
  521. - When converting linear samples to U-LAW using the .au type for the
  522.   output file, you must specify "-U" for the output file, otherwise
  523.   you will end up with a file containing a NeXT/Sun header but linear
  524.   samples -- only the NeXT will play such files correctly.  Also, you
  525.   must explicitly specify an output sampling rate with "-r 8000".
  526.   (This may seem fixed for most cases in version 5, but it is still
  527.   occasionally necessary, so I'm keeping this warning in.)
  528.  
  529.         Sun Sparc
  530.         ---------
  531.  
  532. On Sun Sparcs, starting at SunOS 4.1, a program "raw2audio" is
  533. provided by Sun (in /usr/demo/SOUND -- see below) which takes a raw
  534. U-LAW file and turns it into a ".au" file by prefixing it with an
  535. appropriate header.
  536.  
  537.         NeXT
  538.         ----
  539.  
  540. On NeXTs, you can usually rename .au files to .snd and it'll work like
  541. a charm, but some .au files lack header info that the NeXT needs.
  542. This can be fixed by using sndconvert:
  543.  
  544.         sndconvert -c 1 -f 1 -s 8012.8210513 -o nextfile.snd sunfile.au
  545.  
  546.         SGI Indigo and Personal IRIS
  547.         ----------------------------
  548.  
  549. SGI supports "soundfiler" (in /usr/sbin), a program similar in
  550. spirit to SOX but with a GUI.  Soundfiler plays aiff, aifc, NeXT/Sun
  551. and .wav formats.  It can do conversions between any of these formats
  552. and to and from raw formats including mulaw.  It also does sample rate
  553. conversions.
  554.  
  555. Three shell commands are also provided that give the same functionality:
  556. "sfplay", "sfconvert", and "aifcresample" (all in /usr/sbin).
  557.  
  558.         Amiga
  559.         -----
  560.  
  561. Mike Cramer's SoundZAP can do no effects except rate change and it
  562. only does conversions to IFF, but it is generally much faster than
  563. SOX.  (Ftp'able from the same directory as amisox above.)
  564.  
  565.         Tandy
  566.         -----
  567.  
  568. The Tandy 1000 uses a (proprietary?) compressed format.  There is a
  569. PD Mac to Tandy conversion program called CONVERT.
  570.  
  571.  
  572. Playing audio files on UNIX
  573. ---------------------------
  574.  
  575. The commands needed to play an audio file depend on the file format
  576. and the available hardware and software.  Most systems can only
  577. directly play sound in their native format; use a conversion program
  578. (see above) to play other formats.
  579.  
  580.         Sun Sparcstation running SunOS 4.x
  581.         ----------------------------------
  582.  
  583. Raw U-LAW files can be played using "cat file >/dev/audio".
  584.  
  585. A whole package for dealing with ".au" files is provided by Sun on an
  586. experimental basis, in /usr/demo/SOUND.  You may have to compile the
  587. programs first.  (If you can't find this directory, either you are not
  588. running SunOS 4.1 yet, or your system administrator hasn't installed
  589. it -- go ask him for it, not me!)  The program "play" in this
  590. directory recognizes all files in Sun/NeXT format, but a SS 1 or 2 can
  591. play only those using U-LAW encoding at 8 k -- the SS 10 hardware
  592. plays other encodings, too.
  593.  
  594. If you ca't find "play", you can also cat a ".au" file to /dev/audio,
  595. if it uses U-LAW; the header will sound like a short burst of noise
  596. but the rest of the data will sound OK (really, the only difference in
  597. this case between raw U-LAW and ".au" files is the header; the U-LAW
  598. data is exactly the same).
  599.  
  600. Finally, OpenWindows 3.0 has a full-fledged audio tool.  You can drop
  601. audio file icons into it, edit them, etc.
  602.  
  603.         Sun Sparcstation running Solaris 2.0
  604.         ------------------------------------
  605.  
  606. Under SVR4 (and hence Solaris 2.0), writing to /dev/audio from the
  607. shell is a bad idea, because the device driver will flush its queue as
  608. soon as the file is closed.  Use "audioplay" instead.  The supported
  609. formats and sampling rates are the same as above.
  610.  
  611. ------------------------------------------------------------------------
  612. AIFF Format (Audio IFF) and AIFC
  613. --------------------------------
  614.  
  615. This format was developed by Apple for storing high-quality sampled
  616. sound and musical instrument info; it is also used by SGI and several
  617. professional audio packages (sorry, I know no names).  An extension,
  618. called AIFC or AIFF-C, supports compression (see the last item below).
  619.  
  620. I've made a BinHex'ed MacWrite version of the AIFF spec (no idea if
  621. it's the same text as mentioned below) available by anonymous ftp from
  622. ftp.cwi.nl [192.16.184.180]; the file is /pub/AudioIFF1.2.hqx.  But
  623. you may be better off with the AIFF-C specs, see below.
  624.  
  625. Mike Brindley (brindley@ece.orst.edu) writes:
  626.  
  627. "The complete AIFF spec by Steve Milne, Matt Deatherage (Apple) is
  628. available in 'AMIGA ROM Kernal Reference Manual: Devices (3rd Edition)'
  629. 1991 by Commodore-Amiga, Inc.; Addison-Wesley Publishing Co.; 
  630. ISBN 0-201-56775-X, starting on page 435 (this edition has a charcoal
  631. grey cover).  It is available in most bookstores, and soon in many
  632. good librairies."
  633.  
  634. Finally, Mark Callow writes (in comp.sys.sgi):
  635.  
  636. "I have placed a PostScript version of the AIFF-C specification on
  637. sgi.sgi.com for public ftp.  It is in the file sgi/aiff-c.9.26.91.ps.
  638.  
  639. sgi.sgi.com's internet host number is (I think) 192.48.153.1."
  640.  
  641. ------------------------------------------------------------------------
  642. IFF/8SVX Format
  643. ---------------
  644.  
  645. Newsgroups: alt.binaries.sounds.d,alt.sex.sounds
  646. Subject: Format of the IFF header (Amiga sounds)
  647. Message-ID: <2509@tardis.Tymnet.COM>
  648. From: jms@tardis.Tymnet.COM (Joe Smith)
  649. Date: 23 Oct 91 23:54:38 GMT
  650. Followup-To: alt.binaries.sounds.d
  651. Organization: BT North America (Tymnet)
  652.  
  653. The first 12 bytes of an IFF file are used to distinguish between an Amiga
  654. picture (FORM-ILBM), an Amiga sound sample (FORM-8SVX), or other file
  655. conforming to the IFF specification.  The middle 4 bytes is the count of
  656. bytes that follow the "FORM" and byte count longwords.  (Numbers are stored
  657. in M68000 form, high order byte first.)
  658.  
  659.                 ------------------------------------------
  660.  
  661. FutureSound audio file, 15000 samples at 10.000KHz, file is 15048 bytes long.
  662.  
  663. 0000: 464F524D 00003AC0 38535658 56484452    FORM..:.8SVXVHDR
  664.       F O R M     15040 8 S V X  V H D R
  665. 0010: 00000014 00003A98 00000000 00000000    ......:.........
  666.             20    15000        0        0
  667. 0020: 27100100 00010000 424F4459 00003A98    '.......BODY..:.
  668.      10000 1 0    1.0   B O D Y     15000
  669.  
  670. 0000000..03 = "FORM", identifies this as an IFF format file.
  671. FORM+00..03 (ULONG) = number of bytes that follow.  (Unsigned long int.)
  672. FORM+03..07 = "8SVX", identifies this as an 8-bit sampled voice.
  673.  
  674. ????+00..03 = "VHDR", Voice8Header, describes the parameters for the BODY.
  675. VHDR+00..03 (ULONG) = number of bytes to follow. 
  676. VHDR+04..07 (ULONG) = samples in the high octave 1-shot part.
  677. VHDR+08..0B (ULONG) = samples in the high octave repeat part.
  678. VHDR+0C..0F (ULONG) = samples per cycle in high octave (if repeating), else 0.
  679. VHDR+10..11 (UWORD) = samples per second.  (Unsigned 16-bit quantity.)
  680. VHDR+12     (UBYTE) = number of octaves of waveforms in sample.
  681. VHDR+13     (UBYTE) = data compression (0=none, 1=Fibonacci-delta encoding).
  682. VHDR+14..17 (FIXED) = volume.  (The number 65536 means 1.0 or full volume.)
  683.  
  684. ????+00..03 = "BODY", identifies the start of the audio data.
  685. BODY+00..03 (ULONG) = number of bytes to follow.
  686. BODY+04..NNNNN      = Data, signed bytes, from -128 to +127.
  687.  
  688. 0030: 04030201 02030303 04050605 05060605
  689. 0040: 06080806 07060505 04020202 01FF0000
  690. 0050: 00000000 FF00FFFF FFFEFDFD FDFEFFFF
  691. 0060: FDFDFF00 00FFFFFF 00000000 00FFFF00
  692. 0070: 00000000 00FF0000 00FFFEFF 00000000
  693. 0080: 00010000 000101FF FF0000FE FEFFFFFE
  694. 0090: FDFDFEFD FDFFFFFC FDFEFDFD FEFFFEFE
  695. 00A0: FFFEFEFE FEFEFEFF FFFFFEFF 00FFFF01
  696.  
  697. This small section of the audio sample shows the number ranging from -5 (0xFD)
  698. to +8 (0x08).  Warning: Do not assume that the BODY starts 48 bytes into the
  699. file.  In addition to "VHDR", chunks labeled "NAME", "AUTH", "ANNO", or 
  700. "(c) " may be present, and may be in any order.  You will have to check the
  701. byte count in each chunk to determine how many bytes to skip.
  702.  
  703. ------------------------------------------------------------------------
  704. The EA-IFF-85 documentation
  705. ---------------------------
  706.  
  707. From: dgc3@midway.uchicago.edu
  708.  
  709. As promised, here's an ftp location for the EA-IFF-85 documentation.  It's
  710. the November 1988 release as revised by Commodore (the last public release),
  711. with specifications for IFF FORMs for graphics, sound, formatted text, and
  712. more.  IFF FORMS now exist for other media, including structured drawing, and
  713. new documentation is now available only from Commodore.
  714.  
  715. The documentation is at grind.isca.uiowa.edu [128.255.19.233], in the
  716. directory /amiga/f1/ff185.  The complete file list is as follows:
  717.  
  718. DOCUMENTS.zoo    
  719. EXAMPLES.zoo     
  720. EXECUTABLE.zoo   
  721. INCLUDE.zoo      
  722. LINKER_INFO.zoo  
  723. OBJECT.zoo       
  724. SOURCE.zoo       
  725. TP_IFF_Specs.zoo 
  726.  
  727. All files except DOCUMENTS.zoo are Amiga-specific, but may be used as a basis
  728. for conversion to other platforms.  Well, I take that tentatively back.  I
  729. don't know what TP_IFF_Specs.zoo contains, so it might be non-Amiga-specific.
  730.  
  731. ------------------------------------------------------------------------
  732. Creative Voice (VOC) file format
  733. --------------------------------
  734.  
  735. From: galt@dsd.es.com
  736.  
  737. (byte numbers are hex!)
  738.  
  739.     HEADER (bytes 00-19)
  740.     Series of DATA BLOCKS (bytes 1A+) [Must end w/ Terminator Block]
  741.  
  742. - ---------------------------------------------------------------
  743.  
  744. HEADER:
  745. =======
  746.      byte #     Description
  747.      ------     ------------------------------------------
  748.      00-12      "Creative Voice File"
  749.      13         1A (eof to abort printing of file)
  750.      14-15      Offset of first datablock in .voc file (std 1A 00
  751.                 in Intel Notation)
  752.      16-17      Version number (minor,major) (VOC-HDR puts 0A 01)
  753.      18-19      2's Comp of Ver. # + 1234h (VOC-HDR puts 29 11)
  754.  
  755. - ---------------------------------------------------------------
  756.  
  757. DATA BLOCK:
  758. ===========
  759.  
  760.    Data Block:  TYPE(1-byte), SIZE(3-bytes), INFO(0+ bytes)
  761.    NOTE: Terminator Block is an exception -- it has only the TYPE byte.
  762.  
  763.       TYPE   Description     Size (3-byte int)   Info
  764.       ----   -----------     -----------------   -----------------------
  765.       00     Terminator      (NONE)              (NONE)
  766.       01     Sound data      2+length of data    *
  767.       02     Sound continue  length of data      Voice Data
  768.       03     Silence         3                   **
  769.       04     Marker          2                   Marker# (2 bytes)
  770.       05     ASCII           length of string    null terminated string
  771.       06     Repeat          2                   Count# (2 bytes)
  772.       07     End repeat      0                   (NONE)
  773.  
  774.       *Sound Info Format:       **Silence Info Format:
  775.        ---------------------      ----------------------------
  776.        00   Sample Rate           00-01  Length of silence - 1
  777.        01   Compression Type      02     Sample Rate
  778.        02+  Voice Data
  779.  
  780.  
  781.   Marker#           -- Driver keeps the most recent marker in a status byte
  782.   Count#            -- Number of repetitions + 1
  783.                          Count# may be 1 to FFFE for 0 - FFFD repetitions
  784.                          or FFFF for endless repetitions
  785.   Sample Rate       -- SR byte = 256-(1000000/sample_rate)
  786.   Length of silence -- in units of sampling cycle
  787.   Compression Type  -- of voice data
  788.                          8-bits    = 0
  789.                          4-bits    = 1
  790.                          2.6-bits  = 2
  791.                          2-bits    = 3
  792.                          Multi DAC = 3+(# of channels) [interesting--
  793.                                        this isn't in the developer's manual]
  794.  
  795. ------------------------------------------------------------------------
  796. RIFF WAVE (.WAV) file format
  797. ----------------------------
  798.  
  799. RIFF is a format by Microsoft and IBM which is similar in spirit and
  800. functionality as EA-IFF-85, but not compatible (and it's in
  801. little-endian byte order, of course :-).  WAVE is RIFF's equivalent of
  802. AIFF, and its inclusion in Microsoft Windows 3.1 has suddenly made it
  803. important to know about.
  804.  
  805. Rob Ryan was kind enough to send me a description of the RIFF format.
  806. Unfortunately, it is too big to include here (27 k), but I've made it
  807. available for anonymous ftp as ftp.cwi.nl:/pub/RIFF-format.
  808.  
  809. And here's a pointer to the official description from Matt Saettler,
  810. Microsoft Multimedia:
  811.  
  812. "The complete definition of the WAVE file format as defined by
  813. IBM/Microsoft is available for anon. FTP from ftp.uu.net in the
  814. vendor/microsoft/multimedia directory."
  815.  
  816. (Rob Ryan's version may actually be an extract from one of the files
  817. stored there.)
  818.  
  819. ------------------------------------------------------------------------
  820. U-LAW and A-LAW definitions
  821. ---------------------------
  822.  
  823. [Adapted from information provided by duggan@cc.gatech.edu (Rick
  824. Duggan) and davep@zenobia.phys.unsw.EDU.AU (David Perry)]
  825.  
  826. u-LAW (really mu-LAW) is
  827.  
  828.           sgn(m)   (     |m |)       |m |
  829.    y=    ------- ln( 1+ u|--|)       |--| =< 1
  830.          ln(1+u)   (     |mp|)       |mp|         
  831.  
  832. A-LAW is
  833.  
  834.      |     A    (m )                 |m |    1
  835.      |  ------- (--)                 |--| =< - 
  836.      |  1+ln A  (mp)                 |mp|    A     
  837.    y=|
  838.      | sgn(m) (        |m |)    1    |m |
  839.      | ------ ( 1+ ln A|--|)    - =< |--| =< 1
  840.      | 1+ln A (        |mp|)    A    |mp|         
  841.  
  842. Values of u=100 and 255, A=87.6, mp is the Peak message value, m is
  843. the current quantised message value.  (The formulae get simpler if you
  844. substitute x for m/mp and sgn(x) for sgn(m); then -1 <= x <= 1.)
  845.  
  846. Converting from u-LAW to A-LAW is in a sense "lossy" since there are
  847. quantizing errors introduced in the conversion.
  848.  
  849. "..the u-LAW used in North America and Japan, and the
  850. A-LAW used in Europe and the rest of the world and
  851. international routes.."
  852.  
  853. References:
  854.  
  855. Modern Digital and Analog Communication Systems, B.P.Lathi., 2nd ed.
  856. ISBN 0-03-027933-X
  857.  
  858. Transmission Systems for Communications
  859. Fifth Edition
  860. by Members of the Technical Staff at Bell Telephone Laboratories
  861. Bell Telephone Laboratories, Incorporated
  862. Copyright 1959, 1964, 1970, 1982
  863.  
  864. ------------------------------------------------------------------------
  865. AVR File Format
  866. ---------------
  867.  
  868. From: hyc@hanauma.Jpl.Nasa.Gov (Howard Chu)
  869.  
  870. A lot of PD software exists to play Mac .snd files on the ST. One other
  871. format that seems pretty popular (used by a number of commercial packages)
  872. is the AVR format (from Audio Visual Research). This format has a 128 byte
  873. header that looks like this:
  874.  
  875.         char magic[4]="2BIT";
  876.         char name[8];           /* null-padded sample name */
  877.         short mono;             /* 0 = mono, 0xffff = stereo */
  878.         short rez;              /* 8 = 8 bit, 16 = 16 bit */
  879.         short sign;             /* 0 = unsigned, 0xffff = signed */
  880.         short loop;             /* 0 = no loop, 0xffff = looping sample */
  881.         short midi;             /* 0xffff = no MIDI note assigned,
  882.                                    0xffXX = single key note assignment
  883.                                    0xLLHH = key split, low/hi note */
  884.         long rate;              /* sample frequency in hertz */
  885.         long size;              /* sample length in bytes or words (see rez) */
  886.         long lbeg;              /* offset to start of loop in bytes or words.
  887.                                    set to zero if unused. */
  888.         long lend;              /* offset to end of loop in bytes or words.
  889.                                    set to sample length if unused. */
  890.         short res1;             /* Reserved, MIDI keyboard split */
  891.         short res2;             /* Reserved, sample compression */
  892.         short res3;             /* Reserved */
  893.         char ext[20];           /* Additional filename space, used
  894.                                    if (name[7] != 0) */
  895.         char user[64];          /* User defined. Typically ASCII message. */
  896.  
  897. -----------------------------------------------------------------------
  898. The Amiga MOD Format
  899. --------------------
  900.  
  901. From: norlin@mailhost.ecn.uoknor.edu (Norman Lin)
  902.  
  903. MOD files are music files containing 2 parts:
  904.  
  905. (1) a bank of digitized samples
  906. (2) sequencing information describing how and when to play the samples
  907.  
  908. MOD files originated on the Amiga, but because of their flexibility
  909. and the extremely large number of MOD files available, MOD players
  910. are now available for a variety of machines (IBM PC, Mac, Sparc
  911. Station, etc.)
  912.  
  913. The samples in a MOD file are raw, 8 bit, signed, headerless, linear
  914. digital data.  There may be up to 31 distinct samples in a MOD file,
  915. each with a length of up to 128K (though most are much smaller; say,
  916. 10K - 60K).  An older MOD format only allowed for up to 15 samples in
  917. a MOD file; you don't see many of these anymore.  There is no standard
  918. sampling rate for these samples.
  919.  
  920. The sequencing information in a MOD file contains 4 tracks of
  921. information describing which, when, for how long, and at what frequency
  922. samples should be played.  This means that a MOD file can have up
  923. to 31 distinct (digitized) instrument sounds, with up to 4 playing
  924. simultaneously at any given point.  This allows a wide variety
  925. of orchestrational possibilities, including use of voice samples
  926. or creation of one's own instruments (with appropriate sampling
  927. hardware/software).  The ability to use one's own samples as instruments
  928. is a flexibility that other music files/formats do not share, and
  929. is one of the reasons MOD files are so popular, numerous, and diverse.
  930.  
  931. 15 instrument MODs, as noted above, are somewhat older than 31
  932. instrument MODs and are not (at least not by me) seen very often
  933. anymore.  Their format is identical to that of 31 instrument MODs
  934. except:
  935.  
  936. (1) Since there are only 15 samples, the information for the last (15th)
  937.     sample starts at byte 440 and goes through byte 469.
  938. (2) The songlength is at byte 470 (contrast with byte 950 in 31 instrument
  939.     MOD)
  940. (3) Byte 471 appears to be ignored, but has been observed to be 127.
  941.     (Sorry, this is from observation only)
  942. (4) Byte 472 begins the pattern sequence table (contrast with byte 952
  943.     in a 31 instrument MOD)
  944. (5) Patterns start at byte 600 (contrast with byte 1084 in 31 instrument MOD)
  945.  
  946. "ProTracker," an Amiga MOD file creator/editor, is available for ftp
  947. everywhere as pt??.lzh.
  948.  
  949. From: Apollo Wong <apollo@ee.ualberta.ca>
  950.  
  951. From: M.J.H.Cox@bradford.ac.uk (Mark Cox)
  952. Newsgroups: alt.sb.programmer
  953. Subject: Re: Format for MOD files...
  954. Message-ID: <1992Mar18.103608.4061@bradford.ac.uk>
  955. Date: 18 Mar 92 10:36:08 GMT
  956. Organization: University of Bradford, UK
  957.  
  958. wdc50@DUTS.ccc.amdahl.com (Winthrop D Chan) writes:
  959. >I'd like to know if anyone has a reference document on the format of the
  960. >Amiga Sound/NoiseTracker (MOD) files. The author of Modplay said he was going
  961. >to release such a document sometime last year, but he never did. If anyone
  962.  
  963. I found this one, which covers it better than I can explain it - if you
  964. use this in conjunction with the documentation that comes with Norman
  965. Lin's Modedit program it should pretty much cover it.
  966.  
  967. Mark J Cox
  968.  
  969. /***********************************************************************
  970.  
  971. Protracker 1.1B Song/Module Format:
  972. -----------------------------------
  973.  
  974. Offset  Bytes  Description
  975. ------  -----  -----------
  976.    0     20    Songname. Remember to put trailing null bytes at the end...
  977.  
  978. Information for sample 1-31:
  979.  
  980. Offset  Bytes  Description
  981. ------  -----  -----------
  982.   20     22    Samplename for sample 1. Pad with null bytes.
  983.   42      2    Samplelength for sample 1. Stored as number of words.
  984.                Multiply by two to get real sample length in bytes.
  985.   44      1    Lower four bits are the finetune value, stored as a signed
  986.                four bit number. The upper four bits are not used, and
  987.                should be set to zero.
  988.                Value:  Finetune:
  989.                  0        0
  990.                  1       +1
  991.                  2       +2
  992.                  3       +3
  993.                  4       +4
  994.                  5       +5
  995.                  6       +6
  996.                  7       +7
  997.                  8       -8
  998.                  9       -7
  999.                  A       -6
  1000.                  B       -5
  1001.                  C       -4
  1002.                  D       -3
  1003.                  E       -2
  1004.                  F       -1
  1005.  
  1006.   45      1    Volume for sample 1. Range is $00-$40, or 0-64 decimal.
  1007.   46      2    Repeat point for sample 1. Stored as number of words offset
  1008.                from start of sample. Multiply by two to get offset in bytes.
  1009.   48      2    Repeat Length for sample 1. Stored as number of words in
  1010.                loop. Multiply by two to get replen in bytes.
  1011.  
  1012. Information for the next 30 samples starts here. It's just like the info for
  1013. sample 1.
  1014.  
  1015. Offset  Bytes  Description
  1016. ------  -----  -----------
  1017.   50     30    Sample 2...
  1018.   80     30    Sample 3...
  1019.    .
  1020.    .
  1021.    .
  1022.  890     30    Sample 30...
  1023.  920     30    Sample 31...
  1024.  
  1025. Offset  Bytes  Description
  1026. ------  -----  -----------
  1027.  950      1    Songlength. Range is 1-128.
  1028.  951      1    Well... this little byte here is set to 127, so that old
  1029.                trackers will search through all patterns when loading.
  1030.                Noisetracker uses this byte for restart, but we don't.
  1031.  952    128    Song positions 0-127. Each hold a number from 0-63 that
  1032.                tells the tracker what pattern to play at that position.
  1033. 1080      4    The four letters "M.K." - This is something Mahoney & Kaktus
  1034.                inserted when they increased the number of samples from
  1035.                15 to 31. If it's not there, the module/song uses 15 samples
  1036.                or the text has been removed to make the module harder to
  1037.                rip. Startrekker puts "FLT4" or "FLT8" there instead.
  1038.  
  1039. Offset  Bytes  Description
  1040. ------  -----  -----------
  1041. 1084    1024   Data for pattern 00.
  1042.    .
  1043.    .
  1044.    .
  1045. xxxx  Number of patterns stored is equal to the highest patternnumber
  1046.       in the song position table (at offset 952-1079).
  1047.  
  1048. Each note is stored as 4 bytes, and all four notes at each position in
  1049. the pattern are stored after each other.
  1050.  
  1051. 00 -  chan1  chan2  chan3  chan4
  1052. 01 -  chan1  chan2  chan3  chan4
  1053. 02 -  chan1  chan2  chan3  chan4
  1054. etc.
  1055.  
  1056. Info for each note:
  1057.  
  1058.  _____byte 1_____   byte2_    _____byte 3_____   byte4_
  1059. /                \ /      \  /                \ /      \
  1060. 0000          0000-00000000  0000          0000-00000000
  1061.  
  1062. Upper four    12 bits for    Lower four    Effect command.
  1063. bits of sam-  note period.   bits of sam-
  1064. ple number.                  ple number.
  1065.  
  1066. Periodtable for Tuning 0, Normal
  1067.   C-1 to B-1 : 856,808,762,720,678,640,604,570,538,508,480,453
  1068.   C-2 to B-2 : 428,404,381,360,339,320,302,285,269,254,240,226
  1069.   C-3 to B-3 : 214,202,190,180,170,160,151,143,135,127,120,113
  1070.  
  1071. To determine what note to show, scan through the table until you find
  1072. the same period as the one stored in byte 1-2. Use the index to look
  1073. up in a notenames table.
  1074.  
  1075. This is the data stored in a normal song. A packed song starts with the
  1076. four letters "PACK", but i don't know how the song is packed: You can
  1077. get the source code for the cruncher/decruncher from us if you need it,
  1078. but I don't understand it; I've just ripped it from another tracker...
  1079.  
  1080. In a module, all the samples are stored right after the patterndata.
  1081. To determine where a sample starts and stops, you use the sampleinfo
  1082. structures in the beginning of the file (from offset 20). Take a look
  1083. at the mt_init routine in the playroutine, and you'll see just how it
  1084. is done.
  1085.  
  1086. Lars "ZAP" Hamre/Amiga Freelancers
  1087.  
  1088. ***********************************************************************/
  1089.  
  1090. -- 
  1091. Mark J Cox -----
  1092. Bradford, UK ---
  1093.  
  1094. -----------------------------------------------------------------------
  1095.  
  1096.  
  1097.