

PSIONICS FILE - SOUND.FMT

=========================

Format of Sound files

Last modified 1994-04-22

========================



Sound files hold recorded sounds, and can only be used by the Series 3a. The

sound is played at 8000 entries per second. The file uses A-Law encoding.



A sound file begins with a 32 byte header of the following form:

  Offset  0 (cstr): "ALawSoundFile**"

  Offset 16 (word): format version number

  Offset 18 (long): number of samples in the file

  Offset 22 (word): length of silence (in 1/32 seconds) to append on playback

  Offset 24 (word): number of times to repeat on playback (0 and 1 both mean

                    play once)



The rest of the file is sound samples. Each byte is a value encoded using

A-Law to represent 13 bit values. The most significant bit is the sign, and

the other 7 bits represent a 12 bit amplitude (note that this is a sign-and-

magnitude representation, not a twos-complement one):



    S000XXXX -> S0000000XXXX1

    S001XXXX -> S0000001XXXX1

    S010XXXX -> S000001XXXX10

    S011XXXX -> S00001XXXX100

    S100XXXX -> S0001XXXX1000

    S101XXXX -> S001XXXX10000

    S110XXXX -> S01XXXX100000

    S111XXXX -> S1XXXX1000000



When encoding values, the bits marked i are ignored:



    S000XXXX <- S0000000XXXXi

    S001XXXX <- S0000001XXXXi

    S010XXXX <- S000001XXXXii

    S011XXXX <- S00001XXXXiii

    S100XXXX <- S0001XXXXiiii

    S101XXXX <- S001XXXXiiiii

    S110XXXX <- S01XXXXiiiiii

    S111XXXX <- S1XXXXiiiiiii

