home *** CD-ROM | disk | FTP | other *** search
/ Internet MPEG Audio Archive / IMAA.mdf / FAQ / AUDIO.FAQ next >
Encoding:
Text File  |  1995-01-18  |  112.4 KB  |  2,680 lines

  1. Newsgroups: alt.binaries.sounds.misc,alt.binaries.sounds.d,comp.dsp,alt.answers,comp.answers,news.answers
  2. Path: cs.tu-berlin.de!zrz.TU-Berlin.DE!netmbx.de!Germany.EU.net!EU.net!sun4nl!cwi.nl!guido
  3. From: guido@cwi.nl (Guido van Rossum)
  4. Subject: FAQ: Audio File Formats (part 1 of 2)
  5. Message-ID: <audio-part1_775730737@charon.cwi.nl>
  6. Followup-To: alt.binaries.sounds.d,comp.dsp
  7. Sender: news@cwi.nl (The Daily Dross)
  8. Supersedes: <audio-part1_767261825@charon.cwi.nl>
  9. Nntp-Posting-Host: voorn.cwi.nl
  10. Reply-To: guido@cwi.nl
  11. Organization: CWI, Amsterdam
  12. Date: Mon, 1 Aug 1994 08:45:41 GMT
  13. Approved: news-answers-request@MIT.Edu
  14. Expires: Mon, 29 Aug 1994 08:45:37 GMT
  15. Lines: 1122
  16. Xref: cs.tu-berlin.de alt.binaries.sounds.misc:26343 alt.binaries.sounds.d:6192 comp.dsp:12305 alt.answers:3794 comp.answers:6566 news.answers:26138
  17.  
  18. Archive-name: audio-fmts/part1
  19. Submitted-by: Guido van Rossum <guido@cwi.nl>
  20. Version: 3.09
  21. Last-modified: 1-Aug-1994
  22.  
  23. FAQ: Audio File Formats
  24. =======================
  25.  
  26. Table of contents
  27. -----------------
  28.  
  29. Introduction
  30. Device characteristics
  31. Popular sampling rates
  32. Compression schemes
  33. Current hardware
  34. File formats
  35. File conversions
  36. Playing audio files on UNIX
  37. Playing audio files on micros
  38. The Sound Site Newsletter
  39. Posting sounds
  40.  
  41. Appendices (in part 2):
  42.  
  43. FTP access for non-internet sites
  44. AIFF Format (Audio IFF)
  45. The NeXT/Sun audio file format
  46. IFF/8SVX Format
  47. Playing sound on a PC
  48. The EA-IFF-85 documentation
  49. US Federal Standard 1016 availability
  50. Creative Voice (VOC) file format
  51. RIFF WAVE (.WAV) file format
  52. U-LAW and A-LAW definitions
  53. AVR File Format
  54. The Amiga MOD Format
  55.  
  56.  
  57. Introduction
  58. ------------
  59.  
  60. This is version 3 of this FAQ, which I started in November 1991 under
  61. the name "The audio formats guide".  I bumped the major version number
  62. again at the occasion of the split in two parts: part one is the main
  63. text and part two consists of the collection of appendices.
  64.  
  65. I am posting this about once a fortnight, either unchanged (just to
  66. inform new readers), or updated (if I learn more or when new hardware
  67. or software becomes popular).  I post to alt.binaries.sounds.{misc,d}
  68. and to comp.dsp, for maximal coverage of people interested in audio,
  69. and to {news,comp}.answers, for easy reference.
  70.  
  71. The entire FAQ is also available by anonymous ftp from ftp.cwi.nl,
  72. directory pub/audio, files AudioFormats.{part1,part2}.
  73.  
  74. BTW: All FAQs, including this one, are available for anonymous ftp on
  75. the archive site rtfm.mit.edu in directory /pub/usenet/news.answers/.
  76. The name under which a FAQ is archived appears in the "Archive-Name:"
  77. line at the top of the article.  This FAQ is archived as
  78. audio-fmts/part[12].
  79.  
  80. A companion posting with subject "Changes to: ..." is occasionally
  81. posted listing the diffs between a new version and the last.  This is
  82. not reposted, and it is suppressed when the diffs are bigger than the
  83. new version.
  84.  
  85. Send updates, comments and questions to <guido@cwi.nl>.  I'd like to
  86. thank everyone who sent updates in the past.
  87.  
  88. --Guido van Rossum, CWI, Amsterdam <guido@cwi.nl>
  89.  
  90.  
  91. Device characteristics
  92. ----------------------
  93.  
  94. In this text, I will only use the term "sample" to refer to a single
  95. output value from an A/D converter, i.e., a small integer number
  96. (usually 8 or 16 bits).
  97.  
  98. Audio data is characterized by the following parameters, which
  99. correspond to settings of the A/D converter when the data was
  100. recorded.  Naturally, the same settings must be used to play the data.
  101.  
  102. - sampling rate (in samples per second), e.g. 8000 or 44100
  103.  
  104. - number of bits per sample, e.g. 8 or 16
  105.  
  106. - number of channels (1 for mono, 2 for stereo, etc.)
  107.  
  108. Approximate sampling rates are often quoted in Hz or kHz ([kilo-]
  109. Hertz), however, the politically correct term is samples per second
  110. (samples/sec).  Sampling rates are always measured per channel, so for
  111. stereo data recorded at 8000 samples/sec, there are actually 16000
  112. samples in a second.  I will sometimes write 8 k as a shorthand for
  113. 8000 samples/sec.
  114.  
  115. Multi-channel samples are generally interleaved on a frame-by-frame
  116. basis: if there are N channels, the data is a sequence of frames,
  117. where each frame contains N samples, one from each channel.  (Thus,
  118. the sampling rate is really the number of *frames* per second.)  For
  119. stereo, the left channel usually comes first.
  120.  
  121. The specification of the number of bits for U-LAW (pronounced mu-law
  122. -- the u really stands for the Greek letter mu) samples is somewhat
  123. problematic.  These samples are logarithmically encoded in 8 bits,
  124. like a tiny floating point number; however, their dynamic range is
  125. that of 12 bit linear data.  Source for converting to/from U-LAW
  126. (written by Jef Poskanzer) is distributed as part of the SOX package
  127. mentioned below; it can easily be ripped apart to serve in other
  128. applications.  The official definition is the CCITT standard G.711.
  129.  
  130. There exists another encoding similar to U-LAW, called A-LAW, which
  131. is used as a European telephony standard.  There is less support for
  132. it in UNIX workstations.
  133.  
  134. (See the Appendix for some formulae describing U-LAW and A-LAW.)
  135.  
  136.  
  137. Popular sampling rates
  138. ----------------------
  139.  
  140. Some sampling rates are more popular than others, for various reasons.
  141. Some recording hardware is restricted to (approximations of) some of
  142. these rates, some playback hardware has direct support for some.  The
  143. popularity of divisors of common rates can be explained by the
  144. simplicity of clock frequency dividing circuits :-).
  145.  
  146. Samples/sec     Description
  147.  
  148. 5500            One fourth of the Mac sampling rate (rarely seen).
  149.  
  150. 7333            One third of the Mac sampling rate (rarely seen).
  151.  
  152. 8000            Exactly 8000 samples/sec is a telephony standard that
  153.                 goes together with U-LAW (and also A-LAW) encoding.
  154.                 Some systems use an slightly different rate; in
  155.                 particular, the NeXT workstation uses 8012.8210513,
  156.                 apparently the rate used by Telco CODECs.
  157.  
  158. 11 k            Either 11025, a quarter of the CD sampling rate,
  159.                 or half the Mac sampling rate (perhaps the most
  160.                 popular rate on the Mac).
  161.  
  162. 16000           Used by, e.g. the G.722 compression standard.
  163.  
  164. 18.9 k          CD-ROM/XA standard.
  165.  
  166. 22 k            Either 22050, half the CD sampling rate, or the Mac
  167.                 rate; the latter is precisely 22254.545454545454 but
  168.                 usually misquoted as 22000.  (Historical note:
  169.                 22254.5454... was the horizontal scan rate of the
  170.                 original 128k Mac.)
  171.  
  172. 32000           Used in digital radio, NICAM (Nearly Instantaneous
  173.                 Compandable Audio Matrix [IBA/BREMA/BBC]) and other
  174.                 TV work, at least in the UK; also long play DAT and
  175.                 Japanese HDTV.
  176.  
  177. 37.8 k          CD-ROM/XA standard for higher quality.
  178.  
  179. 44056           This weird rate is used by professional audio
  180.                 equipment to fit an integral number of samples in a
  181.                 video frame.
  182.  
  183. 44100           The CD sampling rate.  (DAT players recording
  184.                 digitally from CD also use this rate.)
  185.  
  186. 48000           The DAT (Digital Audio Tape) sampling rate for
  187.                 domestic use.
  188.  
  189. Files samples on SoundBlaster hardware have sampling rates that are
  190. divisors of 1000000.
  191.  
  192. While professinal musicians disagree, most people don't have a problem
  193. if recorded sound is played at a slightly different rate, say, 1-2%.
  194. On the other hand, if recorded data is being fed into a playback
  195. device in real time (say, over a network), even the smallest
  196. difference in sampling rate can frustrate the buffering scheme used...
  197.  
  198. There may be an emerging tendency to standardize on only a few
  199. sampling rates and encoding styles, even if the file formats may
  200. differ.  The suggested rates and styles are:
  201.  
  202.     rate (samp/sec) style mono/stereo
  203.  
  204.     8000 8-bit U-LAW mono
  205.     22050 8-bit linear unsigned mono and stereo
  206.     44100 16-bit linear signed mono and stereo
  207.  
  208.  
  209. Compression schemes
  210. -------------------
  211.  
  212. Strange though it seems, audio data is remarkably hard to compress
  213. effectively.  For 8-bit data, a Huffman encoding of the deltas between
  214. successive samples is relatively successful.  For 16-bit data,
  215. companies like Sony and Philips have spent millions to develop
  216. proprietary schemes.  Information about PASC (Philips' scheme) can be
  217. found in Advanced Digital Audio by Ken C. Pohlmann.
  218.  
  219. Public standards for voice compression are slowly gaining popularity,
  220. e.g. CCITT G.721 (ADPCM at 32 kbits/sec) and G.723 (ADPCM at 24 and 40
  221. kbits/sec).  (ADPCM == Adaptive Delta Pulse Code Modulation.)  Sun
  222. Microsoft has placed the source code of a portable implementation of
  223. these algorithms (as well as G.711, which defines A-LAW and U-LAW) in
  224. the public domain (needless to say, their proprietary implementation
  225. distributed in binary form with Solaris is better :-).  One place to
  226. ftp this source code from is ftp.cwi.nl:/pub/audio/ccitt-adpcm.tar.Z.
  227. Source for another 32 kbits/sec ADPCM implementation, assumed to be
  228. compatible with Intel's DVI audio format, can be ftp'ed from
  229. ftp.cwi.nl:/pub/audio/adpcm.shar.  (** NOTE: if you are using v1.0,
  230. you should get v1.1, released 17-Dec-1992, which fixes a serious bug
  231. -- the quality of v1.1 is claimed to be better than U-LAW **)
  232.  
  233. GSM 06.10 is a speech encoding in use in Europe that compresses 160
  234. 13-bit samples into 260 bits (or 33 bytes), i.e. 1650 bytes/sec (at
  235. 8000 samples/sec).  A free implementation can be ftp'ed from
  236. tub.cs.tu-berlin.de, file /pub/tubmik/gsm-1.0.tar.Z.
  237.  
  238. There are also two US federal standards, 1016 (Code excited linear
  239. prediction (CELP), 4800 bits/s) and 1015 (LPC-10E, 2400 bits/s).  See
  240. also the appendix for 1016.
  241.  
  242. Tony Robinson <ajr@eng.cam.ac.uk> has written a good FAST loss-less
  243. compression for lots of different audio formats (particularly good for
  244. WAV and MOD files).  The software is available by anonymous ftp from
  245. svr-ftp.eng.cam.ac.uk, directory misc, file shorten-1.08.tar.Z.
  246.  
  247. (Note that U-LAW and silence detection can also be considered
  248. compression schemes.)
  249.  
  250. Here's a note about audio codings by Van Jacobson <van@ee.lbl.gov>:
  251. Several people used the words "LPC" and "CELP" interchangably.  They
  252. are very different.  An LPC (Linear Predictive Coding) coder fits
  253. speech to a simple, analytic model of the vocal tract, then throws
  254. away the speech & ships the parameters of the best-fit model.  An LPC
  255. decoder uses those parameters to generate synthetic speech that is
  256. usually more-or-less similar to the original.  The result is
  257. intelligible but sounds like a machine is talking.  A CELP (Code
  258. Excited Linear Predictor) coder does the same LPC modeling but then
  259. computes the errors between the original speech & the synthetic model
  260. and transmits both model parameters and a very compressed
  261. representation of the errors (the compressed representation is an
  262. index into a 'code book' shared between coders & decoders -- this is
  263. why it's called "Code Excited").  A CELP coder does much more work
  264. than an LPC coder (usually about an order of magnitude more) but the
  265. result is much higher quality speech: The FIPS-1016 CELP we're working
  266. on is essentially the same quality as the 32Kb/s ADPCM coder but uses
  267. only 4.8Kb/s (the same as the LPC coder).
  268.  
  269. The comp.compression FAQ has some text on the 6:1 audio compression
  270. scheme used by MPEG (a video compression standard-to-be).  It's
  271. interesting to note that video compression reaches much higher ratios
  272. (like 26:1).  This FAQ is ftp'able from rtfm.mit.edu in directory
  273. /pub/usenet/news.answers/compression-faq, files part1 and part2.
  274.  
  275. Comp.compression also carries a regular posting "How to uncompress
  276. anything" by David Lemson <lemson@uiuc.edu>, which (tersely) hints on
  277. which program you need to uncompress a file whose name ends in .<foo>
  278. for almost any conceivable <foo>.  Ftp'able from ftp.cso.uiuc.edu
  279. in the directory /doc/pcnet as the file compression.
  280.  
  281. Documentation on a digital cellular telephone system by Qualcomm Inc.
  282. can be ftp'ed from ftp.qualcomm.com:/pub/cdma; the vocoder is in
  283. appendix A.
  284.  
  285. Apple has an Audio Compression/Expansion scheme called ACE (on the GS)
  286. / MACE (on the Macintosh).  It's a lossy scheme that attempts to
  287. predict where the wave will go on the next sample. There's very little
  288. quality change on 8:4 compression, somewhat more for 8:3.  It does
  289. guarantee exactly 50% or 62.5% compression, though.  I believe MACE
  290. uses larger ratios/more loss, but I'm unsure of the specific numbers.
  291. (Marc Sira)
  292.  
  293.  
  294. Current hardware
  295. ----------------
  296.  
  297. I am aware of the following computer systems that can play back and
  298. (sometimes) record audio data, with their characteristics.  Note that
  299. for most systems you can also buy "professional" sampling hardware,
  300. which supports much better quality, e.g. >= 44.1 k 16 bits stereo.
  301. The characteristics listed here are a rough estimate of the
  302. capabilities of the basic hardware only (and even here I am on thin
  303. ice, with systems becoming ever more powerful).
  304.  
  305. machine             bits            max sampling rate    #output channels
  306.  
  307. Mac (all types)     8               22k                  1
  308. Mac (newer ones)    16              64k                  4(128)
  309. Apple IIgs          8               32k / >70k           16(st)
  310. PC/soundblaster pro 8               ?/(22k st, 44.1k mo) 1(st)
  311. PC/soundblaster 16  16              44.1k                1(st)
  312. PC/pas              8               44.1k st, 88.2k mo   1(st)
  313. PC/pas-16           16              44.1k st, 88.2k mo   1(st)
  314. PC/turtle beach multisound 16       44.1k                1(st)
  315. PC/cards with aria chipset 16       44.1k                1(st)
  316. PC/roland rap-10    16              44.1k                1(st)
  317. PC/gravis ultrasound 8/16           44.1k                14-32(st)
  318. Atari ST            8               22k                  1
  319. Atari STE,TT        8               50k                  2
  320. Atari Falcon 030    16              50k                  8(st)
  321. Amiga               8               varies above 29k     4(st)
  322. Sun Sparc           U-LAW           8k                   1
  323. Sun Sparcst. 10     U-LAW,8,16      48k                  1(st)
  324. NeXT                U-LAW,8,16      44.1k                1(st)
  325. SGI Indigo          8,16            48k                  4(st)
  326. SGI Indigo2,Indy    8,16            48k                  16(st,4-channel)
  327. Acorn Archimedes    ~U-LAW          ~180k                8(st)
  328. Sony NWS-3xxx       U,A,8,16        8-37.8k              1(st)
  329. Sony NWS-5xxx       U,A,8,16        8-48k                1(st)
  330. VAXstation 4000     U-LAW           8k                   1
  331. DEC 3000            U-LAW           8k                   1
  332. DEC 5000/20-25      U-LAW           8k                   1
  333. Tandy 1000/*L*      8               >=44k                1
  334. Tandy 2500          8               >=44k                1
  335. HP9000/705,710,425e U,A-LAW,16      8k                   1
  336. HP9000/715,725,735  U,A-LAW,16      48k                  1(st)
  337. HP9000/755 option:  U,A-LAW,16      48k                  1(st)
  338. NCD MCX terminal    U,A,8,16        52k                  1(st)
  339.  
  340. 4(st) means "four voices, stereo"; sampling rates xx/yy are
  341. different recording/playback rates; *L* is any type with 'L' in it.
  342.  
  343. All these machines can play back sound without additional hardware,
  344. although the needed software is not always standard; also, some
  345. machines need external hardware to record sound (or to record at
  346. higher quality, like the NeXT, whose built-in sampling hardware only
  347. does 8000 samples/sec in U-LAW).  Please don't send me details on
  348. optional or 3rd party hardware, there is too much and it is really
  349. beyond the scope of this FAQ.  In particular, there is a separate
  350. newsgroup devoted to PC sound cards: comp.sys.ibm.pc.soundcard, which
  351. includes FAQ of its own (also posted to comp.answers and news.answers).
  352.  
  353. The new VAXstation 4000 (VLC and model 60) series lets you PLAY audio
  354. (.au) files, and the package DECsound will let you do the recording.
  355. In fact, DECsound is given away free with Motif 1.1 and supports the
  356. VAXstation, Sun SPARCstation, DECvoice, and DECaudio devices.  Sun
  357. sound files work without change.  The Alpha systems also have DECsound
  358. bundled with Motif.  Also, the DEC2000/300 (aka DECpc AXP 150) can use
  359. a Microsoft Sound Card, with AudioFile (see below) for sound.
  360.  
  361. Notes for the DECstation 5000/20-25: You need either XMedia tools from
  362. DEC ($$$$), or the AudioFile package (which works nicely) from
  363. crl.dec.com (see below). The audio device is "/dev/bba", you cannot
  364. send ".au" files directly to the device, the Xmedia/AF software
  365. provide an "audioserver" which must be run to play/record sounds.
  366.  
  367. The SGI Personal IRIS 4D/30 and 4D/35 have the same capabilities as
  368. the Indigo. The audio board was optional on the 4D/30.
  369. The Indigo2 and Indy features are a superset of the Indigo features.
  370.  
  371. The new Apple Macs have more powerful audio hardware; the latest
  372. models have built-in microphones.
  373.  
  374. Software exists for the PC that can play sound on its 1-bit speaker
  375. using pulse width modulation (see appendix); the Soundblaster board
  376. records at rates up to 13 k and plays back up to 22 k (weird
  377. combination, but that's the way it is).
  378.  
  379. Here's some info about the newest Atari machine, the Falcon030.  This
  380. machine has stereo 16 bit CODECs and a 32 MHz Motorola 56001 that can
  381. handle 8 channels of 16 bit audio, up to 50 khz/channel with
  382. simultaneous playback and record.  The Falcon DMA sound engine is also
  383. compatible with the 8 bit stereo DMA used on the STe and TT. All of
  384. these systems use signed data.
  385.  
  386. On the NeXT, the Motorola 56001 DSP chip is programmable and you can
  387. (in principle) do what you want.  The SGI Indigo uses the same DSP chip but
  388. it can't be programmed by users -- SGI prefers to offer it as a shared
  389. system resource to multiple applications, thus enabling developers to
  390. program audio with their Audio Library and avoid code modifications
  391. for execution on future machines with different audio hardware, i.e. a
  392. different DSP. For example, the Indigo2 and Indy do not have a DSP chip.
  393.  
  394. The Amiga also has a 6-bit volume, which can be used to produce
  395. something like a 14-bit output for each voice.  The hardware can also
  396. use one of each voice-pair to modulate the other in FM (period) or AM
  397. (volume, 6-bits).
  398.  
  399. The Acorn Archimedes uses a variation on U-LAW with the bit order
  400. reversed and the sign bit in bit 0.  Being a 'minority' architecture,
  401. Arc owners are quite adept at converting sound/image formats from
  402. other machines, and it is unlikely that you'll ever encounter sound in
  403. one of the Arc's own formats (there are several).
  404.  
  405. Tandy notes (Jeffrey L. Hayes <tvdog@delphi.com>): The maximum
  406. sampling rate for output is at least 44k.  (I don't know the maximum
  407. rates; I have recorded at 22k and played at 44k.  Higher rates are
  408. probably possible.)  There is one output channel, not three.  The
  409. belief that there are 3 channels probably stems from the fact that
  410. Music.pdm, bundled with these machines, can create 3- channel music
  411. modules (analogous to Amiga .mod's).  Music.pdm probably does that
  412. because it is designed to work with the Tandy's 3-voice tone generator
  413. circuitry (compatible with the Texas Instruments SN76496 in the IBM
  414. PC-Jr) if there is insufficient RAM to load sound samples.  The Tandy
  415. chip is able to record at lower rates than it is able to play back, as
  416. is the Soundblaster (i.e., the divider used to program the chip to
  417. record is lower than that used to program the chip to play back).  The
  418. Tandy DAC can go faster than the original Soundblaster, however.
  419.  
  420. The NCD MCX terminal has audio integrated with its X server.  The
  421. NCDAudio server is an extension of the X server, working together with
  422. it, with stress on the networking capability of sound transmission.
  423. The NCDAudio API provides format handling (ULAW8, Linear Unsig 8,
  424. Linear Sig 8, Linear Sig 16 MSB, Linear Unsig 16 MSB), flowing (to the
  425. server, from the server, to the i/o, from the i/o), wave form
  426. generators (Square, Sine, Saw, Constant) and the capability of area
  427. broadcast using UDP.  Provision for manipulating data files
  428. (SND, WAV, VOC & AU) is also provided.
  429.  
  430. CD-I machines form a special category.  The following formats are used:
  431.  
  432.      - PCM 44.1 kHz standard CD format
  433.      - ADPCM - Addaptive Delta PCM
  434.        - Level A 37.8 kHz 8-bit
  435.        - Level B 37.8 kHz 4-bit
  436.        - Level C 18.9 kHz 4-bit
  437.  
  438.  
  439. File formats
  440. ------------
  441.  
  442. Historically, almost every type of machine used its own file format
  443. for audio data, but some file formats are more generally applicable,
  444. and in general it is possible to define conversions between almost any
  445. pair of file formats -- sometimes losing information, however.
  446.  
  447. File formats are a separate issue from device characteristics.  There
  448. are two types of file formats: self-describing formats, where the
  449. device parameters and encoding are made explicit in some form of
  450. header, and "raw" formats, where the device parameters and encoding
  451. are fixed.
  452.  
  453. Self-describing file formats generally define a family of data
  454. encodings, where a header fields indicates the particular encoding
  455. variant used.  Headerless formats define a single encoding and usually
  456. allows no variation in device parameters (except sometimes sampling
  457. rate, which can be a pain to figure out other than by listening to the
  458. sample).
  459.  
  460. The header of self-describing formats contains the parameters of the
  461. sampling device and sometimes other information (e.g. a
  462. human-readable description of the sound, or a copyright notice).  Most
  463. headers begin with a simple "magic word".  (Some formats do not simply
  464. define a header format, but may contain chunks of data intermingled
  465. with chunks of encoding info.)  The data encoding defines how the
  466. actual samples are stored in the file, e.g. signed or unsigned, as
  467. bytes or short integers, in little-endian or big-endian byte order,
  468. etc.  Strictly spoken, channel interleaving is also part of the
  469. encoding, although so far I have seen little variation in this area.
  470.  
  471. Some file formats apply some kind of compression to the data, e.g.
  472. Huffman encoding, or simple silence deletion.
  473.  
  474. Here's an overview of popular file formats.
  475.  
  476.         Self-describing file formats
  477.         ----------------------------
  478.  
  479. extension, name   origin          variable parameters (fixed; comments)
  480.  
  481. .au or .snd       NeXT, Sun       rate, #channels, encoding, info string
  482. .aif(f), AIFF     Apple, SGI      rate, #channels, sample width, lots of info
  483. .aif(f), AIFC     Apple, SGI      same (extension of AIFF with compression)
  484. .iff, IFF/8SVX    Amiga           rate, #channels, instrument info (8 bits)
  485. .voc              Soundblaster    rate (8 bits/1 ch; can use silence deletion)
  486. .wav, WAVE        Microsoft       rate, #channels, sample width, lots of info
  487. .sf               IRCAM           rate, #channels, encoding, info
  488. none, HCOM        Mac             rate (8 bits/1 ch; uses Huffman compression)
  489. none, MIME        Internet        (see below)
  490. none, NIST SPHERE DARPA speech community (see below)
  491. .mod or .nst      Amiga           (see below)
  492.  
  493. Note that the filename extension ".snd" is ambiguous: it can be either
  494. the self-describing NeXT format or the headerless Mac/PC format, or
  495. even a headerless Amiga format.
  496.  
  497. I know nothing for sure about the origin of HCOM files, only that
  498. there are a lot of them floating around on our system and probably at
  499. FTP sites over the world.  The filenames usually don't have a ".hcom"
  500. extension, but this is what SOX (see below) uses.  The file format
  501. recognized by SOX includes a MacBinary header, where the file
  502. type field is "FSSD".  The data fork begins with the magic word "HCOM"
  503. and contains Huffman compressed data; after decompression it it is 8
  504. bits unsigned data.
  505.  
  506. IFF/8SVX allows for amplitude contours for sounds (attack/decay/etc).
  507. Compression is optional (and extensible); volume is variable; author,
  508. notes and copyright properties; etc.
  509.  
  510. AIFF, AIFC and WAVE are similar in spirit but allow more freedom in
  511. encoding style (other than 8 bit/sample), amongst others.
  512.  
  513. There are other sound formats in use on Amiga by digitizers and music
  514. programs, such as IFF/SMUS.
  515.  
  516. Appendices describes the NeXT and VOC formats; pointers to more info
  517. about AIFF, AIFC, 8SVX and WAVE (which are too complex to describe
  518. here) are also in appendices.
  519.  
  520. DEC systems (e.g. DECstation 5000) use a variant of the NeXT format
  521. that uses little-endian encoding and has a different magic number
  522. (0x0064732E in little-endian encoding).
  523.  
  524. Standard file formats used in the CD-I world are IFF but on the disc
  525. they're in realtime files.
  526.  
  527. An interesting "interchange format" for audio data is described in the
  528. proposed Internet Standard "MIME", which describes a family of
  529. transport encodings and structuring devices for electronic mail.  This
  530. is an extensible format, and initially standardizes a type of audio
  531. data dubbed "audio/basic", which is 8-bit U-LAW data sampled at 8000
  532. samples/sec.
  533.  
  534. The "IRCAM" sound file system has now been superseded by the so-called
  535. "BICSF" (for Berkeley/IRCAM/CARL Sound File system) software release.
  536. More recently, there has been an effort at Princeton (Prof. Paul
  537. Lansky) and Stanford (Stephen Travis Pope) to standardize several
  538. extensions to BICSF.  A description of BICSF and the
  539. Princeton/Stanford extensions is available by anonymous ftp from
  540. ftp.cwi.nl, in directory /pub/audio/BICSF-info.  This file contains
  541. further ftp pointers to software.
  542.  
  543. A sound file format popular in the DARPA speech community is the NIST
  544. SPHERE standard.  The most recent version of the SPHERE package is
  545. available via anonymous ftp from jaguar.ncsl.nist.gov in compressed
  546. tar form as "sphere-v.tar.Z" (where "v" is the version code).  The
  547. NIST SPHERE header is an object-oriented, 1024-byte blocked, ASCII
  548. structure which is prepended to the waveform data.  The header is
  549. composed of a fixed-format portion followed by an object-oriented
  550. variable portion.  I have placed a short description of NIST SPHERE on
  551. ftp.cwi.nl:/pub/audio/NIST-SPHERE.
  552.  
  553. Finally, a somewhat different but popular format are "MOD" files,
  554. usually with extension ".mod" or ".nst" (they can also have a prefix
  555. of "mod.").  This originated at the Amiga but players now exist for
  556. many platforms.  MOD files are music files containing 2 parts: (1) a
  557. bank of digitized samples; (2) sequencing information describing how
  558. and when to play the samples.  See the appendix "The Amiga MOD Format"
  559. for a description of this file format (and pointers to ftp'able
  560. players and example MOD files).
  561.  
  562.         Headerless file formats
  563.         -----------------------
  564.  
  565. extension       origin          parameters
  566. or name
  567.  
  568. .snd, .fssd     Mac, PC         variable rate, 1 channel, 8 bits unsigned
  569. .ul             US telephony    8 k, 1 channel, 8 bit "U-LAW" encoding
  570. .snd?           Amiga           variable rate, 1 channel, 8 bits signed
  571.  
  572. It is usually easy to distinguish 8-bit signed formats from unsigned
  573. by looking at the beginning of the data with 'od -b <file | head';
  574. since most sounds start with a little bit of silence containing small
  575. amounts of background noise, the signed formats will have an abundance
  576. of bytes with values 0376, 0377, 0, 1, 2, while the unsigned formats
  577. will have 0176, 0177, 0200, 0201, 0202 instead.  (Using "od -c" will
  578. also show any headers that are tacked in front of the file.)
  579.  
  580. The Apple IIgs records raw data in the same format as the Mac, but
  581. uses a 0 byte as a terminator; samples with value 0 are replaced by 1.
  582.  
  583.         Sound formats and the Apple Macintosh
  584.         -------------------------------------
  585.  
  586. (Thanks to Bill Houle, <Bill.Houle@SanDiegoCA.NCR.COM>)
  587.  
  588.                              SOX/DOS   MAC
  589. Sound Format           file ext  type  Mac program to convert to 'snd'
  590. ---------------------- --------  ----  -------------------------------
  591. Mac snd                .snd      sfil  [n/a]
  592. Amiga IFF/8SVX         .iff            AmigaSndConverter, BST
  593. Amiga SoundTracker     .mod      STrk  ModVoicer
  594. Audio IFF              .aiff     AIFF  SoundExtractor, Sample Editor,
  595.                                        UUTool, BST, M5Mac
  596. DSP Designer                     DSPs  SoundHack
  597. IRCAM                  .sf       IRCM  SoundHack
  598. MacMix                           MSND  SoundHack
  599. RIFF WAVE              .wav            SoundExtractor, BST, Balthazar
  600. SoundBlaster           .voc            SoundExtractor, BST
  601. SoundDesigner/AudioMedia         Sd2f  SoundHack
  602. Sound[Edit|Cap|Wave]   .hcom     FSSD  SoundExtractor, SoundEdit,
  603.                                        Wavicle, BST
  604. Sun uLaw/Next .snd     .au/.snd  NxTS  SoundExtractor, SoundHack,
  605.                                        au<->snd, UUTool, BST
  606.  
  607.  
  608. File conversions
  609. ----------------
  610.  
  611.         SOX (UNIX, PC, Amiga)
  612.         ---------------------
  613.  
  614. The most versatile tool for converting between various audio formats
  615. is SOX ("Sound Exchange").  It can read and write various types of
  616. audio files, and optionally applies some special effects (e.g. echo,
  617. channel averaging, or rate conversion).
  618.  
  619. SOX recognizes all filename extensions listed above except ".snd",
  620. which would be ambiguous anyway, and ".wav" (but there's a patch, see
  621. below).  Use type ".au" for NeXT ".snd" files.  Mac and PC ".snd"
  622. files are completely described by these parameters:
  623.  
  624.         -t raw -b -u -r 11000
  625.  
  626. (or -r 22000 or -r 7333 or -r 5500; 11000 seems to be the most common
  627. rate).
  628.  
  629. The source for SOX, version 6, platchlevel 8, was posted to
  630. alt.sources, and should be widely archived.  (Patch 9 was posted later
  631. and incporporates some important .wav fixes.)  To save you the trouble
  632. of hunting it down, it can be gotten by anonymous ftp from
  633. wuarchive.wustl.edu, in the directory usenet/alt.sources/articles,
  634. files 7288.Z through 7295.Z.  (These files are compressed news
  635. articles containing shar files, if you hadn't guessed.)  I am sure
  636. many sites have similar archives, I'm just listing one that I know of
  637. and which carries a lot of this kind of stuff.  (Also see the appendix
  638. if you don't have Internet access.)
  639.  
  640. A compressed tar file containing the same version of SOX is available
  641. by anonymous ftp from ftp.cwi.nl, in directory
  642. /pub/audio/sox<version>.tar.Z.  You may be able to locate a nearer
  643. version using archie!
  644.  
  645. Ports of SOX:
  646.  
  647. - The source as posted should compile on any UNIX and PC system.
  648.  
  649. - A PC version is available by ftp from ftp.cwi.nl (see above) as
  650.   pub/audio/sox5dos.zip; also available from the garbo mail server.
  651.  
  652. - The latest Amiga SOX is available via anonymous ftp to
  653.   wuarchive.wustl.edu, files systems/amiga/audio/utils/amisox*.  (See
  654.   below for a non-SOX solution.)
  655.   The final release of r6 will compile as distributed on the Amiga with
  656.   SAS/C version 6.  Binaries (since many Amiga users do not own
  657.   compilers) will continue to be available for FTP.
  658.  
  659. SOX usage hints:
  660.  
  661. - Often, the filename extension of sound files posted on the net is
  662.   wrong.  Don't give up, try a few other possibilities using the
  663.   "-t <type>" option.  Remember that the most common file type is
  664.   unsigned bytes, which can be indicated with "-t ub".  You'll have to
  665.   guess the proper sampling rate, but often it's 11k or 22k.
  666.  
  667. - In particular, with SOX version 4 (or earlier), you have to
  668.   specify "-t 8svx" for files with an .iff extension.
  669.  
  670. - When converting linear samples to U-LAW using the .au type for the
  671.   output file, you must specify "-U" for the output file, otherwise
  672.   you will end up with a file containing a NeXT/Sun header but linear
  673.   samples -- only the NeXT will play such files correctly.  Also, you
  674.   must explicitly specify an output sampling rate with "-r 8000".
  675.   (This may seem fixed for most cases in version 5, but it is still
  676.   occasionally necessary, so I'm keeping this warning in.)
  677.  
  678.         Sun Sparc
  679.         ---------
  680.  
  681. On Sun Sparcs, starting at SunOS 4.1, a program "raw2audio" is
  682. provided by Sun (in /usr/demo/SOUND -- see below) which takes a raw
  683. U-LAW file and turns it into a ".au" file by prefixing it with an
  684. appropriate header.
  685.  
  686.         NeXT
  687.         ----
  688.  
  689. On NeXTs, you can usually rename .au files to .snd and it'll work like
  690. a charm, but some .au files lack header info that the NeXT needs.
  691. This can be fixed by using sndconvert:
  692.  
  693.         sndconvert -c 1 -f 1 -s 8012.8210513 -o nextfile.snd sunfile.au
  694.  
  695.         SGI Indigo, Indigo2, Indy and Personal IRIS
  696.         -------------------------------------------
  697.  
  698. SGI supports "soundfiler" (in /usr/sbin), a program similar in
  699. spirit to SOX but with a GUI.  Soundfiler plays aiff, aifc, NeXT/Sun
  700. and .wav formats.  It can do conversions between any of these formats
  701. and to and from raw formats including mulaw.  It also does sample rate
  702. conversions.
  703.  
  704. Three shell commands are also provided that give the same functionality:
  705. "sfplay", "sfconvert", and "aifcresample" (all in /usr/sbin).
  706.  
  707.         Amiga
  708.         -----
  709.  
  710. Mike Cramer's SoundZAP can do no effects except rate change and it
  711. only does conversions to IFF, but it is generally much faster than
  712. SOX.  (Ftp'able from the same directory as amisox above.)
  713.  
  714. Newer versions of OmniPlay (see below) will also convert to IFF.
  715.  
  716.         Tandy
  717.         -----
  718.  
  719. The Tandy uses a proprietary format, which can use compression
  720. (see appendix).  Jeffrey L. Hayes <tvdog@delphi.com> writes:
  721.  
  722. There is in fact a Windows 3.1 sound driver for the Tandy 2500-series 
  723. available from Radio Shack.  My informant says:  "Say that you have a 
  724. 2500SX/33 and you lost your Windows Utilities/Drivers disk.  The cost is 
  725. $5.00."  (The driver will work on any 2500.)
  726.  
  727. Version 2.00 of Conv2snd by Kenneth Udut by Kenneth Udut is now on
  728. Simtel.  It converts any 8-bit mono unsigned PCM file to Tandy
  729. DeskMate .snd format.  The new version recognizes RIFF WAVE headers
  730. and comes with a utility to convert .snd to .wav, Snd2wav.
  731.  
  732. In addition to the .snd format used by Sound.pdm, Tandy used an .sng format 
  733. with Music.pdm for song files.  .sng files are analogous to Amiga .mod 
  734. files, but they contain only the sequencing information.  The samples are 
  735. expected to be in .snd files in the current directory for Music.pdm.  It 
  736. should be possible to convert .sng to .mod - when I get around to it!
  737.  
  738. I am collecting information and programs for the Tandy DAC chip.  I have 
  739. written a DOS .wav player for the Tandy DAC, as well as a program to make 
  740. the Tandy DAC emulate a Covox DAC for use with programs that support the 
  741. Covox or a DAC on a parallel port.  Those interested may write to me and 
  742. ask for the "Tandy DAC package" - help is needed!  The package includes 
  743. source code and programming information on the Tandy chip.  A DOS .wav 
  744. recorder and an Amiga .mod player for the Tandy DAC are in progress.  There 
  745. are two other programs (to my knowledge) to record and play back sounds on 
  746. a Tandy - Sampler and Tndsnd.  These programs are on Delphi but not on the 
  747. Internet as far as I know; users not on Delphi can write to me and ask for 
  748. them.  Those wishing to make a public announcement regarding the Tandy DAC 
  749. should post to comp.sys.tandy.
  750.  
  751. Tandy now includes Soundblaster support in its machines.  New Tandy's do 
  752. not have the proprietary Tandy DAC.
  753.  
  754.  
  755.         Apple Macintosh
  756.         ---------------
  757.  
  758. Bill Houle sent the following list:
  759.  
  760. Popular commercial apps are indicated with a [*].  All other programs
  761. mentioned are shareware/freeware available from SUMEX and the various
  762. mirror sites, or check archie for the nearest FTP location.
  763.  
  764. MAC SOUND CONVERSION PROGRAMS
  765.  
  766. SoundHack [Tom Erbe, tom@mills.edu]
  767.   Can read/write Sound Designer II, Audio IFF, IRCAM, DSP Designer and NeXT 
  768.   .snd (or Sun .au); 8-bit uLaw, 8-bit linear, 32-bit floating point and 16-bit
  769.   linear data encoding.  Can read (but not write) raw data files.  Implements
  770.   soundfile convolution, a phase vocoder, a binaural filter and an amplitude 
  771.   analysis & gain change module.
  772.  
  773. SoundExtractor [Alberto Ricci, FRicci@polito.it]
  774.   Extracts 'snd' resources, AIFF, SoundEdit, VOC, and WAV data from
  775.   practically anything, converting to 'snd' files.
  776.  
  777. Balthazar [Craig Marciniak, AOL:TemplarDev]
  778.   Converts WAV files to 'snd'.
  779.   
  780. Brian's Sound Tool [Brian Scott, bscott@ironbark.ucnv.edu.au]
  781.   Converts 'snd' or SoundEdit to WAV.  Can also convert WAV, VOC, AIFF, Amiga
  782.   8SVX and uLaw to 'snd'.
  783.  
  784. AmigaSndConverter [Povl H. Pederson, eco861771@ecostat.aau.dk]
  785.   Converts Amiga IFF/8SVX to Mac 'snd'.
  786.  
  787. au<->Mac [Victor J. Heinz, vic:wbst128@xerox.com]
  788.   Converts Sun uLaw to Mac 'snd'.
  789.   
  790. ULAW [Rod Kennedy, rod@faceng.anu.edu.au]
  791.   Converts 'snd' to Sun uLaw.
  792.  
  793. UUTool [Bernie Wieser, wieser@acs.ucalgary.ca]
  794.   Primarily a uuencode/decode program, but in true Swiss Army Knife
  795.   fashion can also read/write Sun uLaw, AIFF, and 'snd' files.
  796.  
  797. ModVoicer [Kip Walker, Kip_Walker@mcimail.com]
  798.   Converts Amiga MOD voices into SoundEdit files or 'snd' resources.
  799.  
  800. Music 5 Mac [Simone Bettini, space@maya.dei.unipd.it]
  801.   Primarily a Music Synthesis system, but can also convert between 'snd', AIFF,
  802.   and IBM .DAT(?).
  803.  
  804. See also the section on players -- some players also do conversions.
  805.  
  806.  
  807. Playing audio files on UNIX
  808. ---------------------------
  809.  
  810. The commands needed to play an audio file depend on the file format
  811. and the available hardware and software.  Most systems can only
  812. directly play sound in their native format; use a conversion program
  813. (see above) to play other formats.
  814.  
  815.         Sun Sparcstation running SunOS 4.x
  816.         ----------------------------------
  817.  
  818. Raw U-LAW files can be played using "cat file >/dev/audio".
  819.  
  820. A whole package for dealing with ".au" files is provided by Sun on an
  821. experimental basis, in /usr/demo/SOUND.  You may have to compile the
  822. programs first.  (If you can't find this directory, either you are not
  823. running SunOS 4.1 yet, or your system administrator hasn't installed
  824. it -- go ask him for it, not me!)  The program "play" in this
  825. directory recognizes all files in Sun/NeXT format, but a SS 1 or 2 can
  826. play only those using U-LAW encoding at 8 k -- the SS 10 hardware
  827. plays other encodings, too.
  828.  
  829. If you ca't find "play", you can also cat a ".au" file to /dev/audio,
  830. if it uses U-LAW; the header will sound like a short burst of noise
  831. but the rest of the data will sound OK (really, the only difference in
  832. this case between raw U-LAW and ".au" files is the header; the U-LAW
  833. data is exactly the same).
  834.  
  835. Finally, OpenWindows 3.0 has a full-fledged audio tool.  You can drop
  836. audio file icons into it, edit them, etc.
  837.  
  838.         Sun Sparcstation running Solaris 2.0
  839.         ------------------------------------
  840.  
  841. Under SVR4 (and hence Solaris 2.0), writing to /dev/audio from the
  842. shell is a bad idea, because the device driver will flush its queue as
  843. soon as the file is closed.  Use "audioplay" instead.  The supported
  844. formats and sampling rates are the same as above.
  845.  
  846.         NeXT
  847.         ----
  848.  
  849. On NeXT machines, the standard "sndplay" program can play all NeXT
  850. format files (this include Sun ".au" files).  It supports at least
  851. U-LAW at 8 k and 16 bits samples at 22 or 44.1 k.  It attempts
  852. on-the-fly conversions for other formats.
  853.  
  854. Sound files are also played if you double-click on them in the file
  855. browser.
  856.  
  857.         SGI Indigo, Indigo2, Indy and Personal IRIS
  858.         -------------------------------------------
  859.  
  860. On SGI Indigo, Indigo2, Indy and the 4D/30 and /35 Personal IRIS workstations,
  861. "WorkSpace" plays audio files in .aiff, .aifc, .au, and .wav formats if
  862. you double click them and the sampling rate is one of 8000, 11025,
  863. 16000, 22050, 32000, 44100, or 48000.  On the Personal IRIS, you need
  864. to have the audio board installed (check the output from hinv) and you
  865. must run IRIX 3.3.2 or 4.0 or higher.  These files can also be played
  866. with "soundfiler" and "sfplay".  ".aiff" and ".aifc" files at the above
  867. sampling rates can also be played with playaifc.  (All in /usr/sbin)
  868.  
  869. There is no simple /dev/audio interface on these SGI machines.  (There
  870. was one on 4D/25 machines, reading and writing signed linear 8-bit
  871. samples at rates of 8, 16 and 32 k.)
  872.  
  873. A program "playulaw" was posted as part of the "radio 2.0" release
  874. that I posted to several source groups; it plays raw U-LAW files on
  875. the Indigo, Indigo2, Indy or Personal IRIS audio hardware.
  876.  
  877.         Sony NEWS
  878.         ---------
  879.  
  880. The whole current Sony NEWS line (laptop, desktop, server) have
  881. builtin sound capabilities.  You can buy an external board for the
  882. older NEWS machines.  In the default mode (8k/8-bit mulaw), Sun .au
  883. files are directly supported (you can 'cat' .au files to /dev/sb0 and
  884. have them play.)  The /usr/sony/bin/sbplay command on NEWS-OS 6.0
  885. also supports Sun .au files.
  886.  
  887.         Others
  888.         ------
  889.  
  890. Most other UNIX boxes don't have audio hardware and thus can't play
  891. audio data.  This is actually rapidly changing and most new hardware
  892. that hits the market has some form of audio support.  Unfortunately
  893. there is no single portable interface for audio that comes near the
  894. acceptance and functionality (let alone code size :-) of X11 for
  895. graphics.  There are at least two network-transparent packages, both
  896. in some way based on the X11 architecture, that attempt to fillo the
  897. gap:
  898.  
  899. DEC CRL's AudioFile supports Digital RISC systems running Ultrix,
  900. Digital Alpha AXP systems running OSF/1, Sun Sparcs, and SGI
  901. AL-capable systems (e.g., Indigo, Indy).  The source kit is located at
  902. ftp site crl.dec.com in /pub/DEC/AF.
  903.  
  904. NCD's NetAudio supports NCD's MCX line of X terminals as well as
  905. Sparcs running either SunOS 4.1.3 or Solaris 2.2, using the /dev/audio
  906. interface (they claim it should be easy to port).  The source it
  907. located at ftp.x.org in contrib/netaudio.  It is also ported to SGI
  908. (tested on IRIX 5.x), and there are unconfirmed rumors that it is
  909. being ported to SCI and Linux.
  910.  
  911.  
  912. Playing audio files on the Vaxstation 4000 (VMS)
  913. ------------------------------------------------
  914.  
  915. 1) Without DECsound
  916.  
  917. ".au" files can be played by COPYING them to device "SOA0:".  This
  918. device is set up by enabling the driver SODRIVER.  You can use the
  919. following command file:
  920.  
  921. $!---------------- cut here -------------------------------
  922. $! sound_setup.com    enable SOUND driver
  923. $ run sys$system:sysgen
  924. connect soa0 /adapter=0 /csr=%x0e00 /vector=%o304 /driver=sodriver
  925. exit
  926. $ exit
  927. $!----------------- cut here ------------------------------------
  928.  
  929. 2) With DECsound (bundled with motif)
  930.  
  931. Just start DECsound by selecting it from the session manager in the 
  932. applications menu. (Not there use "@vue$library:sound$vue_startup").
  933. Make sure settings; device type (vaxstation 4000) and play settings
  934. (headphone jack) are selected.  To play files from the DCL prompt 
  935. (handy if you want to play sounds on a remote workstation) set a 
  936. symbol up as follows; 
  937. PLAY == "$DECSOUND -VOLUME 50 -PLAY"
  938. usage;
  939. DCL> play sound.au
  940.  
  941. 3) Audio port
  942.  
  943. The external audio port comes with a telephone-jack-like port.   For
  944. starters, you can plug a telephone RECEIVER right into this port to
  945. hear your first sound files.   After that, you can use the adapter
  946. (that came with the VaxStation), and plug in a small set of stereo
  947. speakers or headphones (the kind you'd plug into a WALKMAN, for 
  948. example), for more volume.  The adapter also has a microphone plug so
  949. that you can record sounds if DECsound is installed.
  950.  
  951.  
  952. Playing audio files on micros
  953. -----------------------------
  954.  
  955. Most micros have at least a speaker built in, so theoretically all you
  956. need is the right software.  Unfortunately most systems don't come
  957. bundled with sound-playing software, so there are many public domain
  958. or shareware software packages, each with their own bugs and features.
  959. Most separate sound recording hardware also comes with playing
  960. software, most of which can play sound (in the file format used by
  961. that hardware) even on machines that don't have that hardware
  962. installed.
  963.  
  964.         PC or compatible
  965.         ----------------
  966.  
  967. Chris S. Craig announces the following software for PCs:
  968.  
  969. ScopeTrax       This is a complete PC sound player/editor package.  Sounds
  970.                 can be played back at ANY rate between 1kHz to 65kHz through
  971.                 the PC speaker or the Sound Blaster.  It supports several
  972.                 file formats including VOC, IFF/8SVX, raw signed and raw
  973.                 unsigned.  A separate executable is provided to convert
  974.                 .au and mu-law to raw format.  ScopeTrax requires EGA/VGA
  975.                 graphics for editing and displaying sounds on a REALTIME
  976.                 oscilloscope.  The package also includes:
  977.                       * An expanded memory player which can play sounds
  978.                         larger than 640K in size.
  979.                       * Basic (rough) sound compression/uncompression
  980.                         utilities.
  981.                       * Complete documentation.
  982.                 The package is FREEWARE!  It is available on SIMTEL in the
  983.                 PD1:[MSDOS.SOUND] directory.
  984.  
  985. One of the appendices below contains a list of more programs to play
  986. sound on the PC.
  987.  
  988.         Atari
  989.         -----
  990.  
  991. For sounds on Atari STs - programs are in the atari/sound/players
  992. directory on atari.archive.umich.edu.
  993.  
  994.         Tandy
  995.         -----
  996.  
  997. On a Tandy 1000, sounds can be played and recorded with DeskMate Sound
  998. (SOUND.PDM), or if they not stored in compressed format, they can also
  999. be played be a program called PLAYSND.  No indication of whether
  1000. PLAYSND is PD or not. It hasn't been updated since March of 89.
  1001.  
  1002.         Amiga
  1003.         -----
  1004.  
  1005. On the Amiga, OmniPlay by David Champion <dgc3@midway.uchicago.edu>
  1006. plays and converts IFF-8SVX, AIFF, WAV, VOC, .au, .snd, and 8 bit raw
  1007. (signed, unsigned, u-law) samples.  As of version 1.23, OmniPlay will
  1008. also convert any playable sample to 8SVX.  Files: wuarchive.wustl.edu
  1009. in /systems/amiga/audio/sampleplayers/oplay123.lha (?)
  1010. amiga.physik.unizh.ch in mus/play/oplay123.lha
  1011.  
  1012.         Apple Macintosh
  1013.         ---------------
  1014.  
  1015. Malcolm Slaney from Apple writes:
  1016.  
  1017.  "We do have tools to play sound back on most of our Unix hosts.  We wrote
  1018.  a program called TcpPlay that lets us read a sound file on a Unix host,
  1019.  open a TCP/IP connection to the Mac on my desk, and plays the file.  We
  1020.  think of it as X windows for sound (at least a step in that direction.)
  1021.  
  1022.  This software is available for anonymous FTP from ftp.apple.com.
  1023.  Look for  ~ftp/pub/TcpPlay/TcpPlay.sit.hqx.
  1024.  
  1025.  Finally, there are MANY tools for working with sound on the Macintosh. Three
  1026.  applications that come to mind immediately are SoundEdit (formerly by
  1027.  Farralon and now by MacroMind/Paracomp), Alchemy and Eric Keller's Signalyze.
  1028.  There are lots of other tools available for sound editing (including some
  1029.  of the QuickTime Movie tools.)"
  1030.  
  1031. Bill Houle sent the following lists:
  1032.  
  1033. Popular commercial apps are indicated with a [*].  All other programs
  1034. mentioned are shareware/freeware available from SUMEX and the various
  1035. mirror sites, or check archie for the nearest FTP location.
  1036.  
  1037. MAC SOUND EDITORS
  1038.  
  1039. Sample Editor [Garrick McFarlane, McFarlaneGA@Kirk.Vax.Aston.Ac.UK]
  1040.   Plays AIFF and 'snd' sounds.  Can convert between AIFF and 'snd'.
  1041.   Can record from built-in mic.  Can add effects such as fade,
  1042.   normalize, delay, etc.
  1043.  
  1044. Wavicle [Lee Fyock]
  1045.   Plays SoundEdit files.  Can convert to 'snd'.  Can record from built-in mic.
  1046.   Can add effects such as fade, filter, reverb, etc.
  1047.  
  1048. [*]SoundEdit/SoundEdit Pro [Farallon/MacroMind*Paracomp]
  1049.   Plays SoundEdit and 'snd' sounds.  Can read/write SoundEdit files and 'snd' 
  1050.   sounds.  Can record from built-in mic.  Can add effects such as
  1051.   echo, filter, reverb, etc.
  1052.  
  1053.  
  1054. MAC SOUND PLAYERS
  1055.  
  1056. Sound-Tracker  [Frank Seide]
  1057.   Plays Amiga SoundTracker files in foreground or background.
  1058.  
  1059. Macintosh Tracker [Thomas R. Lawrance, tomlaw@world.std.com]
  1060.   Plays Amiga SoundTracker files in foreground or background. A port of Marc
  1061.   Espie's Unix Tracker version with Frank Seide's core player thrown in for
  1062.   good measure.
  1063.  
  1064. The Player [Antoine Rosset & Mike Venturi]
  1065.   Plays AIFF, SoundEdit, MOD, and 'snd' files.
  1066.  
  1067. SoundMaster (aka [*]Kaboom!) [Bruce Tomlin]
  1068.   Associates SoundEdit files to MacOS events.
  1069.  
  1070. SndControl [Riccardo Ettore, 72277.1344@compuserve.com]
  1071.   Associates 'snd' sounds to MacOS events.
  1072.  
  1073. Canon 2 [Glenn Anderson, glenn@otago.ac.nz; Jeff Home, jeff@otago.ac.nz]
  1074.   Plays AIFF or 'snd' files in foreground or background.
  1075.  
  1076. Another Mac play/convert program: "It's called SoundApp. I wrote it,
  1077. (franke1@llnl.gov) and it's FreeWare. It will play: SoundCap,
  1078. SoundEdit, WAVE, VOC, MOD, Amiga IFF (8SVX), Sound Designer, AIFF, AU,
  1079. Mac Resource, and DVI ADPCM. It can convert all the above to System 7
  1080. sound resources (except MOD where just the samples are extracted.) And
  1081. it will double buffer."
  1082.  
  1083.  
  1084. The Sound Site Newsletter
  1085. -------------------------
  1086.  
  1087. An electronic publication with lots of info about digitised sound and
  1088. sound formats, albeit mostly on PCs, is "The Sound Site Newsletter",
  1089. maintained by David Komatsu <davek@uhunix.uhcc.hawaii.edu>.
  1090. Issue 14 appeared in July 1993.  As of that issue, the Sound Site
  1091. Newsletter has expanded its charter to include commercial products and
  1092. will appear monthly.  There is now also a sound site network of ftp
  1093. servers, bulletin boards and authors.  The Sound Site Newsletter (once
  1094. again!) has its own ftp site: sound.usach.cl.
  1095.  
  1096. The Sound Newsletter is posted to: comp.sys.ibm.pc.soundcard
  1097.                                    comp.sys.ibm.pc.misc
  1098.                                    rec.games.misc
  1099. FTP: oak.oakland.edu (misc/sound)
  1100.      garbo.uwasa.fi (pc/sound)
  1101.      sound.usach.cl (pub/Sound/Newsltr) [Home Base]
  1102.  
  1103.  
  1104. Posting sounds
  1105. --------------
  1106.  
  1107. The newsgroup alt.binaries.sounds.misc is dedicated to postings
  1108. containing sound.  (Discussions related to such postings belong in
  1109. alt.binaries.sounds.d.)
  1110.  
  1111. There is no set standard for posting sounds; uuencoded files in most
  1112. popular formats are welcome, if split in parts under 50 kBytes.  To
  1113. accomodate automatic decoding software (such as the ":decode" command
  1114. of the nn newsreader), please place a part indicator of the form
  1115. (mm/nn) at the end of your subject meaning this is number mm of a
  1116. total of nn part.
  1117.  
  1118. It is recommended to post sounds in the format that was used for the
  1119. original recording; conversions to other formats often lose
  1120. information and would do people with identical hardware as the poster
  1121. no favor.  For instance, convering 8-bit linear sound to U-LAW loses
  1122. the lower few bits of the data, and rate changing conversions almost
  1123. always add noise.  Converting from U-LAW to linear requires expansion
  1124. to 16 bit samples if no information loss is allowed!
  1125.  
  1126. U-LAW data is best posted with a NeXT/Sun header.
  1127.  
  1128. If you have to post a file in a headerless format (usually 8-bit
  1129. linear, like ".snd"), please add a description giving at least the
  1130. sampling rate and whether the bytes are signed (zero at 0) or unsigned
  1131. (zero at 0200).  However, it is highly recommended to add a header
  1132. that indicates the sampling rate and encoding scheme; if necessary you
  1133. can use SOX to add a header of your choice to raw data.
  1134.  
  1135. Compression of sound files usually isn't worth it; the standard
  1136. "compress" algorithm doesn't save much when applied to sound data
  1137. (typically at most 10-20 percent), and compression algorithms
  1138. specifically designed for sound (e.g. NeXT's) are usually
  1139. proprietary.  (See also the section "Compression schemes" earlier.)
  1140.  
  1141. ~Newsgroups: alt.binaries.sounds.misc,alt.binaries.sounds.d,comp.dsp,alt.answers,comp.answers,news.answers
  1142. Path: cs.tu-berlin.de!zrz.TU-Berlin.DE!netmbx.de!Germany.EU.net!EU.net!sun4nl!cwi.nl!guido
  1143. ~From: guido@cwi.nl (Guido van Rossum)
  1144. ~Subject: FAQ: Audio File Formats (part 2 of 2)
  1145. Message-ID: <audio-part2_775730737@charon.cwi.nl>
  1146. Followup-To: alt.binaries.sounds.d,comp.dsp
  1147. ~Sender: news@cwi.nl (The Daily Dross)
  1148. Supersedes: <audio-part2_767261825@charon.cwi.nl>
  1149. Nntp-Posting-Host: voorn.cwi.nl
  1150. ~Reply-To: guido@cwi.nl
  1151. Organization: CWI, Amsterdam
  1152. ~Date: Mon, 1 Aug 1994 08:45:47 GMT
  1153. Approved: news-answers-request@MIT.Edu
  1154. Expires: Mon, 29 Aug 1994 08:45:37 GMT
  1155. ~Lines: 1521
  1156. ~Xref: cs.tu-berlin.de alt.binaries.sounds.misc:26344 alt.binaries.sounds.d:6193 comp.dsp:12306 alt.answers:3795 comp.answers:6567 news.answers:26139
  1157.  
  1158. Archive-name: audio-fmts/part2
  1159. Submitted-by: Guido van Rossum <guido@cwi.nl>
  1160. Version: 3.09
  1161. Last-modified: 1-Aug-1994
  1162.  
  1163. Appendices
  1164. ==========
  1165.  
  1166. Here are some more detailed pieces of info that I received by e-mail.
  1167. They are reproduced here virtually without much editing.
  1168.  
  1169. Table of contents
  1170. -----------------
  1171.  
  1172. FTP access for non-internet sites
  1173. AIFF Format (Audio IFF)
  1174. The NeXT/Sun audio file format
  1175. IFF/8SVX Format
  1176. Playing sound on a PC
  1177. The EA-IFF-85 documentation
  1178. US Federal Standard 1016 availability
  1179. Creative Voice (VOC) file format
  1180. RIFF WAVE (.WAV) file format
  1181. U-LAW and A-LAW definitions
  1182. AVR File Format
  1183. The Amiga MOD Format
  1184. The Sample Vision Format
  1185. Some Miscellaneous Formats
  1186. Tandy Deskmate .snd Format Notes
  1187.  
  1188.  
  1189. ------------------------------------------------------------------------
  1190. FTP access for non-internet sites
  1191. ---------------------------------
  1192.  
  1193. From the sci.space FAQ:
  1194.  
  1195.     Sites not connected to the Internet cannot use FTP directly, but
  1196.     there are a few automated FTP servers which operate via email.
  1197.     Send mail containing only the word HELP to ftpmail@decwrl.dec.com
  1198.     or bitftp@pucc.princeton.edu, and the servers will send you
  1199.     instructions on how to make requests.  (The bitftp service is no
  1200.     longer available through UUCP gateways due to complaints about
  1201.     overuse :-( )
  1202.  
  1203. Also:
  1204.  
  1205.     FAQ lists are available by anonymous FTP from rftm.mit.edu
  1206.     and by email from mail-server@rtfm.mit.edu (send a message
  1207.     containing "help" for instructions about the mail server).
  1208.  
  1209.  
  1210. ------------------------------------------------------------------------
  1211. AIFF Format (Audio IFF) and AIFC
  1212. --------------------------------
  1213.  
  1214. This format was developed by Apple for storing high-quality sampled
  1215. sound and musical instrument info; it is also used by SGI and several
  1216. professional audio packages (sorry, I know no names).  An extension,
  1217. called AIFC or AIFF-C, supports compression (see the last item below).
  1218.  
  1219. I've made a BinHex'ed MacWrite version of the AIFF spec (no idea if
  1220. it's the same text as mentioned below) available by anonymous ftp from
  1221. ftp.cwi.nl; the file is /pub/audio/AudioIFF1.2.hqx.  A newer version
  1222. is also available: /pub/audio/AudioIFF1.3.hqx.  But you may be better
  1223. off with the AIFF-C specs, see below.
  1224.  
  1225. Mike Brindley (brindley@ece.orst.edu) writes:
  1226.  
  1227. "The complete AIFF spec by Steve Milne, Matt Deatherage (Apple) is
  1228. available in 'AMIGA ROM Kernal Reference Manual: Devices (3rd Edition)'
  1229. 1991 by Commodore-Amiga, Inc.; Addison-Wesley Publishing Co.; 
  1230. ISBN 0-201-56775-X, starting on page 435 (this edition has a charcoal
  1231. grey cover).  It is available in most bookstores, and soon in many
  1232. good librairies."
  1233.  
  1234. According to Mark Callow (msc@sgi.com):
  1235.  
  1236. A PostScript version of the AIFF-C specification is available via
  1237. anonymous ftp on ftp.sgi.com as /sgi/aiff-c.9.26.91.ps.
  1238.  
  1239. Benjamin Denckla <bdenckla@husc.harvard.edu> writes:
  1240.  
  1241. A piece of information that may be of some use to people who want to use
  1242. AIFF files with their Macintosh Think C programs:  AIFF data structures are
  1243. contained in the file AIFF.h in the "Apple #Includes" folder that comes
  1244. on the distribution disks.  I assume that this header file comes with 
  1245. Apple programming products like MPW [C|C++] as well.  I found this out a 
  1246. little too late: I had already coded my own structures.  These structures 
  1247. of mine, along with other useful code for AIFF-based DSP in C, are 
  1248. available for ftp at ftp.cs.jhu.edu in pub/dsp.
  1249.  
  1250. An important file format for the Mac which is only mentioned once in the
  1251. FAQ is the Sound Designer II file format.  There is also an older Sound
  1252. Designer I format.  I have the SDII format in electronic form but I don't
  1253. think I'm at liberty to distribute it.  It can be obtained by applying to
  1254. become a 3rd Party Developer for Digidesign.  This process is simple
  1255. (1-page application) and free.  Call Digidesign at 415-688-0600 for
  1256. information.  The SDII file format is interesting in that all non-sample
  1257. data (sample rate, channels, etc.) is contained in the resource fork and
  1258. the data fork contains sample data only.
  1259.  
  1260. ------------------------------------------------------------------------
  1261. The NeXT/Sun audio file format
  1262. ------------------------------
  1263.  
  1264. Here's the complete story on the file format, from the NeXT
  1265. documentation.  (Note that the "magic" number is ((int)0x2e736e64),
  1266. which equals ".snd".)  Also, at the end, I've added a litte document
  1267. that someone posted to the net a couple of years ago, that describes
  1268. the format in a bit-by-bit fashion rather than from C.
  1269.  
  1270. I received this from Doug Keislar, NeXT Computer.  This is also the
  1271. Sun format, except that Sun doesn't recognize as many format codes.  I
  1272. added the numeric codes to the table of formats and sorted it.
  1273.  
  1274.  
  1275. SNDSoundStruct:  How a NeXT Computer Represents Sound
  1276.  
  1277. The NeXT sound software defines the SNDSoundStruct structure to  
  1278. represent sound.  This structure defines the soundfile and Mach-O  
  1279. sound segment formats and the sound pasteboard type.  It's also used  
  1280. to describe sounds in Interface Builder.  In addition, each instance  
  1281. of the Sound Kit's Sound class encapsulates a SNDSoundStruct and  
  1282. provides methods to access and modify its attributes.
  1283.  
  1284. Basic sound operations, such as playing, recording, and cut-and-paste  
  1285. editing, are most easily performed by a Sound object.  In many cases,  
  1286. the Sound Kit obviates the need for in-depth understanding of the  
  1287. SNDSoundStruct architecture.  For example, if you simply want to  
  1288. incorporate sound effects into an application, or to provide a simple  
  1289. graphic sound editor (such as the one in the Mail application), you  
  1290. needn't be aware of the details of the SNDSoundStruct.  However, if  
  1291. you want to closely examine or manipulate sound data you should be  
  1292. familiar with this structure.
  1293.  
  1294. The SNDSoundStruct contains a header, information that describes the  
  1295. attributes of a sound, followed by the data (usually samples) that  
  1296. represents the sound.  The structure is defined (in  
  1297. sound/soundstruct.h) as:
  1298.  
  1299. typedef struct {
  1300.     int magic;               /* magic number SND_MAGIC */
  1301.     int dataLocation;        /* offset or pointer to the data */
  1302.     int dataSize;            /* number of bytes of data */
  1303.     int dataFormat;          /* the data format code */
  1304.     int samplingRate;        /* the sampling rate */
  1305.     int channelCount;        /* the number of channels */
  1306.     char info[4];            /* optional text information */
  1307. } SNDSoundStruct;
  1308.  
  1309.  
  1310.  
  1311.  
  1312. SNDSoundStruct Fields
  1313.  
  1314.  
  1315.  
  1316. magic
  1317.  
  1318. magic is a magic number that's used to identify the structure as a  
  1319. SNDSoundStruct.  Keep in mind that the structure also defines the  
  1320. soundfile and Mach-O sound segment formats, so the magic number is  
  1321. also used to identify these entities as containing a sound.
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327. dataLocation
  1328.  
  1329. It was mentioned above that the SNDSoundStruct contains a header  
  1330. followed by sound data.  In reality, the structure only contains the  
  1331. header; the data itself is external to, although usually contiguous  
  1332. with, the structure.  (Nonetheless, it's often useful to speak of the  
  1333. SNDSoundStruct as the header and the data.)  dataLocation is used to  
  1334. point to the data.  Usually, this value is an offset (in bytes) from  
  1335. the beginning of the SNDSoundStruct to the first byte of sound data.   
  1336. The data, in this case, immediately follows the structure, so  
  1337. dataLocation can also be thought of as the size of the structure's  
  1338. header.  The other use of dataLocation, as an address that locates  
  1339. data that isn't contiguous with the structure, is described in  
  1340. "Format Codes," below.
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346. dataSize, dataFormat, samplingRate, and channelCount
  1347.  
  1348. These fields describe the sound data.
  1349.  
  1350. dataSize is its size in bytes (not including the size of the  
  1351. SNDSoundStruct).
  1352.  
  1353. dataFormat is a code that identifies the type of sound.  For sampled  
  1354. sounds, this is the quantization format.  However, the data can also  
  1355. be instructions for synthesizing a sound on the DSP.  The codes are  
  1356. listed and explained in "Format Codes," below.
  1357.  
  1358. samplingRate is the sampling rate (if the data is samples).  Three  
  1359. sampling rates, represented as integer constants, are supported by  
  1360. the hardware:
  1361.  
  1362. Constant        Sampling Rate (samples/sec) 
  1363.  
  1364. SND_RATE_CODEC  8012.821        (CODEC input)
  1365. SND_RATE_LOW    22050.0 (low sampling rate output)
  1366. SND_RATE_HIGH   44100.0 (high sampling rate output)
  1367.  
  1368. channelCount is the number of channels of sampled sound.
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374. info
  1375.  
  1376. info is a NULL-terminated string that you can supply to provide a  
  1377. textual description of the sound.  The size of the info field is set  
  1378. when the structure is created and thereafter can't be enlarged.  It's  
  1379. at least four bytes long (even if it's unused).
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385. Format Codes
  1386.  
  1387. A sound's format is represented as a positive 32-bit integer.  NeXT  
  1388. reserves the integers 0 through 255; you can define your own format  
  1389. and represent it with an integer greater than 255.  Most of the  
  1390. formats defined by NeXT describe the amplitude quantization of  
  1391. sampled sound data:
  1392.  
  1393. Value   Code    Format 
  1394.  
  1395. 0       SND_FORMAT_UNSPECIFIED  unspecified format 
  1396. 1       SND_FORMAT_MULAW_8      8-bit mu-law samples
  1397. 2       SND_FORMAT_LINEAR_8     8-bit linear samples
  1398. 3       SND_FORMAT_LINEAR_16    16-bit linear samples
  1399. 4       SND_FORMAT_LINEAR_24    24-bit linear samples
  1400. 5       SND_FORMAT_LINEAR_32    32-bit linear samples
  1401. 6       SND_FORMAT_FLOAT        floating-point samples
  1402. 7       SND_FORMAT_DOUBLE       double-precision float samples
  1403. 8       SND_FORMAT_INDIRECT     fragmented sampled data
  1404. 9       SND_FORMAT_NESTED       ?
  1405. 10      SND_FORMAT_DSP_CORE     DSP program
  1406. 11      SND_FORMAT_DSP_DATA_8   8-bit fixed-point samples
  1407. 12      SND_FORMAT_DSP_DATA_16  16-bit fixed-point samples
  1408. 13      SND_FORMAT_DSP_DATA_24  24-bit fixed-point samples
  1409. 14      SND_FORMAT_DSP_DATA_32  32-bit fixed-point samples
  1410. 15      ?
  1411. 16      SND_FORMAT_DISPLAY      non-audio display data
  1412. 17      SND_FORMAT_MULAW_SQUELCH        ?
  1413. 18      SND_FORMAT_EMPHASIZED   16-bit linear with emphasis
  1414. 19      SND_FORMAT_COMPRESSED   16-bit linear with compression
  1415. 20      SND_FORMAT_COMPRESSED_EMPHASIZED        A combination of the two above
  1416. 21      SND_FORMAT_DSP_COMMANDS Music Kit DSP commands
  1417. 22      SND_FORMAT_DSP_COMMANDS_SAMPLES         ?
  1418. [Some new ones supported by Sun.  This is all I currently know. --GvR]
  1419. 23      SND_FORMAT_ADPCM_G721
  1420. 24      SND_FORMAT_ADPCM_G722
  1421. 25      SND_FORMAT_ADPCM_G723_3
  1422. 26      SND_FORMAT_ADPCM_G723_5
  1423. 27      SND_FORMAT_ALAW_8
  1424.  
  1425.  
  1426. Most formats identify different sizes and types of  
  1427. sampled data.  Some deserve special note:  
  1428.  
  1429.  
  1430. --      SND_FORMAT_DSP_CORE format contains data that represents a  
  1431. loadable DSP core program.  Sounds in this format are required by the  
  1432. SNDBootDSP() and SNDRunDSP() functions.  You create a  
  1433. SND_FORMAT_DSP_CORE sound by reading a DSP load file (extension  
  1434. ".lod") with the SNDReadDSPfile() function.
  1435.  
  1436. --      SND_FORMAT_DSP_COMMANDS is used to distinguish sounds that  
  1437. contain DSP commands created by the Music Kit.  Sounds in this format  
  1438. can only be created through the Music Kit's Orchestra class, but can  
  1439. be played back through the SNDStartPlaying() function.
  1440.  
  1441. --      SND_FORMAT_DISPLAY format is used by the Sound Kit's  
  1442. SoundView class.  Such sounds can't be played.  
  1443.  
  1444.  
  1445. --      SND_FORMAT_INDIRECT indicates data that has become  
  1446. fragmented, as described in a separate section, below.  
  1447.  
  1448.  
  1449. --      SND_FORMAT_UNSPECIFIED is used for unrecognized formats.
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455. Fragmented Sound Data
  1456.  
  1457. Sound data is usually stored in a contiguous block of memory.   
  1458. However, when sampled sound data is edited (such that a portion of  
  1459. the sound is deleted or a portion inserted), the data may become  
  1460. discontiguous, or fragmented.  Each fragment of data is given its own  
  1461. SNDSoundStruct header; thus, each fragment becomes a separate  
  1462. SNDSoundStruct structure.  The addresses of these new structures are  
  1463. collected into a contiguous, NULL-terminated block; the dataLocation  
  1464. field of the original SNDSoundStruct is set to the address of this  
  1465. block, while the original format, sampling rate, and channel count  
  1466. are copied into the new SNDSoundStructs.  
  1467.  
  1468.  
  1469. Fragmentation serves one purpose:  It avoids the high cost of moving  
  1470. data when the sound is edited.  Playback of a fragmented sound is  
  1471. transparent-you never need to know whether the sound is fragmented  
  1472. before playing it.  However, playback of a heavily fragmented sound  
  1473. is less efficient than that of a contiguous sound.  The  
  1474. SNDCompactSamples() C function can be used to compact fragmented  
  1475. sound data.
  1476.  
  1477. Sampled sound data is naturally unfragmented.  A sound that's freshly  
  1478. recorded or retrieved from a soundfile, the Mach-O segment, or the  
  1479. pasteboard won't be fragmented.  Keep in mind that only sampled data  
  1480. can become fragmented.
  1481.  
  1482.  
  1483.  
  1484. _________________________
  1485. >From mentor.cc.purdue.edu!purdue!decwrl!ucbvax!ziploc!eps Wed Apr  4  
  1486. 23:56:23 EST 1990
  1487. Article 5779 of comp.sys.next:
  1488. Path: mentor.cc.purdue.edu!purdue!decwrl!ucbvax!ziploc!eps
  1489. >From: eps@toaster.SFSU.EDU (Eric P. Scott)
  1490. ~Newsgroups: comp.sys.next
  1491. ~Subject: Re: Format of NeXT sndfile headers?
  1492. Message-ID: <445@toaster.SFSU.EDU>
  1493. ~Date: 31 Mar 90 21:36:17 GMT
  1494. ~References: <14978@phoenix.Princeton.EDU>
  1495. ~Reply-To: eps@cs.SFSU.EDU (Eric P. Scott)
  1496. Organization: San Francisco State University
  1497. ~Lines: 42
  1498.  
  1499. In article <14978@phoenix.Princeton.EDU>
  1500.         bskendig@phoenix.Princeton.EDU (Brian Kendig) writes:
  1501. >I'd like to take a program I have that converts Macintosh sound  
  1502. files
  1503. >to NeXT sndfiles and polish it up a bit to go the other direction as
  1504. >well.
  1505.  
  1506. Two people have already submitted programs that do this
  1507. (Christopher Lane and Robert Hood); check the various
  1508. NeXT archive sites.
  1509.  
  1510. >       Could someone please give me the format of a NeXT sndfile
  1511. >header?
  1512.  
  1513. "big-endian"
  1514.         0       1       2       3
  1515.         +-------+-------+-------+-------+
  1516. 0       | 0x2e  | 0x73  | 0x6e  | 0x64  |       "magic" number
  1517.         +-------+-------+-------+-------+
  1518. 4       |                               |       data location
  1519.         +-------+-------+-------+-------+
  1520. 8       |                               |       data size
  1521.         +-------+-------+-------+-------+
  1522. 12      |                               |       data format (enum)
  1523.         +-------+-------+-------+-------+
  1524. 16      |                               |       sampling rate (int)
  1525.         +-------+-------+-------+-------+
  1526. 20      |                               |       channel count
  1527.         +-------+-------+-------+-------+
  1528. 24      |       |       |       |       |       (optional) info  
  1529. string
  1530.  
  1531. 28 = minimum value for data location
  1532.  
  1533. data format values can be found in /usr/include/sound/soundstruct.h
  1534.  
  1535. Most common combinations:
  1536.  
  1537.          sampling  channel    data
  1538.              rate    count  format              
  1539. voice file   8012        1       1 =  8-bit mu-law
  1540. system beep 22050        2       3 = 16-bit linear
  1541. CD-quality  44100        2       3 = 16-bit linear
  1542.  
  1543. ------------------------------------------------------------------------
  1544. IFF/8SVX Format
  1545. ---------------
  1546.  
  1547. ~Newsgroups: alt.binaries.sounds.d,alt.sex.sounds
  1548. ~Subject: Format of the IFF header (Amiga sounds)
  1549. Message-ID: <2509@tardis.Tymnet.COM>
  1550. ~From: jms@tardis.Tymnet.COM (Joe Smith)
  1551. ~Date: 23 Oct 91 23:54:38 GMT
  1552. Followup-To: alt.binaries.sounds.d
  1553. Organization: BT North America (Tymnet)
  1554.  
  1555. The first 12 bytes of an IFF file are used to distinguish between an Amiga
  1556. picture (FORM-ILBM), an Amiga sound sample (FORM-8SVX), or other file
  1557. conforming to the IFF specification.  The middle 4 bytes is the count of
  1558. bytes that follow the "FORM" and byte count longwords.  (Numbers are stored
  1559. in M68000 form, high order byte first.)
  1560.  
  1561.                 ------------------------------------------
  1562.  
  1563. FutureSound audio file, 15000 samples at 10.000KHz, file is 15048 bytes long.
  1564.  
  1565. 0000: 464F524D 00003AC0 38535658 56484452    FORM..:.8SVXVHDR
  1566.       F O R M     15040 8 S V X  V H D R
  1567. 0010: 00000014 00003A98 00000000 00000000    ......:.........
  1568.             20    15000        0        0
  1569. 0020: 27100100 00010000 424F4459 00003A98    '.......BODY..:.
  1570.      10000 1 0    1.0   B O D Y     15000
  1571.  
  1572. 0000000..03 = "FORM", identifies this as an IFF format file.
  1573. FORM+00..03 (ULONG) = number of bytes that follow.  (Unsigned long int.)
  1574. FORM+03..07 = "8SVX", identifies this as an 8-bit sampled voice.
  1575.  
  1576. ????+00..03 = "VHDR", Voice8Header, describes the parameters for the BODY.
  1577. VHDR+00..03 (ULONG) = number of bytes to follow. 
  1578. VHDR+04..07 (ULONG) = samples in the high octave 1-shot part.
  1579. VHDR+08..0B (ULONG) = samples in the high octave repeat part.
  1580. VHDR+0C..0F (ULONG) = samples per cycle in high octave (if repeating), else 0.
  1581. VHDR+10..11 (UWORD) = samples per second.  (Unsigned 16-bit quantity.)
  1582. VHDR+12     (UBYTE) = number of octaves of waveforms in sample.
  1583. VHDR+13     (UBYTE) = data compression (0=none, 1=Fibonacci-delta encoding).
  1584. VHDR+14..17 (FIXED) = volume.  (The number 65536 means 1.0 or full volume.)
  1585.  
  1586. ????+00..03 = "BODY", identifies the start of the audio data.
  1587. BODY+00..03 (ULONG) = number of bytes to follow.
  1588. BODY+04..NNNNN      = Data, signed bytes, from -128 to +127.
  1589.  
  1590. 0030: 04030201 02030303 04050605 05060605
  1591. 0040: 06080806 07060505 04020202 01FF0000
  1592. 0050: 00000000 FF00FFFF FFFEFDFD FDFEFFFF
  1593. 0060: FDFDFF00 00FFFFFF 00000000 00FFFF00
  1594. 0070: 00000000 00FF0000 00FFFEFF 00000000
  1595. 0080: 00010000 000101FF FF0000FE FEFFFFFE
  1596. 0090: FDFDFEFD FDFFFFFC FDFEFDFD FEFFFEFE
  1597. 00A0: FFFEFEFE FEFEFEFF FFFFFEFF 00FFFF01
  1598.  
  1599. This small section of the audio sample shows the number ranging from -5 (0xFD)
  1600. to +8 (0x08).  Warning: Do not assume that the BODY starts 48 bytes into the
  1601. file.  In addition to "VHDR", chunks labeled "NAME", "AUTH", "ANNO", or 
  1602. "(c) " may be present, and may be in any order.  You will have to check the
  1603. byte count in each chunk to determine how many bytes to skip.
  1604.  
  1605. ------------------------------------------------------------------------
  1606. Playing sound on a PC
  1607. ---------------------
  1608.  
  1609. ~From: Eric A Rasmussen
  1610.  
  1611. Any turbo PC (8088 at 8 Mhz or greater)/286/386/486/etc. can produce a quality
  1612. playback of single channel 8 bit sounds on the internal (1 bit, 1 channel)
  1613. speaker by utilizing Pulse-Width-Modulation, which toggles the speaker faster
  1614. than it can physically move to simulate positions between fully on and fully
  1615. off.  There are several PD programs of this nature that I know of:
  1616.  
  1617. REMAC  - Plays MAC format sound files.  Files on the Macintosh, at least the
  1618.          sound files that I've ripped apart, seem to contain 3 parts.  The
  1619.          first two are info like what the file icon looks like and other
  1620.          header type info.  The third part contains the raw sample data, and
  1621.          it is this portion of the file which is saved to a seperate file,
  1622.          often named with the .snd extension by PC users.  Personally, I like
  1623.          to name the files .s1, .s2, .s3, or .s4 to indicate the sampling rate
  1624.          of the file. (-s# is how to specify the playback rate in REMAC.)
  1625.          REMAC provides playback rates of 5550hz, 7333hz, 11 khz, & 22 khz.
  1626. REMAC2 - Same as REMAC, but sounds better on higher speed machines.
  1627. REPLAY - Basically same as REMAC, but for playback of Atari ST sounds. 
  1628.          Apparently, the Atari has two sound formats, one of which sounds like
  1629.          garbage if played by REMAC or REPLAY in the incorrect mode.  The
  1630.          other file format works fine with REMAC and so appears to be 'normal'
  1631.          unsigned 8-bit data.  REPLAY provides playback rates of 11.5 khz,
  1632.          12.5 khz, 14 khz, 16 khz, 18.5 khz, 22khz, & 27 khz.
  1633.  
  1634. These three programs are all by the same author, Richard E. Zobell who does
  1635. not have an internet mail address to my knowledge, but does have a GEnie email
  1636. address of R.ZOBELL. 
  1637.  
  1638. Additionally, there are various stand-alone demos which use the internal
  1639. speaker, of which there is one called mushroom which plays a 30 second
  1640. advertising jingle for magic mushroom room deoderizers which is pretty
  1641. humerous.  I've used this player to playback samples that I ripped out of the
  1642. commercial game program Mean Streets, which uses something they call RealSound
  1643. (tm) to playback digital samples on the internal speaker. (Of course, I only do
  1644. this on my own system, and since I own the game, I see no problems with it.)
  1645.  
  1646. For owners of 8 Mhz 286's and above, the option to play 4 channel 8 bit sounds
  1647. (with decent quality) on the internal speaker is also a reality.  Quite a
  1648. number of PD programs exist to do this, including, but not limited to:
  1649.  
  1650. ModEdit, ModPlay, ScreamTracker, STM, Star Trekker, Tetra, and probably a few
  1651. more.  
  1652.  
  1653. All these programs basically make use of various sound formats used by the
  1654. Amiga line of computers.  These include .stm files, .mod files
  1655. [a.k.a. mod. files], and .nst files [really the same hing].  Also,
  1656. these programs pretty much all have the option to playback the 
  1657. sound to add-on hardware such as the SoundBlaster card, the Covox series of
  1658. devices, and also to direct the data to either one or two (for stereo)
  1659. parallel ports, which you could attach your own D/A's to.  (From what I have
  1660. seen, the Covox is basically an small amplified speaker with a D/A which plugs
  1661. into the parallel port.  This sounds very similiar to the Disney Sound System
  1662. (DSS) which people have been talking about recently.)  
  1663.  
  1664. ------------------------------------------------------------------------
  1665. The EA-IFF-85 documentation
  1666. ---------------------------
  1667.  
  1668. ~From: dgc3@midway.uchicago.edu
  1669.  
  1670. As promised, here's an ftp location for the EA-IFF-85 documentation.  It's
  1671. the November 1988 release as revised by Commodore (the last public release),
  1672. with specifications for IFF FORMs for graphics, sound, formatted text, and
  1673. more.  IFF FORMS now exist for other media, including structured drawing, and
  1674. new documentation is now available only from Commodore.
  1675.  
  1676. The documentation is at grind.isca.uiowa.edu, in the directory
  1677. /amiga/f1/ff185.  The complete file list is as follows:
  1678.  
  1679. DOCUMENTS.zoo    
  1680. EXAMPLES.zoo     
  1681. EXECUTABLE.zoo   
  1682. INCLUDE.zoo      
  1683. LINKER_INFO.zoo  
  1684. OBJECT.zoo       
  1685. SOURCE.zoo       
  1686. TP_IFF_Specs.zoo 
  1687.  
  1688. All files except DOCUMENTS.zoo are Amiga-specific, but may be used as a basis
  1689. for conversion to other platforms.  Well, I take that tentatively back.  I
  1690. don't know what TP_IFF_Specs.zoo contains, so it might be non-Amiga-specific.
  1691.  
  1692. ------------------------------------------------------------------------
  1693. US Federal Standard 1016 availability
  1694. -------------------------------------
  1695.  
  1696. ~From: jpcampb@afterlife.ncsc.mil (Joe Campbell)
  1697.  
  1698. The U.S. DoD's Federal-Standard-1016 based 4800 bps code excited linear
  1699. prediction voice coder version 3.2 (CELP 3.2) Fortran and C simulation
  1700. source codes are available for worldwide distribution (on DOS
  1701. diskettes, but configured to compile on Sun SPARC stations) from NTIS
  1702. and DTIC.  Example input and processed speech files are included.  A
  1703. Technical Information Bulletin (TIB), "Details to Assist in
  1704. Implementation of Federal Standard 1016 CELP," and the official
  1705. standard, "Federal Standard 1016, Telecommunications:  Analog to
  1706. Digital Conversion of Radio Voice by 4,800 bit/second Code Excited
  1707. Linear Prediction (CELP)," are also available.
  1708.  
  1709. This is available through the National Technical Information Service:
  1710.  
  1711. NTIS
  1712. U.S. Department of Commerce
  1713. 5285 Port Royal Road
  1714. Springfield, VA  22161
  1715. USA
  1716. (703) 487-4650
  1717.  
  1718. The "AD" ordering number for the CELP software is AD M000 118
  1719. (US$ 90.00) and for the TIB it's AD A256 629 (US$ 17.50).  The LPC-10
  1720. standard, described below, is FIPS Pub 137 (US$ 12.50).  There is a
  1721. $3.00 shipping charge on all U.S. orders.  The telephone number for
  1722. their automated system is 703-487-4650, or 703-487-4600 if you'd prefer
  1723. to talk with a real person.
  1724.  
  1725. (U.S. DoD personnel and contractors can receive the package from the
  1726. Defense Technical Information Center:  DTIC, Building 5, Cameron
  1727. Station, Alexandria, VA 22304-6145.  Their telephone number is
  1728. 703-274-7633.)
  1729.  
  1730. The following articles describe the Federal-Standard-1016 4.8-kbps CELP
  1731. coder (it's unnecessary to read more than one):
  1732.  
  1733. Campbell, Joseph P. Jr., Thomas E. Tremain and Vanoy C. Welch,
  1734. "The Federal Standard 1016 4800 bps CELP Voice Coder," Digital Signal
  1735. Processing, Academic Press, 1991, Vol. 1, No. 3, p. 145-155.
  1736.  
  1737. Campbell, Joseph P. Jr., Thomas E. Tremain and Vanoy C. Welch,
  1738. "The DoD 4.8 kbps Standard (Proposed Federal Standard 1016),"
  1739. in Advances in Speech Coding, ed. Atal, Cuperman and Gersho,
  1740. Kluwer Academic Publishers, 1991, Chapter 12, p. 121-133.
  1741.  
  1742. Campbell, Joseph P. Jr., Thomas E. Tremain and Vanoy C. Welch, "The
  1743. Proposed Federal Standard 1016 4800 bps Voice Coder:  CELP," Speech
  1744. Technology Magazine, April/May 1990, p. 58-64.
  1745.  
  1746.  
  1747. The U.S. DoD's Federal-Standard-1015/NATO-STANAG-4198 based 2400 bps
  1748. linear prediction coder (LPC-10) was republished as a Federal
  1749. Information Processing Standards Publication 137 (FIPS Pub 137).
  1750. It is described in:
  1751.  
  1752. Thomas E. Tremain, "The Government Standard Linear Predictive Coding
  1753. Algorithm:  LPC-10," Speech Technology Magazine, April 1982, p. 40-49.
  1754.  
  1755. There is also a section about FS-1015 in the book:
  1756. Panos E. Papamichalis, Practical Approaches to Speech Coding,
  1757. Prentice-Hall, 1987.
  1758.  
  1759. The voicing classifier used in the enhanced LPC-10 (LPC-10e) is described in:
  1760. Campbell, Joseph P., Jr. and T. E. Tremain, "Voiced/Unvoiced Classification
  1761. of Speech with Applications to the U.S. Government LPC-10E Algorithm,"
  1762. Proceedings of the IEEE International Conference on Acoustics, Speech, and
  1763. Signal Processing, 1986, p. 473-6.
  1764.  
  1765. Copies of the official standard
  1766. "Federal Standard 1016, Telecommunications: Analog to Digital Conversion
  1767. of Radio Voice by 4,800 bit/second Code Excited Linear Prediction (CELP)"
  1768. are available for US$ 5.00 each from:
  1769.  
  1770. GSA Federal Supply Service Bureau
  1771. Specification Section, Suite 8100
  1772. 470 E. L'Enfant Place, S.W.
  1773. Washington, DC  20407
  1774. (202)755-0325
  1775.  
  1776. Realtime DSP code for FS-1015 and FS-1016 is sold by:
  1777.  
  1778. John DellaMorte
  1779. DSP Software Engineering
  1780. 165 Middlesex Tpk, Suite 206
  1781. Bedford, MA  01730
  1782. USA
  1783. 1-617-275-3733
  1784. 1-617-275-4323 (fax)
  1785. dspse.bedford@channel1.com
  1786.  
  1787. DSP Software Engineering's FS-1016 code can run on a DSP Research's Tiger 30
  1788. (a PC board with a TMS320C3x and analog interface suited to development work).
  1789.  
  1790. DSP Research                
  1791. 1095 E. Duane Ave.          
  1792. Sunnyvale, CA  94086        
  1793. USA
  1794. (408)773-1042               
  1795. (408)736-3451 (fax)         
  1796.  
  1797. ~From: cfreese@super.org (Craig F. Reese)
  1798. ~Newsgroups: comp.speech,comp.dsp,comp.compression.research
  1799. ~Subject: CELP 3.2a release now available
  1800. Organization: Supercomputing Research Center (Bowie, MD)
  1801. ~Date: Tue, 3 Aug 1993 14:55:25 GMT
  1802.  
  1803. 3 August 1993
  1804.  
  1805. CELP 3.2a Release
  1806.  
  1807. Dear CELPers,
  1808.  
  1809. We have placed an updated version of the FS-1016 CELP 3.2 code in the
  1810. anonymous FTP area on super.org.  It's in:
  1811.  
  1812.   /pub/celp_3.2a.tar.Z (please be sure to do the ftp in binary mode).
  1813.  
  1814. This is essentially the PC release that was on fumar, except that we
  1815. started directly from the PC disks.  The value added is that we have
  1816. made over 69 corrections and fixes.  Most of these were necessary
  1817. because of the 8 character file name limit on DOS, but there are some
  1818. others, as well.
  1819.  
  1820. The code (C, FORTRAN, diskio) all has been built and tested on a Sun4
  1821. under SunOS4.1.3.  If you want to run it somewhere else, then you may
  1822. have to do a bit of work.  (A Solaris 2.x-compatible release is
  1823. planned soon.)
  1824.  
  1825. [One note to PCers.  The files:
  1826. [
  1827. [       cbsearch.F celp.F csub.F mexcite.F psearch.F
  1828. [
  1829. [are meant to be passed through the C preprocessor (cpp).
  1830. [We gather that DOS (or whatever it's called) can't distinguish 
  1831. [the .F from a .f.  Be careful!
  1832.  
  1833. Very limited support is available from the authors (Joe, et al.).
  1834. Please do not send questions or suggestions without first reading the
  1835. documentation (README files, the Technical Information Bulletin, etc.).
  1836. The authors would enjoy hearing from you, but they have limited time
  1837. for support and would like to use it as efficiently as possible.  They
  1838. welcome bug reports, but, again, please read the documentation first.
  1839. All users of FS-1016 CELP software are strongly encouraged to acquire
  1840. the latest release (version 3.2a as of this writing).
  1841.  
  1842. We do not know how long we will be able to leave the software on this
  1843. site, but it should be _at_least_ through 1 October 1993 (if you find
  1844. it missing, please drop me (Craig) a note).  Please try to get the
  1845. software during off hours (8 p.m. - 7 a.m. Eastern Standard time) or
  1846. folks here might complain and we'll have to get rid of the code (if
  1847. that happens, we'll try to pass it on to someone else, who can put it
  1848. on the net).  We would be more than happy for someone to copy it and
  1849. make it available elsewhere.
  1850.  
  1851. Good Luck,
  1852.  
  1853. Craig F. Reese  (cfreese@super.org)
  1854. IDA/Supercomputing Research Center
  1855.  
  1856. Joe Campbell (jpcampb@afterlife.ncsc.mil)
  1857. Department of Defense
  1858.  
  1859. P.S.  Just so you all know, I (Craig) am not actually involved in
  1860. CELP work.  I mainly got with Joe to help make the software available
  1861. on the Internet.  In the course of doing so, I cleaned up much of it,
  1862. but I am not, by any stretch, a CELP expert and will most likely
  1863. be unable to answer any technical questions concerning it. ;^)
  1864.  
  1865. ~From: tobiasr@monolith.lrmsc.loral.com (Richard Tobias)
  1866.  
  1867. For U.S. FED-STD-1016 (4800 bps CELP) _realtime_ DSP code and
  1868. information about products using this code using the AT&T DSP32C and
  1869. AT&T DSP3210, contact:
  1870.  
  1871. White Eagle Systems Technology, Inc.
  1872. 1123 Queensbridge Way
  1873. San Jose, CA 95120
  1874. (408) 997-2706
  1875. (408) 997-3584 (fax)
  1876. rjjt@netcom.com
  1877.  
  1878. ~From: Cole Erskine <cole@analogical.com>
  1879.  
  1880. [paraphrased]
  1881.  
  1882. Analogical Systems has a _real-time_ multirate implementation of U.S.
  1883. Federal Standard 1016 CELP operating at bit rates of 4800, 7200, and
  1884. 9600 bps on a single 27MHz Motorola DSP56001. Source and object code
  1885. is available for a one-time license fee.
  1886.  
  1887. FREE, _real-time_ demonstration software for the Ariel PC-56D is
  1888. available for those who already have such a board by contacting
  1889. Analogical Systems.  The demo software allows you to record and
  1890. playback CELP files to and from the PC's hard disk.
  1891.  
  1892. Analogical Systems
  1893. 2916 Ramona Street
  1894. Palo Alto, CA 94306
  1895. Tel: +1 (415) 323-3232
  1896. FAX: +1 (415) 323-4222
  1897.  
  1898. ------------------------------------------------------------------------
  1899. Creative Voice (VOC) file format
  1900. --------------------------------
  1901.  
  1902. ~From: galt@dsd.es.com
  1903.  
  1904. (byte numbers are hex!)
  1905.  
  1906.     HEADER (bytes 00-19)
  1907.     Series of DATA BLOCKS (bytes 1A+) [Must end w/ Terminator Block]
  1908.  
  1909. - ---------------------------------------------------------------
  1910.  
  1911. HEADER:
  1912. =======
  1913.      byte #     Description
  1914.      ------     ------------------------------------------
  1915.      00-12      "Creative Voice File"
  1916.      13         1A (eof to abort printing of file)
  1917.      14-15      Offset of first datablock in .voc file (std 1A 00
  1918.                 in Intel Notation)
  1919.      16-17      Version number (minor,major) (VOC-HDR puts 0A 01)
  1920.      18-19      2's Comp of Ver. # + 1234h (VOC-HDR puts 29 11)
  1921.  
  1922. - ---------------------------------------------------------------
  1923.  
  1924. DATA BLOCK:
  1925. ===========
  1926.  
  1927.    Data Block:  TYPE(1-byte), SIZE(3-bytes), INFO(0+ bytes)
  1928.    NOTE: Terminator Block is an exception -- it has only the TYPE byte.
  1929.  
  1930.       TYPE   Description     Size (3-byte int)   Info
  1931.       ----   -----------     -----------------   -----------------------
  1932.       00     Terminator      (NONE)              (NONE)
  1933.       01     Sound data      2+length of data    *
  1934.       02     Sound continue  length of data      Voice Data
  1935.       03     Silence         3                   **
  1936.       04     Marker          2                   Marker# (2 bytes)
  1937.       05     ASCII           length of string    null terminated string
  1938.       06     Repeat          2                   Count# (2 bytes)
  1939.       07     End repeat      0                   (NONE)
  1940.       08     Extended        4                   ***
  1941.  
  1942.       *Sound Info Format:       **Silence Info Format:
  1943.        ---------------------      ----------------------------
  1944.        00   Sample Rate           00-01  Length of silence - 1
  1945.        01   Compression Type      02     Sample Rate
  1946.        02+  Voice Data
  1947.  
  1948.     ***Extended Info Format:
  1949.        ---------------------
  1950.        00-01  Time Constant: Mono: 65536 - (256000000/sample_rate)
  1951.                              Stereo: 65536 - (25600000/(2*sample_rate))
  1952.        02     Pack
  1953.        03     Mode: 0 = mono
  1954.                     1 = stereo
  1955.  
  1956.  
  1957.   Marker#           -- Driver keeps the most recent marker in a status byte
  1958.   Count#            -- Number of repetitions + 1
  1959.                          Count# may be 1 to FFFE for 0 - FFFD repetitions
  1960.                          or FFFF for endless repetitions
  1961.   Sample Rate       -- SR byte = 256-(1000000/sample_rate)
  1962.   Length of silence -- in units of sampling cycle
  1963.   Compression Type  -- of voice data
  1964.                          8-bits    = 0
  1965.                          4-bits    = 1
  1966.                          2.6-bits  = 2
  1967.                          2-bits    = 3
  1968.                          Multi DAC = 3+(# of channels) [interesting--
  1969.                                        this isn't in the developer's manual]
  1970.  
  1971. ------------------------------------------------------------------------
  1972. RIFF WAVE (.WAV) file format
  1973. ----------------------------
  1974.  
  1975. RIFF is a format by Microsoft and IBM which is similar in spirit and
  1976. functionality as EA-IFF-85, but not compatible (and it's in
  1977. little-endian byte order, of course :-).  WAVE is RIFF's equivalent of
  1978. AIFF, and its inclusion in Microsoft Windows 3.1 has suddenly made it
  1979. important to know about.
  1980.  
  1981. Rob Ryan was kind enough to send me a description of the RIFF format.
  1982. Unfortunately, it is too big to include here (27 k), but I've made it
  1983. available for anonymous ftp as ftp.cwi.nl:/pub/audio/RIFF-format.
  1984.  
  1985. The complete definition of the WAVE file format as defined by IBM and
  1986. Microsoft is available for anonymous FTP from ftp.microsoft.com, in
  1987. directory developer/MSDN/CD8 as file RIFFNE.ZIP, which contains a MS
  1988. help file (riffne.hlp).
  1989.  
  1990. ------------------------------------------------------------------------
  1991. U-LAW and A-LAW definitions
  1992. ---------------------------
  1993.  
  1994. [Adapted from information provided by duggan@cc.gatech.edu (Rick
  1995. Duggan) and davep@zenobia.phys.unsw.EDU.AU (David Perry)]
  1996.  
  1997. u-LAW (really mu-LAW) is
  1998.  
  1999.           sgn(m)   (     |m |)       |m |
  2000.    y=    ------- ln( 1+ u|--|)       |--| =< 1
  2001.          ln(1+u)   (     |mp|)       |mp|         
  2002.  
  2003. A-LAW is
  2004.  
  2005.      |     A    (m )                 |m |    1
  2006.      |  ------- (--)                 |--| =< - 
  2007.      |  1+ln A  (mp)                 |mp|    A     
  2008.    y=|
  2009.      | sgn(m) (        |m |)    1    |m |
  2010.      | ------ ( 1+ ln A|--|)    - =< |--| =< 1
  2011.      | 1+ln A (        |mp|)    A    |mp|         
  2012.  
  2013. Values of u=100 and 255, A=87.6, mp is the Peak message value, m is
  2014. the current quantised message value.  (The formulae get simpler if you
  2015. substitute x for m/mp and sgn(x) for sgn(m); then -1 <= x <= 1.)
  2016.  
  2017. Converting from u-LAW to A-LAW is in a sense "lossy" since there are
  2018. quantizing errors introduced in the conversion.
  2019.  
  2020. "..the u-LAW used in North America and Japan, and the
  2021. A-LAW used in Europe and the rest of the world and
  2022. international routes.."
  2023.  
  2024. ~References:
  2025.  
  2026. Modern Digital and Analog Communication Systems, B.P.Lathi., 2nd ed.
  2027. ISBN 0-03-027933-X
  2028.  
  2029. Transmission Systems for Communications
  2030. Fifth Edition
  2031. by Members of the Technical Staff at Bell Telephone Laboratories
  2032. Bell Telephone Laboratories, Incorporated
  2033. Copyright 1959, 1964, 1970, 1982
  2034.  
  2035. A note on the resolution of U-LAW by Frank Klemm <pfk@rz.uni-jena.de>:
  2036.  
  2037. 8 bit U-LAW has the same lowest  magnitude like 12 bit linear and 12 bit
  2038. U-LAW like 16 linear.
  2039.  
  2040. Device/Coding   Resolution              Resolution
  2041.                 on maximal level        on low level
  2042.  8 bit linear    8                       8
  2043.  8 bit ulaw      6                      12      (used for digital telephone)
  2044. 12 bit linear   12                      12
  2045. 12 bit ulaw     10                      16      (used in DAT/Longplay)
  2046. 16 bit linear   16                      16
  2047.  
  2048. estimated for some analoge technique:
  2049. tape recorder (HiFi DIN)
  2050.                  8                       9      (no Problem today)
  2051. tape recorder (semiprofessional)
  2052.                 10.5                    13.5 
  2053.  
  2054. ------------------------------------------------------------------------
  2055. AVR File Format
  2056. ---------------
  2057.  
  2058. ~From: hyc@hanauma.Jpl.Nasa.Gov (Howard Chu)
  2059.  
  2060. A lot of PD software exists to play Mac .snd files on the ST. One other
  2061. format that seems pretty popular (used by a number of commercial packages)
  2062. is the AVR format (from Audio Visual Research). This format has a 128 byte
  2063. header that looks like this:
  2064.  
  2065.         char magic[4]="2BIT";
  2066.         char name[8];           /* null-padded sample name */
  2067.         short mono;             /* 0 = mono, 0xffff = stereo */
  2068.         short rez;              /* 8 = 8 bit, 16 = 16 bit */
  2069.         short sign;             /* 0 = unsigned, 0xffff = signed */
  2070.         short loop;             /* 0 = no loop, 0xffff = looping sample */
  2071.         short midi;             /* 0xffff = no MIDI note assigned,
  2072.                                    0xffXX = single key note assignment
  2073.                                    0xLLHH = key split, low/hi note */
  2074.         long rate;              /* sample frequency in hertz */
  2075.         long size;              /* sample length in bytes or words (see rez) */
  2076.         long lbeg;              /* offset to start of loop in bytes or words.
  2077.                                    set to zero if unused. */
  2078.         long lend;              /* offset to end of loop in bytes or words.
  2079.                                    set to sample length if unused. */
  2080.         short res1;             /* Reserved, MIDI keyboard split */
  2081.         short res2;             /* Reserved, sample compression */
  2082.         short res3;             /* Reserved */
  2083.         char ext[20];           /* Additional filename space, used
  2084.                                    if (name[7] != 0) */
  2085.         char user[64];          /* User defined. Typically ASCII message. */
  2086.  
  2087. -----------------------------------------------------------------------
  2088. The Amiga MOD Format
  2089. --------------------
  2090.  
  2091. ~From: norlin@mailhost.ecn.uoknor.edu (Norman Lin)
  2092.  
  2093. MOD files are music files containing 2 parts:
  2094.  
  2095. (1) a bank of digitized samples
  2096. (2) sequencing information describing how and when to play the samples
  2097.  
  2098. MOD files originated on the Amiga, but because of their flexibility
  2099. and the extremely large number of MOD files available, MOD players
  2100. are now available for a variety of machines (IBM PC, Mac, Sparc
  2101. Station, etc.)
  2102.  
  2103. The samples in a MOD file are raw, 8 bit, signed, headerless, linear
  2104. digital data.  There may be up to 31 distinct samples in a MOD file,
  2105. each with a length of up to 128K (though most are much smaller; say,
  2106. 10K - 60K).  An older MOD format only allowed for up to 15 samples in
  2107. a MOD file; you don't see many of these anymore.  There is no standard
  2108. sampling rate for these samples.  [But see below.]
  2109.  
  2110. The sequencing information in a MOD file contains 4 tracks of
  2111. information describing which, when, for how long, and at what frequency
  2112. samples should be played.  This means that a MOD file can have up
  2113. to 31 distinct (digitized) instrument sounds, with up to 4 playing
  2114. simultaneously at any given point.  This allows a wide variety
  2115. of orchestrational possibilities, including use of voice samples
  2116. or creation of one's own instruments (with appropriate sampling
  2117. hardware/software).  The ability to use one's own samples as instruments
  2118. is a flexibility that other music files/formats do not share, and
  2119. is one of the reasons MOD files are so popular, numerous, and diverse.
  2120.  
  2121. 15 instrument MODs, as noted above, are somewhat older than 31
  2122. instrument MODs and are not (at least not by me) seen very often
  2123. anymore.  Their format is identical to that of 31 instrument MODs
  2124. except:
  2125.  
  2126. (1) Since there are only 15 samples, the information for the last (15th)
  2127.     sample starts at byte 440 and goes through byte 469.
  2128. (2) The songlength is at byte 470 (contrast with byte 950 in 31 instrument
  2129.     MOD)
  2130. (3) Byte 471 appears to be ignored, but has been observed to be 127.
  2131.     (Sorry, this is from observation only)
  2132. (4) Byte 472 begins the pattern sequence table (contrast with byte 952
  2133.     in a 31 instrument MOD)
  2134. (5) Patterns start at byte 600 (contrast with byte 1084 in 31 instrument MOD)
  2135.  
  2136. "ProTracker," an Amiga MOD file creator/editor, is available for ftp
  2137. everywhere as pt??.lzh.
  2138.  
  2139. ~From: Apollo Wong <apollo@ee.ualberta.ca>
  2140.  
  2141. ~From: M.J.H.Cox@bradford.ac.uk (Mark Cox)
  2142. ~Newsgroups: alt.sb.programmer
  2143. ~Subject: Re: Format for MOD files...
  2144. Message-ID: <1992Mar18.103608.4061@bradford.ac.uk>
  2145. ~Date: 18 Mar 92 10:36:08 GMT
  2146. Organization: University of Bradford, UK
  2147.  
  2148. wdc50@DUTS.ccc.amdahl.com (Winthrop D Chan) writes:
  2149. >I'd like to know if anyone has a reference document on the format of the
  2150. >Amiga Sound/NoiseTracker (MOD) files. The author of Modplay said he was going
  2151. >to release such a document sometime last year, but he never did. If anyone
  2152.  
  2153. I found this one, which covers it better than I can explain it - if you
  2154. use this in conjunction with the documentation that comes with Norman
  2155. Lin's Modedit program it should pretty much cover it.
  2156.  
  2157. Mark J Cox
  2158.  
  2159. /***********************************************************************
  2160.  
  2161. Protracker 1.1B Song/Module Format:
  2162. -----------------------------------
  2163.  
  2164. Offset  Bytes  Description
  2165. ------  -----  -----------
  2166.    0     20    Songname. Remember to put trailing null bytes at the end...
  2167.  
  2168. Information for sample 1-31:
  2169.  
  2170. Offset  Bytes  Description
  2171. ------  -----  -----------
  2172.   20     22    Samplename for sample 1. Pad with null bytes.
  2173.   42      2    Samplelength for sample 1. Stored as number of words.
  2174.                Multiply by two to get real sample length in bytes.
  2175.   44      1    Lower four bits are the finetune value, stored as a signed
  2176.                four bit number. The upper four bits are not used, and
  2177.                should be set to zero.
  2178.                Value:  Finetune:
  2179.                  0        0
  2180.                  1       +1
  2181.                  2       +2
  2182.                  3       +3
  2183.                  4       +4
  2184.                  5       +5
  2185.                  6       +6
  2186.                  7       +7
  2187.                  8       -8
  2188.                  9       -7
  2189.                  A       -6
  2190.                  B       -5
  2191.                  C       -4
  2192.                  D       -3
  2193.                  E       -2
  2194.                  F       -1
  2195.  
  2196.   45      1    Volume for sample 1. Range is $00-$40, or 0-64 decimal.
  2197.   46      2    Repeat point for sample 1. Stored as number of words offset
  2198.                from start of sample. Multiply by two to get offset in bytes.
  2199.   48      2    Repeat Length for sample 1. Stored as number of words in
  2200.                loop. Multiply by two to get replen in bytes.
  2201.  
  2202. Information for the next 30 samples starts here. It's just like the info for
  2203. sample 1.
  2204.  
  2205. Offset  Bytes  Description
  2206. ------  -----  -----------
  2207.   50     30    Sample 2...
  2208.   80     30    Sample 3...
  2209.    .
  2210.    .
  2211.    .
  2212.  890     30    Sample 30...
  2213.  920     30    Sample 31...
  2214.  
  2215. Offset  Bytes  Description
  2216. ------  -----  -----------
  2217.  950      1    Songlength. Range is 1-128.
  2218.  951      1    Well... this little byte here is set to 127, so that old
  2219.                trackers will search through all patterns when loading.
  2220.                Noisetracker uses this byte for restart, but we don't.
  2221.  952    128    Song positions 0-127. Each hold a number from 0-63 that
  2222.                tells the tracker what pattern to play at that position.
  2223. 1080      4    The four letters "M.K." - This is something Mahoney & Kaktus
  2224.                inserted when they increased the number of samples from
  2225.                15 to 31. If it's not there, the module/song uses 15 samples
  2226.                or the text has been removed to make the module harder to
  2227.                rip. Startrekker puts "FLT4" or "FLT8" there instead.
  2228.  
  2229. Offset  Bytes  Description
  2230. ------  -----  -----------
  2231. 1084    1024   Data for pattern 00.
  2232.    .
  2233.    .
  2234.    .
  2235. xxxx  Number of patterns stored is equal to the highest patternnumber
  2236.       in the song position table (at offset 952-1079).
  2237.  
  2238. Each note is stored as 4 bytes, and all four notes at each position in
  2239. the pattern are stored after each other.
  2240.  
  2241. 00 -  chan1  chan2  chan3  chan4
  2242. 01 -  chan1  chan2  chan3  chan4
  2243. 02 -  chan1  chan2  chan3  chan4
  2244. etc.
  2245.  
  2246. Info for each note:
  2247.  
  2248.  _____byte 1_____   byte2_    _____byte 3_____   byte4_
  2249. /                \ /      \  /                \ /      \
  2250. 0000          0000-00000000  0000          0000-00000000
  2251.  
  2252. Upper four    12 bits for    Lower four    Effect command.
  2253. bits of sam-  note period.   bits of sam-
  2254. ple number.                  ple number.
  2255.  
  2256. Periodtable for Tuning 0, Normal
  2257.   C-1 to B-1 : 856,808,762,720,678,640,604,570,538,508,480,453
  2258.   C-2 to B-2 : 428,404,381,360,339,320,302,285,269,254,240,226
  2259.   C-3 to B-3 : 214,202,190,180,170,160,151,143,135,127,120,113
  2260.  
  2261. To determine what note to show, scan through the table until you find
  2262. the same period as the one stored in byte 1-2. Use the index to look
  2263. up in a notenames table.
  2264.  
  2265. This is the data stored in a normal song. A packed song starts with the
  2266. four letters "PACK", but i don't know how the song is packed: You can
  2267. get the source code for the cruncher/decruncher from us if you need it,
  2268. but I don't understand it; I've just ripped it from another tracker...
  2269.  
  2270. In a module, all the samples are stored right after the patterndata.
  2271. To determine where a sample starts and stops, you use the sampleinfo
  2272. structures in the beginning of the file (from offset 20). Take a look
  2273. at the mt_init routine in the playroutine, and you'll see just how it
  2274. is done.
  2275.  
  2276. Lars "ZAP" Hamre/Amiga Freelancers
  2277.  
  2278. ***********************************************************************/
  2279.  
  2280. -- 
  2281. Mark J Cox -----
  2282. Bradford, UK ---
  2283.  
  2284.  
  2285. PS: A file with even *much* more info on MOD files, compiled by Lars
  2286. Hamre, is available from ftp.cwi.nl:/pub/audio/MOD-info.  Enjoy!
  2287.  
  2288.  
  2289. FTP sites for MODs and MOD players
  2290. ----------------------------------
  2291.  
  2292. ~Subject: MODS AND PLAYERS!! **READ** info/where to get them
  2293. ~From: cjohnson@tartarus.uwa.edu.au (Christopher Johnson)
  2294. ~Newsgroups: alt.binaries.sounds.d
  2295. Message-ID: <1h32ivINNglu@uniwa.uwa.edu.au>
  2296. ~Date: 21 Dec 92 00:19:43 GMT
  2297. Organization: The University of Western Australia
  2298.  
  2299. Hello world,
  2300.  
  2301. For all those asking, here is where to get those mod players and mods.
  2302.  
  2303. SNAKE.MCS.KENT.EDU is the best site for general stuff.  look in /pub/SB-Adlib
  2304.  
  2305. Simtel-20 or archie.au(simtel mirror) in <msdos.sound>
  2306.  
  2307. for windows players ftp.cica.indiana.edu in pub/pc/win3/sound
  2308.  
  2309. here is a short list of players
  2310.  
  2311. mp or modplay   BEST OVERALL                    mp219b.zip      
  2312.         simtel and snake
  2313.  
  2314. wowii           best for vga/fast machines      wowii12b.zip    
  2315.         simtel and snake
  2316.  
  2317. trakblaster     best for compatability          trak-something  
  2318.         simtel and snake        two versions, old one for slow
  2319.         machines
  2320.  
  2321. ss              cute display(hifi)              have_sex.arj
  2322.         found on local BBS (western Australia White Ghost)
  2323.  
  2324. superpro player generally good                  ssp.zip or similar
  2325.         found on night owl 7 CD
  2326.  
  2327. player?         cute display(hifi)              player.zip or similar
  2328.         found on night owl 7 CD
  2329.  
  2330. WINDOWS
  2331.  
  2332. Winmod pro      does protracker                 wmp????.zip
  2333.         cica
  2334.  
  2335. winmod          more stable                     winmod12.zip or similar
  2336.         cica
  2337.  
  2338. Hope this helps, e-mail me if you find any more players and I will add them in for the next time mod player requests get a
  2339. little out of hand.
  2340.  
  2341. for mods ftp to wuarchive.wustl.edu and go to the amiga music directory (pub/amiga/music/ntsb ?????)  that should do you for
  2342. a while
  2343.  
  2344. see you soon
  2345.  
  2346. Chris.
  2347.  
  2348. -----------------------------------------------------------------------
  2349. The Sample Vision Format
  2350. ------------------------
  2351.  
  2352. ~From: "tim.dorcas@enest.com" <KURTZ@URIACC.URI.EDU>
  2353.  
  2354. First, Sample Vision is a program used by professional musicians to
  2355. send and receive samples via a MIDI interface to the PC. While on the
  2356. PC, you can edit several parameters including loop points, pitch, time
  2357. compression, normalize, sample rate, ect.  The list of supported
  2358. samplers include: AKAI {S700,X700,S900, S950,S612,S1000/1100},
  2359. Casio{FZ1,FZ10M,FZ20M}, Ensoniq{EPS,EPS16,ASR10,Mirage},
  2360. Emu{Emax,EmaxII}, Korg{DSS1,DSM1,T workstation}, Oberheim DPX-1,
  2361. Peavey DPM-3, Roland {S10,MKS100,S220,S50,S330,S550}, Sequential
  2362. Circuits Prophet 2000/2002, Sample Dump Standard devices, Yamaha
  2363. TX16W.
  2364.  
  2365. The .smp format breaks down like this:
  2366.  
  2367. Offset     Size        Description
  2368. 000        18          'SOUND SAMPLE DATA ' ASCII FILE ID
  2369. 0018       04          '2.1 '   ASCII FILE VERSION
  2370. 0022       60          USER COMMENTS    60 ASCII CHARACTERS
  2371. 0082       30          SAMPLE NAME    LEFT JUSTIFIED 30 ASCII CHARACTERS
  2372. 0112       04          SAMPLE SIZE   SAMPLE DATA COUNT IN WORDS
  2373. 0116       ??          SAMPLE DATA  1 WORD PER SAMPLE, LEAST SIGNIFICANT BYTE
  2374.                                     FIRST, LSW FIRST; SIGNED 16 BIT INTEGERS
  2375.  
  2376. ??         02(DW)      RESERVED
  2377. ??         04(DD)      LOOP 1 START  USE SAMPLE COUNT NOT BYTE COUNT
  2378. ??         04(DD)      LOOP 1 END
  2379. ??         01(DB)      LOOP 1 TYPE   0=LOOP OFF,1=FORWARD,2=FORWARD/BACKWARD
  2380. ??         02(DW)      LOOP 1 COUNT  TIMES TO EXECUTE LOOP BEFORE NEXT LOOP
  2381.  
  2382. THERE ARE SEVEN MORE IDENTICAL LOOP STRUCTURES FOR A TOTAL OF 8
  2383.  
  2384. ??         10          MARKER 1 NAME ASCII MARKER NAME
  2385. ??         04(DD)      MARKER 1 POSITION  FFFF MEANS UNUSED
  2386.  
  2387. THER ARE SEVEN MORE IDENTICAL MARKER STRUCTURES FOR A TOTAL OF 8
  2388.  
  2389. ??         01(DB)       MIDI UNITY PLAYBACK NOTE         MIDI NOTE TO PLAY
  2390.                                                          THE SAMPLE AT ITS
  2391.                                                          ORIGINAL PITCH
  2392. ??         04(DD)       SAMPLE RATE IN HERTZ
  2393. ??         04(DD)       SMPTE OFFSET IN SUBFRAMES
  2394. ??         04(DD)       CYCLE SIZE         SAMPLE COUNT IN ONE CYCLE OF
  2395.                                            THE SAMPLED SOUND. -1 IF UNKNOWN
  2396.  
  2397. (DD) 4 BYTES, LS BYTE FIRST, LS WORD FIRST
  2398. (DW) 2 BYTES, LS BYTE FIRST
  2399. (DB) 1 BYTE
  2400.  
  2401. That's about it. One thing I have noticed is that Sample Vision only
  2402. writes seven loop structures to file as opposed to the eight
  2403. structures it claims are written.
  2404. -----------------------------------------------------------------------
  2405. Some Miscellaneous Formats
  2406. --------------------------
  2407.  
  2408. ~From: bil@ccrma.Stanford.EDU (Bill Schottstaedt)
  2409.  
  2410. I thought you might find some of this information amusing -- a few
  2411. header formats I didn't find in your great audio file formats
  2412. documentation.  Some taken from the AFsp sources, or sox, or
  2413. local ancient documentation.  I also have short descriptions
  2414. of BICSF, NeXT/Sun, AIFF, RIFF, SMP, VOC, and so on, plus
  2415. full descriptions of the 2 Sound Designer formats, if you're
  2416. interested.
  2417.  
  2418.  
  2419. /* ------------------------------------ NIST ---------------------------------
  2420.  
  2421.  * 
  2422.  
  2423.  *   0: "NIST_1A"
  2424.  *   8: data_location as ASCII representation of integer
  2425.  *      (apparently always "   1024")
  2426.  *  16: start of complicated header -- full details available upon request
  2427.  *
  2428.  *  here's an example:
  2429.  *
  2430.  *  NIST_1A
  2431.  *     1024
  2432.  *  database_id -s5 TIMIT
  2433.  *  database_version -s3 1.0
  2434.  *  utterance_id -s8 aks0_sa1
  2435.  *  channel_count -i 1
  2436.  *  sample_count -i 63488
  2437.  *  sample_rate -i 16000
  2438.  *  sample_min -i -6967
  2439.  *  sample_max -i 7710
  2440.  *  sample_n_bytes -i 2
  2441.  *  sample_byte_format -s2 01
  2442.  *  sample_sig_bits -i 16
  2443.  *  end_head
  2444.  */
  2445. /* ------------------------------------ SNDT ---------------------------------
  2446.  *
  2447.  * this taken from sndrtool.c (sox-10):
  2448.  *   0: "SOUND"
  2449.  *   6: 0x1a
  2450.  *   8-11: 0
  2451.  *  12-15: nsamples
  2452.  *  16-19: 0
  2453.  *  20-23: nsamples
  2454.  *  24-25: srate
  2455.  *  26-27: 0
  2456.  *  28-29: 10
  2457.  *  30-31: 4
  2458.  *  32-> : <filename> "- File created by Sound Exchange"
  2459.  *  .->95: 0
  2460.  */
  2461. /* ------------------------------------ ESPS ---------------------------------
  2462.  
  2463.  *
  2464.  *   16: 0x00006a1a or 0x1a6a0000
  2465.  *  136: if not 0, chans + format = 32-bit float
  2466.  *  144: if not 0, chans + format = 16-bit linear
  2467.  * 
  2468.  
  2469.  *   from AFgetInfoES.c:
  2470.  * 
  2471.  
  2472.  *       Bytes     Type    Contents
  2473.  *      8 -> 11    --     Header size (bytes)
  2474.  *     12 -> 15    int    Sampled data record size
  2475.  *     16 -> 19    int    File identifier
  2476.  *     40 -> 65    char   File creation date
  2477.  *    124 -> 127   int    Number of samples (may indicate zero)
  2478.  *    132 -> 135   int    Number of doubles in a data record
  2479.  *    136 -> 139   int    Number of floats in a data record
  2480.  *    140 -> 143   int    Number of longs in a data record
  2481.  *    144 -> 147   int    Number of shorts in a data record
  2482.  *    148 -> 151   int    Number of chars in a data record
  2483.  *    160 -> 167   char   User name
  2484.  *    333 -> H-1   --     Generic header items, including "record_freq"
  2485.  *                        {followed by a "double8"}
  2486.  *      H -> ...   --     Audio data
  2487.  */
  2488. /* ------------------------------------ INRS ---------------------------------
  2489.  
  2490.  * 
  2491.  
  2492.  *   from AFgetInfoIN.c:
  2493.  * 
  2494.  
  2495.  *    INRS-Telecommunications audio file:
  2496.  *       Bytes     Type    Contents
  2497.  *      0 ->  3    float  Sampling Frequency (VAX float format)
  2498.  *      6 -> 25    char   Creation time (e.g. Jun 12 16:52:50 1990)
  2499.  *     26 -> 29    int    Number of speech samples in the file
  2500.  *   The data in an INRS-Telecommunications audio file is in 16-bit integer
  2501.  *   format.
  2502.  * 
  2503.  
  2504.  */
  2505. /* old Mus10, SAM formats, just for completeness
  2506.  *
  2507.  * These were used for sound data on the PDP-10s at SAIL and CCRMA in the
  2508.  * 70's and 80's.
  2509.  * The word length was 36-bits.
  2510.  *
  2511.  * "New" format as used by nearly all CCRMA software pre-1990:
  2512.  *
  2513.  *  WD 0 - '525252525252
  2514.  *  WD 1 - Clock rate in Hz (PDP-10 36-bit floating point)
  2515.  *  WD 2 - #samples per word,,pack-code
  2516.  *      (has # samples per word in LH, pack-code in RH)
  2517.  *      0 for 12-bit fixed point
  2518.  *      1 for 18-bit fixed point
  2519.  *      2 for  9-bit floating point incremental
  2520.  *      3 for 36-bit floating point
  2521.  *      4 for 16-bit sambox fixed point, right justified
  2522.  *      5 for 20-bit sambox fixed point
  2523.  *      6 for 20-bit right-adjusted fixed point (sambox SAT format)
  2524.  *      7 for 16-bit fixed point, left justified
  2525.  *      N>9 for N bit bytes in ILDB format
  2526.  *  WD 3 - # channels
  2527.  *      1 for MONO
  2528.  *      2 for STEREO
  2529.  *      4 for QUAD
  2530.  *  WD 4 - Maximum amplitude (if known)
  2531.  *      is a floating point number
  2532.  *      is zero if not known
  2533.  *      is maximum magnitude (abs value) of signal
  2534.  *  WD 5        number of Sambox ticks per pass
  2535.  *              (inverse of Sambox clock rate, sort of)
  2536.  *  WD 6 - Total #samples in file.
  2537.  *         If 0 then #wds_in_file*#samps_per_wd assumed.
  2538.  *  WD 7 - Block size (if any). 0 means sound is not blocked.
  2539.  *  WDs '10-'77 Reserved for EDSND usage
  2540.  *  WDs '100-'177 Text description of file (in ASCIZ format)
  2541.  *
  2542.  *
  2543.  * "Old" format
  2544.  *
  2545.  *  WD 0 - '525252525252
  2546.  *  WD 1 - Clock rate
  2547.  *      has code in LH, actual INTEGER rate in RH
  2548.  *      code=0 for 6.4Kc (or anything else)
  2549.  *          =1 for 12.8Kc, =2 for 25.6Kc, =3 for 51.2Kc
  2550.  *          =5 for 102.4Kc, =6 for 204.8Kc
  2551.  *  WD 2 - pack
  2552.  *      0 for 12 bit
  2553.  *      1 for 16 bit (18 bit)
  2554.  *      2 for 9 bit floating point incremental
  2555.  *      3 for 36-bit floating point
  2556.  *      N>9 for N bit bytes in ILDB format
  2557.  *      has # samples per word in LH.
  2558.  *  WD 3 - # channels
  2559.  *      1 for MONO
  2560.  *      2 for STEREO
  2561.  *      4 for QUAD
  2562.  *  WD 4 - Maximum amplitude (if known)
  2563.  *      is a floating point number
  2564.  *      is zero if not known
  2565.  *      is maximum magnitude (abs value) of signal
  2566.  *  WDs 5-77 Reserved for future expansion
  2567.  *  WDs 100-177 Text description of file (in ASCIZ format)
  2568.  */
  2569.  
  2570. -----------------------------------------------------------------------
  2571. Tandy Deskmate .snd Format Notes
  2572. --------------------------------
  2573.  
  2574. ~From: Jeffrey L. Hayes <tvdog@delphi.com>
  2575.  
  2576. Tandy .snd files are created by Sound.pdm, a program that came with the 
  2577. proprietary DeskMate environment.  They are used by Music.pdm to create 
  2578. music modules (.sng files).  DeskMate Sound and Music require the Tandy 
  2579. sound chip.  There is a program to convert RIFF WAVE and other 8-bit PCM 
  2580. formats to .snd, Conv2snd, by Kenneth Udut.  Conv2snd v.2.00 comes with 
  2581. Snd2wav, which converts .snd to RIFF WAVE.
  2582.  
  2583. There are two types of DeskMate .snd files, sound files and instrument 
  2584. files.  Both contain 8-bit unsigned PCM samples.
  2585.  
  2586. Sound files are simpler.  These are garden-variety sample files with a 
  2587. fixed-length header giving the name of the sound, the recording frequency, 
  2588. and the length of the sound.  Sound files may be recorded at 5500Hz, 11kHz 
  2589. or 22kHz.
  2590.  
  2591. Instrument files contain samples as well as frequency and looping 
  2592. information used by Music.pdm to represent an instrument.  Instrument files 
  2593. provide for attack, sustain, and decay with several samples having 
  2594. different implied frequencies and being used by Music.pdm to represent the 
  2595. instrument in different pitch ranges.  Up to 16 different notes (with 16 
  2596. different samples) can be contained in one instrument file.  Instrument 
  2597. files are always recorded at 11kHz.  Both sound files and instrument files 
  2598. may be compressed in one of two ways, "music" compression or "speech" 
  2599. compression, or they may be uncompressed.  I don't know the compression 
  2600. algorithms, but simple file comparison reveals that "music" and "speech" 
  2601. compression are almost identical.
  2602.  
  2603. The DeskMate .snd file header consists of 16 bytes of fixed header 
  2604. information followed by one or more 28-byte note records.  The sample 
  2605. information, which may be compressed, follows the header.
  2606.  
  2607. DeskMate .snd File Format - Fixed Header
  2608. ----------------------------------------
  2609.  
  2610.   offset    size      what
  2611.   ------    ----      ----
  2612.  
  2613.   0         byte      1Ah (.snd ID byte)
  2614.  
  2615.   1         byte      Compression code:  0 = no compression; 1 = music
  2616.                       compression; 2 = sound compression.
  2617.  
  2618.   2         byte      Number of notes in the instrument file.  1 if sound
  2619.                       file.
  2620.  
  2621.   3         byte      Instrument number.  0 if sound file; 0FFh if instrument
  2622.                       file with no number set.  Valid instrument numbers in
  2623.                       an instrument file are 1 to 32.  Use this field to
  2624.                       distinguish a sound file from an instrument file.
  2625.  
  2626.   4         10 bytes  Sound or instrument name.  Filled on the right with
  2627.                       nulls if less than 10 characters.
  2628.  
  2629.   0Eh       word      Sampling rate in samples per second.  Note that although
  2630.                       a sampling rate other than 5500, 11000 and 22000 can be
  2631.                       entered here, Sound.pdm will not actually play at other
  2632.                       rates.
  2633.  
  2634.   10h       variable  Note records begin, 28 bytes each.  Number of records
  2635.                       given in byte 2 above.
  2636.  
  2637.  
  2638. DeskMate .snd File Format - Note Record
  2639. ---------------------------------------
  2640.  
  2641.   0         byte      Pitch of the note:  1 = A1 in American Standard Pitch;
  2642.                       2 = A#1; etc.  A1 is lowest note allowed; highest note
  2643.                       allowed is B6 (3Fh).  Sound files have 0FFh here; so do
  2644.                       instrument files with no note set.
  2645.                           Note that Sound.pdm does not designate notes in the
  2646.                       standard manner to the user.  Although A1 and B6 in
  2647.                       Sound.pdm are the same as A1 and B6 in standard pitch,
  2648.                       Sound.pdm starts octaves at A rather than at C (as is
  2649.                       standard).  Thus, middle C, C4 in standard pitch, is C3
  2650.                       in Sound.pdm.
  2651.  
  2652.   1         byte      Sound files, and instrument files with no pitch set,
  2653.                       have 0 here.  If the pitch is set, this byte is 0FFh.
  2654.  
  2655.   2         2 bytes   Range of the note, first byte is lower limit, second
  2656.                       is higher limit.  Byte encoding as for offset 0 (i.e.,
  2657.                       01h to 3Fh).  Sound files have FF FF here; so do
  2658.                       instrument files with no range set.
  2659.  
  2660.   4         dword     Offset in the file where samples for this note begin
  2661.                       (zero-relative), after compression if that was done.
  2662.  
  2663.   8         dword     If compressed, the length of the compressed data in the
  2664.                       file for this note.  Uncompressed files have 0 here.
  2665.  
  2666.   0Ch       4 bytes   Unknown.  Set to zero.
  2667.  
  2668.   10h       dword     Number of samples in the note, after decompression if
  2669.                       necessary.
  2670.  
  2671.   14h       dword     Number of sample at start of sustain region for the
  2672.                       note, relative to the first (zeroth) sample of the note.
  2673.                       For sound files, or if sustain is not set, this field is
  2674.                       0.
  2675.  
  2676.   18h       dword     Number of sample at end of sustain region for the note,
  2677.                       relative to the first (zeroth) sample of the note.  For
  2678.                       sound files, or if sustain is not set, this field is 0.
  2679.  
  2680.