home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / sound2 / audio_fm.zip / A1 next >
Text File  |  1993-05-11  |  43KB  |  964 lines

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