home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Today - The Disc! 2 / CD-ROM_Today_-_The_Disc_2_June-July_1994.iso / mmtools / audio1.txt next >
Text File  |  1993-03-21  |  42KB  |  957 lines

  1.  
  2. Xref: nuchat alt.binaries.sounds.misc:7049 alt.binaries.sounds.d:3006 comp.dsp:5557 news.answers:6856
  3. Path: nuchat!menudo.uh.edu!tamsun.tamu.edu!cs.utexas.edu!sun-barr!ames!olivea!uunet!mcsun!sun4nl!cwi.nl!guido
  4. From: guido@cwi.nl (Guido van Rossum)
  5. Newsgroups: alt.binaries.sounds.misc,alt.binaries.sounds.d,comp.dsp,news.answers,comp.answers
  6. Subject: FAQ: Audio File Formats (part 1 of 2)
  7. Message-ID: <audio-part1_732799652@charon.cwi.nl>
  8. Date: 22 Mar 93 11:27:37 GMT
  9. Expires: 19 Apr 93 11:27:32 GMT
  10. Sender: news@cwi.nl
  11. Reply-To: guido@cwi.nl
  12. Followup-To: alt.binaries.sounds.d,comp.dsp
  13. Lines: 934
  14. Approved: news-answers-request@MIT.Edu
  15. Supersedes: <audio-part1_728731079@charon.cwi.nl>
  16.  
  17. Archive-name: audio-fmts/part1
  18. Submitted-by: Guido van Rossum <guido@cwi.nl>
  19. Version: 3.01
  20. Last-modified: 22-Mar-1993
  21.  
  22. FAQ: Audio File Formats
  23. =======================
  24.  
  25. Table of contents
  26. -----------------
  27.  
  28. Introduction
  29. Device characteristics
  30. Popular sampling rates
  31. Compression schemes
  32. Current hardware
  33. File formats
  34. File conversions
  35. Playing audio files on UNIX
  36. Playing audio files on micros
  37. The Sound Site Newsletter
  38. Posting sounds
  39.  
  40. Appendices (in part 2):
  41.  
  42. FTP access for non-internet sites
  43. AIFF Format (Audio IFF)
  44. The NeXT/Sun audio file format
  45. IFF/8SVX Format
  46. Playing sound on a PC
  47. The EA-IFF-85 documentation
  48. US Federal Standard 1016 availability
  49. Creative Voice (VOC) file format
  50. RIFF WAVE (.WAV) file format
  51. U-LAW and A-LAW definitions
  52. AVR File Format
  53. The Amiga MOD Format
  54.   
  55.  
  56. Introduction
  57. ------------
  58.  
  59. This is version 3 of this FAQ, which I started in November 1991 under
  60. the name "The audio formats guide".  I bumped the major version number
  61. again at the occasion of the split in two parts: part one is the main
  62. text and part two consists of the collection of appendices.
  63.  
  64. I am posting this about once a fortnight, either unchanged (just to
  65. inform new readers), or updated (if I learn more or when new hardware
  66. or software becomes popular).  I post to alt.binaries.sounds.{misc,d}
  67. and to comp.dsp, for maximal coverage of people interested in audio,
  68. and to {news,comp}.answers, for easy reference.
  69.  
  70. The entire FAQ is also available by anonymous ftp from ftp.cwi.nl
  71. [192.16.184.180], directory pub/audio, files AudioFormats{part1,part2}.
  72.  
  73. A companion posting with subject "Changes to: ..." is occasionally
  74. posted listing the diffs between a new version and the last.  This is
  75. not reposted, and it is suppressed when the diffs are bigger than the
  76. new version.
  77.  
  78. This FAQ is also available in distributed hypertext form.  If you have
  79. a WWW browser and direct Internet access you can point it to
  80. "http://voorn.cwi.nl/audio-formats/a00.html".  (WWW is the CERN
  81. World-Wide Web initiative; for more info, telnet or ftp to
  82. info.cern.ch.)  You can also ftp the files from ftp.cwi.nl, directory
  83. /pub/www/audio-formats/.   This may sometimes be somewhat out
  84. of sync with the posted version of the FAQ.
  85.  
  86. Send updates, comments and questions to <guido@cwi.nl>.  I'd like to
  87. thank everyone who sent updates in the past.
  88.  
  89. --Guido van Rossum, CWI, Amsterdam <guido@cwi.nl>
  90.  
  91.  
  92. Device characteristics
  93. ----------------------
  94.  
  95. In this text, I will only use the term "sample" to refer to a single
  96. output value from an A/D converter, i.e., a small integer number
  97. (usually 8 or 16 bits).
  98.  
  99. Audio data is characterized by the following parameters, which
  100. correspond to settings of the A/D converter when the data was
  101. recorded.  Naturally, the same settings must be used to play the data.
  102.  
  103. - sampling rate (in samples per second), e.g. 8000 or 44100
  104.  
  105. - number of bits per sample, e.g. 8 or 16
  106.  
  107. - number of channels (1 for mono, 2 for stereo, etc.)
  108.  
  109. Approximate sampling rates are often quoted in Hz or kHz ([kilo-]
  110. Hertz), however, the politically correct term is samples per second
  111. (samples/sec).  Sampling rates are always measured per channel, so for
  112. stereo data recorded at 8000 samples/sec, there are actually 16000
  113. samples in a second.  I will sometimes write 8 k as a shorthand for
  114. 8000 samples/sec.
  115.  
  116. Multi-channel samples are generally interleaved on a frame-by-frame
  117. basis: if there are N channels, the data is a sequence of frames,
  118. where each frame contains N samples, one from each channel.  (Thus,
  119. the sampling rate is really the number of *frames* per second.)  For
  120. stereo, the left channel usually comes first.
  121.  
  122. The specification of the number of bits for U-LAW (pronounced mu-law
  123. -- the u really stands for the Greek letter mu) samples is somewhat
  124. problematic.  These samples are logarithmically encoded in 8 bits,
  125. like a tiny floating point number; however, their dynamic range is
  126. that of 14 bit linear data.  Source for converting to/from U-LAW
  127. (written by Jef Poskanzer) is distributed as part of the SOX package
  128. mentioned below; it can easily be ripped apart to serve in other
  129. applications.  The official definition is the CCITT standard G.711.
  130.  
  131. There exists another encoding similar to U-LAW, called A-LAW, which
  132. is used as a European telephony standard.  There is less support for
  133. it in UNIX workstations.
  134.  
  135. (See the Appendix for some formulae describing U-LAW and A-LAW.)
  136.  
  137.  
  138. Popular sampling rates
  139. ----------------------
  140.  
  141. Some sampling rates are more popular than others, for various reasons.
  142. Some recording hardware is restricted to (approximations of) some of
  143. these rates, some playback hardware has direct support for some.  The
  144. popularity of divisors of common rates can be explained by the
  145. simplicity of clock frequency dividing circuits :-).
  146.  
  147. Samples/sec     Description
  148.  
  149. 5500            One fourth of the Mac sampling rate (rarely seen).
  150.  
  151. 7333            One third of the Mac sampling rate (rarely seen).
  152.  
  153. 8000            Exactly 8000 samples/sec is a telephony standard that
  154.                 goes together with U-LAW (and also A-LAW) encoding.
  155.                 Some systems use an slightly different rate; in
  156.                 particular, the NeXT workstation uses 8012.8210513,
  157.                 apparently the rate used by Telco CODECs.
  158.  
  159. 11 k            Either 11025, a quarter of the CD sampling rate,
  160.                 or half the Mac sampling rate (perhaps the most
  161.                 popular rate on the Mac).
  162.  
  163. 16000           Used by, e.g. the G.722 compression standard.
  164.  
  165. 18.9 k          CD-ROM/XA standard.
  166.  
  167. 22 k            Either 22050, half the CD sampling rate, or the Mac
  168.                 rate; the latter is precisely 22254.545454545454 but
  169.                 usually misquoted as 22000.  (Historical note:
  170.                 22254.5454... was the horizontal scan rate of the
  171.                 original 128k Mac.)
  172.  
  173. 32000           Used in digital radio, NICAM (Nearly-Instantaneous
  174.                 Companded Audio Multiplex [IBA/BREMA/BBC]) and other
  175.                 TV work, at least in the UK; also long play DAT and
  176.                 Japanese HDTV.
  177.  
  178. 37.8 k          CD-ROM/XA standard for higher quality.
  179.  
  180. 44056           This weird rate is used by professional audio
  181.                 equipment to fit an integral number of samples in a
  182.                 video frame.
  183.  
  184. 44100           The CD sampling rate.  (DAT players recording
  185.                 digitally from CD also use this rate.)
  186.  
  187. 48000           The DAT (Digital Audio Tape) sampling rate for
  188.                 domestic use.
  189.  
  190. Files samples on SoundBlaster hardware have sampling rates that are
  191. divisors of 1000000.
  192.  
  193. While professinal musicians disagree, most people don't have a problem
  194. if recorded sound is played at a slightly different rate, say, 1-2%.
  195. On the other hand, if recorded data is being fed into a playback
  196. device in real time (say, over a network), even the smallest
  197. difference in sampling rate can frustrate the buffering scheme used...
  198.  
  199. There may be an emerging tendency to standardize on only a few
  200. sampling rates and encoding styles, even if the file formats may
  201.  
  202. differ.  The suggested rates and styles are:
  203.  
  204.     rate (samp/sec) style mono/stereo
  205.  
  206.     8000 8-bit U-LAW mono
  207.     22050 8-bit linear unsigned mono and stereo
  208.     44100 16-bit linear signed mono and stereo
  209.  
  210.  
  211. Compression schemes
  212. -------------------
  213.  
  214. Strange though it seems, audio data is remarkably hard to compress
  215. effectively.  For 8-bit data, a Huffman encoding of the deltas between
  216. successive samples is relatively successful.  For 16-bit data,
  217. companies like Sony and Philips have spent millions to develop
  218. proprietary schemes.  Information about PASC (Philips' scheme) can be
  219. found in Advanced Digital Audio by Ken C. Pohlmann.
  220.  
  221. Public standards for voice compression are slowly gaining popularity,
  222. e.g. CCITT G.721 and G.723 (ADPCM at 32 and 24 kbits/sec).  (ADPCM ==
  223. Adaptive Delta Pulse Code Modulation.)  Free source code for a *fast*
  224. 32 kbits/sec ADPCM algorithm is available by ftp from ftp.cwi.nl as
  225. /pub/adpcm.shar.  (** NOTE: if you are using v1.0, you should get
  226. v1.1, released 17-Dec-1992, which fixes a serious bug -- the quality
  227. of v1.1 is claimed to be better than uLAW **)
  228.  
  229. GSM 06.10 is a speech encoding in use in Europe that compresses 160
  230. 13-bit samples into 260 bits (or 33 bytes), i.e. 1650 bytes/sec (at
  231. 8000 samples/sec).  A free implementation can be ftp'ed from
  232. tub.cs.tu-berlin.de, file /pub/tubmik/gsm-1.0.tar.Z.
  233.  
  234. There are also two US federal standards, 1016 (Code excited linear
  235. prediction (CELP), 4800 bits/s) and 1015 (LPC-10E, 2400 bits/s).  See
  236. also the appendix for 1016.
  237.  
  238. (Note that U-LAW and silence detection can also be considered
  239. compression schemes.)
  240.  
  241. Here's a note about audio codings by Van Jacobson <van@ee.lbl.gov>:
  242. Several people used the words "LPC" and "CELP" interchangably.  They
  243. are very different.  An LPC (Linear Predictive Coding) coder fits
  244. speech to a simple, analytic model of the vocal tract, then throws
  245. away the speech & ships the parameters of the best-fit model.  An LPC
  246. decoder uses those parameters to generate synthetic speech that is
  247. usually more-or-less similar to the original.  The result is
  248. intelligible but sounds like a machine is talking.  A CELP (Code
  249. Excited Linear Predictor) coder does the same LPC modeling but then
  250. computes the errors between the original speech & the synthetic model
  251. and transmits both model parameters and a very compressed
  252. representation of the errors (the compressed representation is an
  253. index into a 'code book' shared between coders & decoders -- this is
  254. why it's called "Code Excited").  A CELP coder does much more work
  255. than an LPC coder (usually about an order of magnitude more) but the
  256. result is much higher quality speech: The FIPS-1016 CELP we're working
  257. on is essentially the same quality as the 32Kb/s ADPCM coder but uses
  258. only 4.8Kb/s (the same as the LPC coder).
  259.  
  260. The comp.compression FAQ has some text on the 6:1 audio compression
  261. scheme used by MPEG (a video compression standard-to-be).  It's
  262. interesting to note that video compression reaches much higher ratios
  263. (like 26:1).  This FAQ is ftp'able from rtfm.mit.edu [18.72.1.58] in
  264. directory /pub/usenet/news.answers/compression-faq, files part1 and
  265. part2.
  266.  
  267. Comp.compression also carries a regular posting "How to uncompress
  268. anything" by David Lemson <lemson@uiuc.edu>, which (tersely) hints on
  269. which program you need to uncompress a file whose name ends in .<foo>
  270. for almost any conceivable <foo>.  Ftp'able from ftp.cso.uiuc.edu
  271. (128.174.5.59) in the directory /doc/pcnet as the file compression.
  272.  
  273. Documentation on a digital cellular telephone system by Qualcomm Inc.
  274. can be ftp'ed from ftp.qualcomm.com:/pub/cdma; the vocoder is in
  275. appendix A.
  276.  
  277. Apple has an Audio Compression/Expansion scheme called ACE (on the GS)
  278. / MACE (on the Macintosh).  It's a lossy scheme that attempts to
  279. predict where the wave will go on the next sample. There's very little
  280. quality change on 8:4 compression, somewhat more for 8:3.  It does
  281. guarantee exactly 50% or 62.5% compression, though.  I believe MACE
  282. uses larger ratios/more loss, but I'm unsure of the specific numbers.
  283. (Marc Sira)
  284.  
  285.  
  286. Current hardware
  287. ----------------
  288.  
  289. I am aware of the following computer systems that can play back and
  290. (sometimes) record audio data, with their characteristics.  Note that
  291. for most systems you can also buy "professional" sampling hardware,
  292. which supports much better quality, e.g. >= 44.1 k 16 bits stereo.
  293. The characteristics listed here are a rough estimate of the
  294. capabilities of the basic hardware only (and even here I am on thin
  295. ice, with systems becoming ever more powerful).
  296.  
  297. machine             bits            max sampling rate    #output channels
  298.  
  299. Mac (all types)     8               22k                  1
  300. Mac (newer ones)   16               64k                  4(128)
  301. Apple IIgs          8               32k / >70k           16(st)
  302. PC/Soundblaster v1  8               13k / 22k            1
  303. PC/Soundblaster v2  8               15k / 44.1k          1
  304. PC/PAS-16           16              44.1k                ?(st)
  305. Atari ST            8               22k                  1
  306. Atari STe,TT        8               50k                  2
  307. Atari Falcon 030    16              50k                  8(st)
  308. Amiga               8               varies above 29k     4(st)
  309. Sun Sparc           U-LAW           8k                   1
  310. Sun Sparcst. 10     U-LAW,8,16      48k                  1(st)
  311. NeXT                U-LAW,8,16      44.1k                1(st)
  312. SGI Indigo          8,16            48k                  4(st)
  313. SGI Indigo2         8,16            48k                  16(st,4-channel)
  314. Acorn Archimedes    ~U-LAW          ~180k                8(st)
  315. Sony RISC-NEWS      8, 16           37.8k                ?(st)
  316. VAXstation 4000     U-LAW           8k                   1
  317. DEC 3000/300-500    U-LAW           8k                   1
  318. Tandy 1000/*L*      8               22k                  3
  319. HP9000/705,710,425e U,A-LAW,16      8k                   1
  320. HP9000/715,725,735  U,A-LAW,16      48k                  1(st)
  321. HP9000/755 option:  U,A-LAW,16      48k                  1(st)
  322.  
  323. 4(st) means "four voices, stereo"; sampling rates xx/yy are
  324. different recording/playback rates; *L* is any type with 'L' in it.
  325.  
  326. All these machines can play back sound without additional hardware,
  327. although the needed software is not always standard; only the Sun,
  328. NeXT and SGI come with standard sampling hardware (the NeXT only
  329. samples U-LAW at 8000 samples/sec from the built-in microphone port;
  330. you need a separate board for other rates).  (Don't send me details on
  331. optional or 3rd party hardware, there is too much and it is really
  332. beyond the scope of this FAQ.)
  333.  
  334. The new VAXstation 4000 (VLC and model 60) series lets you PLAY audio
  335. (.au) files, and the package DECsound will let you do the recording.
  336. In fact, DECsound is given away free with Motif 1.1 and supports the
  337. VAXstation, Sun SPARCstation, DECvoice, and XMedia audio devices.  Sun
  338. sound files work without change.  The Alpha systems (DEC 3000 Model
  339. 300, 400, 500) also have DECsound bundled with Motif.
  340.  
  341. The SGI Personal IRIS 4D/30 and 4D/35 have the same capabilities as
  342. the Indigo. The audio board was optional on the 4D/30.
  343. The Indigo2 features are a superset of the Indigo features.
  344.  
  345. The new Apple Macs have more powerful audio hardware; the latest
  346. models have built-in microphones.
  347.  
  348. Software exists for the PC that can play sound on its 1-bit speaker
  349. using pulse width modulation (see appendix); the Soundblaster board
  350. records at rates up to 13 k and plays back up to 22 k (weird
  351. combination, but that's the way it is).
  352.  
  353. Here's some info about the newest Atari machine, the Falcon030.  This
  354. machine has stereo 16 bit CODECs and a 32 MHz Motorola 56001 that can
  355. handle 8 channels of 16 bit audio, up to 50 khz/channel with
  356.  
  357. simultaneous playback and record.  The Falcon DMA sound engine is also
  358. compatible with the 8 bit stereo DMA used on the STe and TT. All of
  359. these systems use signed data.
  360.  
  361. On the NeXT, the Motorola 56001 DSP chip is programmable and you can
  362. (in principle) do what you want.  The SGI Indigo uses the same DSP chip but
  363. it can't be programmed by users -- SGI prefers to offer it as a shared
  364. system resource to multiple applications, thus enabling developers to
  365. program audio with their Audio Library and avoid code modifications
  366. for execution on future machines with different audio hardware, i.e. a
  367. different DSP. For example, the Indigo2 does not have a DSP chip.
  368.  
  369. The Amiga also has a 6-bit volume, which can be used to produce
  370. something like a 14-bit output for each voice.  The hardware can also
  371. use one of each voice-pair to modulate the other in FM (period) or AM
  372. (volume, 6-bits).
  373.  
  374. The Acorn Archimedes uses a variation on U-LAW with the bit order
  375. reversed and the sign bit in bit 0.  Being a 'minority' architecture,
  376. Arc owners are quite adept at converting sound/image formats from
  377. other machines, and it is unlikely that you'll ever encounter sound in
  378. one of the Arc's own formats (there are several).
  379.  
  380. CD-I machines form a special category.  The following formats are used:
  381.  
  382.      - PCM 44.1 kHz standard CD format
  383.      - ADPCM - Addaptive Delta PCM
  384.        - Level A 37.8 kHz 8-bit
  385.        - Level B 37.8 kHz 4-bit
  386.        - Level C 18.9 kHz 4-bit
  387.  
  388.  
  389. File formats
  390. ------------
  391.  
  392. Historically, almost every type of machine used its own file format
  393. for audio data, but some file formats are more generally applicable,
  394. and in general it is possible to define conversions between almost any
  395. pair of file formats -- sometimes losing information, however.
  396.  
  397. File formats are a separate issue from device characteristics.  There
  398. are two types of file formats: self-describing formats, where the
  399. device parameters and encoding are made explicit in some form of
  400. header, and "raw" formats, where the device parameters and encoding
  401. are fixed.
  402.  
  403. Self-describing file formats generally define a family of data
  404. encodings, where a header fields indicates the particular encoding
  405. variant used.  Headerless formats define a single encoding and usually
  406. allows no variation in device parameters (except sometimes sampling
  407. rate, which can be a pain to figure out other than by listening to the
  408. sample).
  409.  
  410. The header of self-describing formats contains the parameters of the
  411. sampling device and sometimes other information (e.g. a
  412. human-readable description of the sound, or a copyright notice).  Most
  413. headers begin with a simple "magic word".  (Some formats do not simply
  414. define a header format, but may contain chunks of data intermingled
  415. with chunks of encoding info.)  The data encoding defines how the
  416. actual samples are stored in the file, e.g. signed or unsigned, as
  417. bytes or short integers, in little-endian or big-endian byte order,
  418. etc.  Strictly spoken, channel interleaving is also part of the
  419. encoding, although so far I have seen little variation in this area.
  420.  
  421. Some file formats apply some kind of compression to the data, e.g.
  422. Huffman encoding, or simple silence deletion.
  423.  
  424. Here's an overview of popular file formats.
  425.  
  426.         Self-describing file formats
  427.         ----------------------------
  428.  
  429. extension, name   origin          variable parameters (fixed; comments)
  430.  
  431. .au or .snd       NeXT, Sun       rate, #channels, encoding, info string
  432. .aif(f), AIFF     Apple, SGI      rate, #channels, sample width, lots of info
  433. .aif(f), AIFC     Apple, SGI      same (extension of AIFF with compression)
  434. .iff, IFF/8SVX    Amiga           rate, #channels, instrument info (8 bits)
  435. .voc              Soundblaster    rate (8 bits/1 ch; can use silence deletion)
  436. .wav, WAVE        Microsoft       rate, #channels, sample width, lots of info
  437. .sf               IRCAM           rate, #channels, encoding, info
  438. none, HCOM        Mac             rate (8 bits/1 ch; uses Huffman compression)
  439. none, MIME        Internet        (see below)
  440. .mod or .nst      Amiga           (see below)
  441.  
  442. Note that the filename extension ".snd" is ambiguous: it can be either
  443. the self-describing NeXT format or the headerless Mac/PC format, or
  444. even a headerless Amiga format.
  445.  
  446. I know nothing for sure about the origin of HCOM files, only that
  447. there are a lot of them floating around on our system and probably at
  448. FTP sites over the world.  The filenames usually don't have a ".hcom"
  449. extension, but this is what SOX (see below) uses.  The file format
  450. recognized by SOX includes a MacBinary header, where the file
  451. type field is "FSSD".  The data fork begins with the magic word "HCOM"
  452. and contains Huffman compressed data; after decompression it it is 8
  453. bits unsigned data.
  454.  
  455. IFF/8SVX allows for amplitude contours for sounds (attack/decay/etc).
  456. Compression is optional (and extensible); volume is variable; author,
  457. notes and copyright properties; etc.
  458.  
  459. AIFF, AIFC and WAVE are similar in spirit but allow more freedom in
  460. encoding style (other than 8 bit/sample), amongst others.
  461.  
  462. There are other sound formats in use on Amiga by digitizers and music
  463. programs, such as IFF/SMUS.
  464.  
  465. Appendices describes the NeXT and VOC formats; pointers to more info
  466. about AIFF, AIFC, 8SVX and WAVE (which are too complex to describe
  467. here) are also in appendices.
  468.  
  469. DEC systems (e.g. DECstation 5000) use a variant of the NeXT format
  470. that uses little-endian encoding and has a different magic number
  471. (0x0064732E in little-endian encoding).
  472.  
  473. Standard file formats used in the CD-I world are IFF but on the disc
  474. they're in realtime files.
  475.  
  476. An interesting "interchange format" for audio data is described in the
  477. proposed Internet Standard "MIME", which describes a family of
  478. transport encodings and structuring devices for electronic mail.  This
  479. is an extensible format, and initially standardizes a type of audio
  480. data dubbed "audio/basic", which is 8-bit U-LAW data sampled at 8000
  481. samples/sec.
  482.  
  483. Finally, a somewhat different but popular format are "MOD" files,
  484. usually with extension ".mod" or ".nst" (they can also have a prefix
  485. of "mod.").  This originated at the Amiga but players now exist for
  486. many platforms.  MOD files are music files containing 2 parts: (1) a
  487. bank of digitized samples; (2) sequencing information describing how
  488. and when to play the samples.  See the appendix "The Amiga MOD Format"
  489. for a description of this file format (and pointers to ftp'able
  490. players and example MOD files).
  491.  
  492.         Headerless file formats
  493.         -----------------------
  494.  
  495. extension       origin          parameters
  496. or name
  497.  
  498. .snd, .fssd     Mac, PC         variable rate, 1 channel, 8 bits unsigned
  499. .ul             US telephony    8 k, 1 channel, 8 bit "U-LAW" encoding
  500. .snd?           Amiga           variable rate, 1 channel, 8 bits signed
  501.  
  502. It is usually easy to distinguish 8-bit signed formats from unsigned
  503. by looking at the beginning of the data with 'od -b <file | head';
  504. since most sounds start with a little bit of silence containing small
  505. amounts of background noise, the signed formats will have an abundance
  506. of bytes with values 0376, 0377, 0, 1, 2, while the unsigned formats
  507. will have 0176, 0177, 0200, 0201, 0202 instead.  (Using "od -c" will
  508. also show any headers that are tacked in front of the file.)
  509.  
  510. The Apple IIgs records raw data in the same format as the Mac, but
  511. uses a 0 byte as a terminator; samples with value 0 are replaced by 1.
  512.  
  513.         Sound formats and the Apple Macintosh
  514.         -------------------------------------
  515.  
  516. (Thanks to Bill Houle, <Bill.Houle@SanDiegoCA.NCR.COM>)
  517.  
  518.                              SOX/DOS   MAC
  519. Sound Format           file ext  type  Mac program: convert to 'snd'
  520. ---------------------- --------  ----  ------------------------------
  521.  
  522. Mac snd                .snd      sfil  n/a
  523. Amiga IFF/8SVX         .iff            AmigaSndConverter
  524. Amiga SoundTracker     .mod      STrk  ModVoicer
  525. Audio IFF              .aiff     AIFF  SoundExtractor, Sample Editor,
  526. UUTool
  527. DSP Designer                     DSPs  SoundHack
  528. IRCAM                  .sf       IRCM  SoundHack
  529. MacMix                           MSND  SoundHack
  530. RIFF WAVE              .wav            SoundExtractor
  531. SoundBlaster           .voc            SoundExtractor
  532. SoundDesigner/AudioMedia         Sd2f  SoundHack
  533. Sound[Edit|Cap|Wave]   .hcom     FSSD  SoundExtractor, SoundEdit
  534. Wavicle
  535. Sun uLaw/Next .snd     .au/.snd  NxTS  SoundExtractor, SoundHack
  536. au<->snd, UUTool
  537.  
  538.  
  539. File conversions
  540. ----------------
  541.  
  542.         SOX (UNIX, PC, Amiga)
  543.         ---------------------
  544.  
  545. The most versatile tool for converting between various audio formats
  546. is SOX ("Sound Exchange").  It can read and write various types of
  547. audio files, and optionally applies some special effects (e.g. echo,
  548. channel averaging, or rate conversion).
  549.  
  550. SOX recognizes all filename extensions listed above except ".snd",
  551. which would be ambiguous anyway, and ".wav" (but there's a patch, see
  552. below).  Use type ".au" for NeXT ".snd" files.  Mac and PC ".snd"
  553. files are completely described by these parameters:
  554.  
  555.         -t raw -b -u -r 11000
  556.  
  557. (or -r 22000 or -r 7333 or -r 5500; 11000 seems to be the most common
  558. rate).
  559.  
  560. The source for SOX, version 6, platchlevel 8, was posted to
  561. alt.sources, and should be widely archived.  (Patch 9 was posted later
  562. and incporporates some important .wav fixes.)  To save you the trouble
  563. of hunting it down, it can be gotten by anonymous ftp from
  564. wuarchive.wustl.edu, in the directory usenet/alt.sources/articles,
  565. files 7288.Z through 7295.Z.  (These files are compressed news
  566. articles containing shar files, if you hadn't guessed.)  I am sure
  567. many sites have similar archives, I'm just listing one that I know of
  568. and which carries a lot of this kind of stuff.  (Also see the appendix
  569. if you don't have Internet access.)
  570.  
  571. A compressed tar file containing the same version of SOX is available
  572. by anonymous ftp from ftp.cwi.nl [192.16.184.180], in directory
  573. /pub/audio/sox7.tar.Z.  You may be able to locate a nearer version
  574. using archie!
  575.  
  576. Ports of SOX:
  577.  
  578. - The source as posted should compile on any UNIX and PC system.
  579.  
  580. - A PC version is available by ftp from ftp.cwi.nl (see above) as
  581.   pub/audio/sox5dos.zip; also available from the garbo mail server.
  582.  
  583. - The latest Amiga SOX is available via anonymous ftp to
  584.   wuarchive.wustl.edu, files systems/amiga/audio/utils/amisox*.  (See
  585.   below for a non-SOX solution.)
  586.   The final release of r6 will compile as distributed on the Amiga with
  587.   SAS/C version 6.  Binaries (since many Amiga users do not own
  588.   compilers) will continue to be available for FTP.
  589.  
  590. SOX usage hints:
  591.  
  592. - Often, the filename extension of sound files posted on the net is
  593.   wrong.  Don't give up, try a few other possibilities using the
  594.   "-t <type>" option.  Remember that the most common file type is
  595.   unsigned bytes, which can be indicated with "-t ub".  You'll have to
  596.   guess the proper sampling rate, but often it's 11k or 22k.
  597.  
  598. - In particular, with SOX version 4 (or earlier), you have to
  599.   specify "-t 8svx" for files with an .iff extension.
  600.  
  601. - When converting linear samples to U-LAW using the .au type for the
  602.   output file, you must specify "-U" for the output file, otherwise
  603.   you will end up with a file containing a NeXT/Sun header but linear
  604.   samples -- only the NeXT will play such files correctly.  Also, you
  605.   must explicitly specify an output sampling rate with "-r 8000".
  606.   (This may seem fixed for most cases in version 5, but it is still
  607.   occasionally necessary, so I'm keeping this warning in.)
  608.  
  609.         Sun Sparc
  610.         ---------
  611.  
  612. On Sun Sparcs, starting at SunOS 4.1, a program "raw2audio" is
  613. provided by Sun (in /usr/demo/SOUND -- see below) which takes a raw
  614. U-LAW file and turns it into a ".au" file by prefixing it with an
  615. appropriate header.
  616.  
  617.         NeXT
  618.         ----
  619.  
  620. On NeXTs, you can usually rename .au files to .snd and it'll work like
  621. a charm, but some .au files lack header info that the NeXT needs.
  622. This can be fixed by using sndconvert:
  623.  
  624.         sndconvert -c 1 -f 1 -s 8012.8210513 -o nextfile.snd sunfile.au
  625.  
  626.         SGI Indigo and Personal IRIS
  627.         ----------------------------
  628.  
  629. SGI supports "soundfiler" (in /usr/sbin), a program similar in
  630. spirit to SOX but with a GUI.  Soundfiler plays aiff, aifc, NeXT/Sun
  631. and .wav formats.  It can do conversions between any of these formats
  632. and to and from raw formats including mulaw.  It also does sample rate
  633. conversions.
  634.  
  635. Three shell commands are also provided that give the same functionality:
  636. "sfplay", "sfconvert", and "aifcresample" (all in /usr/sbin).
  637.  
  638.         Amiga
  639.         -----
  640.  
  641. Mike Cramer's SoundZAP can do no effects except rate change and it
  642. only does conversions to IFF, but it is generally much faster than
  643. SOX.  (Ftp'able from the same directory as amisox above.)
  644.  
  645. Newer versions of OmniPlay (see below) will also convert to IFF.
  646.  
  647.         Tandy
  648.         -----
  649.  
  650. The Tandy 1000 uses a (proprietary?) compressed format.  There is a
  651. PD Mac to Tandy conversion program called CONVERT.
  652.  
  653.         Apple Macintosh
  654.         ---------------
  655.  
  656. Bill Houle sent the following list:
  657.  
  658. SoundHack, Tom Erbe: can read/write Sound Designer II, Audio IFF,
  659. IRCAM, DSP Designer and NeXT .snd (or Sun .au); 8-bit uLaw, 8-bit
  660. linear, 32-bit floating point and 16-bit linear data encoding.  Can
  661. read (but not write) raw data files.  Implements soundfile
  662. convolution, a phase vocoder, a binaural filter and an amplitude
  663. analysis & gain change module.
  664.  
  665. AmigaSndConverter, Povl H. Pederson: converts Amiga IFF/8SVX to Mac 'snd'.
  666.  
  667. SoundExtractor, Alberto Ricci: extracts 'snd' resources, AIFF, SoundEdit,
  668. VOC, and WAV data from practically anything, converting to 'snd' files.
  669.  
  670. au<->Mac, Victor J. Heinz: converts Sun uLaw files to Mac 'snd' files.
  671.  
  672. UUTool, Bernie Wieser: primarily a uuencode/decode program, but can
  673. also read/write Sun uLaw, AIFF, and 'snd' files.
  674.  
  675. ModVoicer, Kip Walker: converts Amiga MOD voices into SoundEdit files
  676. or 'snd' resources.
  677.  
  678. Most programs mentioned are shareware/freeware available from SUMEX
  679. and the various mirror sites, or check archie for the nearest FTP
  680. site.
  681.  
  682.  
  683. Playing audio files on UNIX
  684. ---------------------------
  685.  
  686. The commands needed to play an audio file depend on the file format
  687. and the available hardware and software.  Most systems can only
  688. directly play sound in their native format; use a conversion program
  689. (see above) to play other formats.
  690.  
  691.         Sun Sparcstation running SunOS 4.x
  692.         ----------------------------------
  693.  
  694. Raw U-LAW files can be played using "cat file >/dev/audio".
  695.  
  696. A whole package for dealing with ".au" files is provided by Sun on an
  697. experimental basis, in /usr/demo/SOUND.  You may have to compile the
  698. programs first.  (If you can't find this directory, either you are not
  699. running SunOS 4.1 yet, or your system administrator hasn't installed
  700. it -- go ask him for it, not me!)  The program "play" in this
  701. directory recognizes all files in Sun/NeXT format, but a SS 1 or 2 can
  702. play only those using U-LAW encoding at 8 k -- the SS 10 hardware
  703. plays other encodings, too.
  704.  
  705. If you ca't find "play", you can also cat a ".au" file to /dev/audio,
  706. if it uses U-LAW; the header will sound like a short burst of noise
  707. but the rest of the data will sound OK (really, the only difference in
  708. this case between raw U-LAW and ".au" files is the header; the U-LAW
  709. data is exactly the same).
  710.  
  711. Finally, OpenWindows 3.0 has a full-fledged audio tool.  You can drop
  712. audio file icons into it, edit them, etc.
  713.  
  714.         Sun Sparcstation running Solaris 2.0
  715.  
  716.         ------------------------------------
  717.  
  718. Under SVR4 (and hence Solaris 2.0), writing to /dev/audio from the
  719. shell is a bad idea, because the device driver will flush its queue as
  720. soon as the file is closed.  Use "audioplay" instead.  The supported
  721. formats and sampling rates are the same as above.
  722.  
  723.         NeXT
  724.         ----
  725.  
  726. On NeXT machines, the standard "sndplay" program can play all NeXT
  727. format files (this include Sun ".au" files).  It supports at least
  728. U-LAW at 8 k and 16 bits samples at 22 or 44.1 k.  It attempts
  729. on-the-fly conversions for other formats.
  730.  
  731. Sound files are also played if you double-click on them in the file
  732. browser.
  733.  
  734.         SGI Indigo and Personal IRIS
  735.         ----------------------------
  736.  
  737. On SGI Indigo, Indigo2 and the 4D/30 and /35 Personal IRIS workstations,
  738. "WorkSpace" plays audio files in .aiff, .aifc, .au, and .wav formats if
  739. you double click them and the sampling rate is one of 8000, 11025,
  740. 16000, 22050, 32000, 44100, or 48000.  On the Personal IRIS, you need
  741. to have the audio board installed (check the output from hinv) and you
  742. must run IRIX 3.3.2 or 4.0 or higher.  These files can also be played
  743. with "soundfiler" and "sfplay".  ".aiff" and ".aifc" files at the above
  744. sampling rates can also be played with playaifc.  (All in /usr/sbin)
  745.  
  746. There is no simple /dev/audio interface on these SGI machines.  (There
  747. was one on 4D/25 machines, reading and writing signed linear 8-bit
  748. samples at rates of 8, 16 and 32 k.)
  749.  
  750. A program "playulaw" was posted as part of the "radio 2.0" release
  751. that I posted to several source groups recently; it plays raw U-LAW
  752. files on the Indigo, Indigo2 or Personal IRIS audio hardware.
  753.  
  754.         Sony NEWS
  755.         ---------
  756.  
  757. The Sony RISC-NEWS line (NWS-3250 laptop, NWS-37xx desktop, NWS-38xx
  758. desktop w/ IOP) also has builtin sound capabilities.  You can also buy
  759. external boards for the older NEWS machines or to add extra channels
  760. to the new machines.  In the default mode (8k/8-bit), Sun .au files
  761. are directly supported (you can 'cat' .au files to /dev/sb and have
  762. them play).
  763.  
  764.         Vaxstation 4000
  765.         ---------------
  766.  
  767. ".au" files can be played by COPYING them to device "SOA0:".  This
  768. device is set up by enabling the driver SODRIVER.  You can use the
  769. following command file:
  770.  
  771. $!---------------- cut here -------------------------------
  772. $! sound_setup.com    enable SOUND driver
  773. $ run sys$system:sysgen
  774. connect soa0 /adapter=0 /csr=%x0e00 /vector=%o304 /driver=sodriver
  775. exit
  776. $ exit
  777. $!----------------- cut here ------------------------------------
  778.  
  779. The external audio port comes with a telephone-jack-like port.   For
  780. starters, you can plug a telephone RECEIVER right into this port to
  781. hear your first sound files.   After that, you can use the adapter
  782. (that came with the VaxStation), and plug in a small set of stereo
  783. speakers (the kind you'd plug into a WALKMAN, for example), for more
  784. volume.
  785.  
  786.         Others
  787.         ------
  788.  
  789. Most other UNIX boxes don't have audio hardware and thus can't play
  790. audio data.  This is actually rapidly changing and most new hardware
  791. that hits the market has some form of audio support.  Unfortunately
  792. there is nothing like X11 that provides a portable interface.  Perhaps
  793. DEC CRL's AudioFile system can fill the gap; it is network-transparent
  794. and supports at least Digital RISC systems running Ultrix, Digital
  795. Alpha AXP systems running OSF/1, and Sun Microsystems SPARCstations
  796. running SunOS.  The source kit is located at ftp site crl.dec.com
  797. (Internet 192.58.206.2) in /pub/DEC/AF.
  798.  
  799.  
  800. Playing audio files on micros
  801. -----------------------------
  802.  
  803. Most micros have at least a speaker built in, so theoretically all you
  804. need is the right software.  Unfortunately most systems don't come
  805. bundled with sound-playing software, so there are many public domain
  806. or shareware software packages, each with their own bugs and features.
  807. Most separate sound recording hardware also comes with playing
  808. software, most of which can play sound (in the file format used by
  809. that hardware) even on machines that don't have that hardware
  810. installed.
  811.  
  812.         PC or compatible
  813.         ----------------
  814.  
  815. Chris S. Craig announces the following software for PCs:
  816.  
  817. ScopeTrax       This is a complete PC sound player/editor package.  Sounds
  818.                 can be played back at ANY rate between 1kHz to 65kHz through
  819.                 the PC speaker or the Sound Blaster.  It supports several
  820.                 file formats including VOC, IFF/8SVX, raw signed and raw
  821.                 unsigned.  A separate executable is provided to convert
  822.                 .au and mu-law to raw format.  ScopeTrax requires EGA/VGA
  823.                 graphics for editing and displaying sounds on a REALTIME
  824.                 oscilloscope.  The package also includes:
  825.                       * An expanded memory player which can play sounds
  826.                         larger than 640K in size.
  827.                       * Basic (rough) sound compression/uncompression
  828.                         utilities.
  829.                       * Complete documentation.
  830.                 The package is FREEWARE!  It is available on SIMTEL in the
  831.                 PD1:[MSDOS.SOUND] directory.
  832.  
  833. One of the appendices below contains a list of more programs to play
  834. sound on the PC.
  835.  
  836.         Atari
  837.         -----
  838.  
  839. For sounds on Atari STs - programs are in the atari/sound/players
  840. directory on atari.archive.umich.edu (141.211.164.8).
  841.  
  842.         Tandy
  843.         -----
  844.  
  845. On a Tandy 1000, sounds can be played and recorded with DeskMate Sound
  846. (SOUND.PDM), or if they not stored in compressed format, they can also
  847. be played be a program called PLAYSND.  No indication of whether
  848. PLAYSND is PD or not. It hasn't been updated since March of 89.
  849.  
  850.         Amiga
  851.         -----
  852.  
  853. On the Amiga, OmniPlay by David Champion <dgc3@midway.uchicago.edu>
  854. plays and converts IFF-8SVX, AIFF, WAV, VOC, .au, .snd, and 8 bit raw
  855. (signed, unsigned, u-law) samples.  As of version 1.23, OmniPlay will
  856. also convert any playable sample to 8SVX.  Files: wuarchive.wustl.edu
  857. in /systems/amiga/audio/sampleplayers/oplay123.lha (?)
  858. amiga.physik.unizh.ch in mus/play/oplay123.lha
  859.  
  860.         Apple Macintosh
  861.         ---------------
  862.  
  863. Malcolm Slaney from Apple writes:
  864.  
  865.  "We do have tools to play sound back on most of our Unix hosts.  We wrote
  866.  a program called TcpPlay that lets us read a sound file on a Unix host,
  867.  open a TCP/IP connection to the Mac on my desk, and plays the file.  We
  868.  think of it as X windows for sound (at least a step in that direction.)
  869.  
  870.  This software is available for anonymous FTP from ftp.apple.com.
  871.  Look for  ~ftp/pub/TcpPlay/TcpPlay.sit.hqx.
  872.  
  873.  Finally, there are MANY tools for working with sound on the Macintosh. Three
  874.  applications that come to mind immediately are SoundEdit (formerly by
  875.  Farralon and now by MacroMind/Paracomp), Alchemy and Eric Keller's Signalyze.
  876.  There are lots of other tools available for sound editing (including some
  877.  of the QuickTime Movie tools.)"
  878.  
  879. Bill Houle sent the following lists:
  880.  
  881. EDITORS:
  882.  
  883. Sample Editor, Garrick McFarlane: plays AIFF and 'snd' sounds.  Can convert
  884. between AIFF and 'snd'.  Can record from built-in mic.  Can add effects such
  885. as fade, normalize, delay, etc.
  886.  
  887. Wavicle, Lee Fyock: plays SoundEdit files.  Can convert to 'snd'.  Can record
  888. from built-in mic.  Can add effects such as fade, filter, reverb, etc.
  889.  
  890. [*]SoundEdit, Farallon: plays SoundEdit and 'snd' sounds.  Can read/write 
  891. SoundEdit files and 'snd' sounds.  Can record from built-in mic.  Can add 
  892. effects such as echo, filter, reverb, etc.
  893.  
  894. PLAYERS:
  895.  
  896. The Player, Antoine Rosset & Mike Venturi: plays AIFF, SoundEdit, MOD, and 
  897. 'snd' files.
  898.  
  899. SoundMaster (aka [*]Kaboom!), Bruce Tomlin: associates SoundEdit files to 
  900. MacOS events.
  901.  
  902. SndControl, Riccardo Ettore: associates 'snd' sounds to MacOS events.
  903.  
  904.  
  905. Most programs mentioned are shareware/freeware available from SUMEX
  906. and the various mirror sites, or check archie for the nearest FTP
  907. site.  Popular commercial apps are indicated with a [*].
  908.  
  909.  
  910. The Sound Site Newsletter
  911. -------------------------
  912.  
  913. An electronic publication with lots of info about digitised sound and
  914. sound formats, albeit mostly on micros, is "The Sound Site
  915. Newsletter".  Issue 12 appeared in March 1993.  Issues can be ftp'ed
  916. from saffron.inset.com, directory directory pub/rogue/newsletters, or
  917. from ccb.ucsf.edu, Pub/Sound_list/Sound.Newsletters.
  918.  
  919.  
  920. Posting sounds
  921. --------------
  922.  
  923. The newsgroup alt.binaries.sounds.misc is dedicated to postings
  924. containing sound.  (Discussions related to such postings belong in
  925. alt.binaries.sounds.d.)
  926.  
  927. There is no set standard for posting sounds; uuencoded files in most
  928. popular formats are welcome, if split in parts under 50 kBytes.  To
  929. accomodate automatic decoding software (such as the ":decode" command
  930. of the nn newsreader), please place a part indicator of the form
  931. (mm/nn) at the end of your subject meaning this is number mm of a
  932. total of nn part.
  933.  
  934. It is recommended to post sounds in the format that was used for the
  935. original recording; conversions to other formats often lose
  936. information and would do people with identical hardware as the poster
  937. no favor.  For instance, convering 8-bit linear sound to U-LAW loses
  938. the lower few bits of the data, and rate changing conversions almost
  939. always add noise.  Converting from U-LAW to linear requires expansion
  940. to 16 bit samples if no information loss is allowed!
  941.  
  942. U-LAW data is best posted with a NeXT/Sun header.
  943.  
  944. If you have to post a file in a headerless format (usually 8-bit
  945. linear, like ".snd"), please add a description giving at least the
  946. sampling rate and whether the bytes are signed (zero at 0) or unsigned
  947. (zero at 0200).  However, it is highly recommended to add a header
  948. that indicates the sampling rate and encoding scheme; if necessary you
  949. can use SOX to add a header of your choice to raw data.
  950.  
  951. Compression of sound files usually isn't worth it; the standard
  952. "compress" algorithm doesn't save much when applied to sound data
  953. (typically at most 10-20 percent), and compression algorithms
  954. specifically designed for sound (e.g. NeXT's) are usually
  955. proprietary.  (See also the section "Compression schemes" earlier.)
  956.  
  957.