home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / FAQSYS18.ZIP / FAQS.DAT / AUDIO.309 < prev    next >
Internet Message Format  |  1995-12-12  |  112KB

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