home *** CD-ROM | disk | FTP | other *** search
/ gdead.berkeley.edu / gdead.berkeley.edu.tar / gdead.berkeley.edu / pub / gdead / sounds / AudioFormats.part1 < prev    next >
Text File  |  1993-04-19  |  41KB  |  946 lines

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