home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_10 / DEVELOP.LZH / AVR_FORM.TXT next >
Text File  |  1992-10-19  |  6KB  |  137 lines

  1.                          A.V.R. PRO SERIES 16m
  2.  
  3.                              Appendix III
  4.  
  5.                          Sample Data Formats
  6.                          -------------------
  7.  
  8.         Here is a brief description of the AVR Sample format
  9.  
  10.         The first 128 Byte on an AVR sound file on diac contain a sound file
  11. header. The first BYTE or WORD immediately following the header is the first
  12. BYTE or WORD of the sound sample itself. The contents of the header are as
  13. follows
  14.  
  15.  
  16.     OFFSET    SIZE      DESCRITPTION
  17.               (BYTES)
  18.   ---------   -------   ----------------------------------------------------
  19.  
  20.     0 -   3      4      4 BYTE ASCII CHARACTER I.D. CONTAINS '2BIT'
  21.  
  22.     4 -  11      8      8 BYTE ASCII CHARACTER SAMPLE NAME
  23.                         UNUSED BYTES PADDED WITH NULL ($00).
  24.  
  25.    12 -  13      2      WORD = 0 FOR MONO $FFFF FOR STEREO SAMPLE
  26.  
  27.    14 -  15      2      WORD = SAMPLE RESOLUTION $0008 (8 BIT)
  28.                         $0010 (16 BIT)
  29.  
  30.    16 -  17      2      WORD = $0000 UNSIGNED SAMPLE
  31.                         WORD = $FFFF SIGNED SAMPLE
  32.  
  33.    18 -  19      2      WORD = $0000 NON-LOOPING SAMPLE
  34.                         WORD = $FFFF LOOPING SAMPLE
  35.  
  36.    20 -  21      2      WORD = ASSIGNED MIDI NOTE / SPLIT
  37.                         $FFFF = NO ASSIGNMENT (DEFAULT)
  38.                         $FFxx = SINGLE KEY NOTE ASSIGNMENT
  39.                         $LLHH = KEY SPLIT, TWO BYTES, NOTE LOW/NOTE HI
  40.  
  41.    22 -  25      4      LONG = SAMPLE SPEED SPLIT INTO 1 BYTE & 3 BYTES
  42.                         BYTE 22      = 0 TO 7 OR $FF
  43.                         BYTE 23 - 25 = 3 BYTE SAMPLE FREQUENCY IN HERTZ
  44.  
  45.    26 -  29      4      LONG LENGTH OF SAMPLE IN DATA BYTES OR WORDS
  46.  
  47.    30 -  33      4      LONG FIRST LOOP POINT (OFFSET IN DATA WORDS)
  48.                         FORCE $0000 IF UNUSED
  49.  
  50.    34 -  37      4      LONG END LOOP POINT (OFFSET IN DATA WORDS)
  51.                         FORCE TO SAMPLE LENGTH IF UNUSED
  52.  
  53.    38 -  39      2      - DO NOT USE - RESERVED AREA - MIDI KEYBOARD SPLIT
  54.  
  55.    40 -  41      2      - DO NOT USE - RESERVED AREA - SAMPLE COMPRESSION
  56.  
  57.    42 -  43      2      - DO NOT USE - RESERVED AREA - FILL WITH $00
  58.  
  59.    44 -  63     20      FILENAME EXTENSION. FILLED WITH $00 IF UNUSED
  60.  
  61.    64 - 127     64      FREE AREA FOR DEFINITION BY USER. MAY HAVE ASCII
  62.                         MESSAGE OR OTHER USER DEFINED DATA
  63.  
  64.   128 - EOF             -SAMPLE- Held in format described by header.
  65.  
  66.  
  67.                              Appendix - Page 13
  68.  
  69.  
  70.  
  71. This format represents a useful header which can be used to describe not
  72. only 16 Bit samples, but has the flexibility built into it to cater for
  73. MONO/STEREO and 8, 12, 14, and 16 BIT data sizes. 2-BIT SYSTEMS recommend,
  74. that users DO NOT occupy the reserved space in the first 64 BYTES of the
  75. header, the last 64 BYTES have been provided for micellanous use and abuse.
  76.  
  77. If the user is developing software which uses the AVR format, please note
  78. the following :-
  79.  
  80. When reading samples
  81. --------------------
  82.  
  83.         i) Always check for the first 4 BYTES of the sample file for '2BIT'
  84. before attempting to load in any sample from disc. If this header is found,
  85. then it can be assumed, that the smple is in AVR format, no matter what the
  86. file extension is. It is useful, though not important, to save AVR files out
  87. as XXXX.AVR.
  88.  
  89.         ii) After having established that the sample is indeed an AVR file,
  90. load the 128 BYTE header into a seperate area of memory. Interpret this header
  91. before attempting to load the rest of the file. This is important for a number
  92. of reasons, the least of which is, that if a Stereo or 16 BIT sample were just
  93. about to be loaded, the load address for the sampl block should be made on a
  94. WORD boundary.
  95.  
  96.         iii) Do not take anything for grated about the sample. Ensure, that
  97. all of the important parameters have been read and interpreted. E.G. SIGN
  98. status. If your program can only use BYTE EXCESS samples then ensure that the
  99. samples is not signed (and un-sign it if it is).
  100.  
  101.         iv) When reading the FREQUENCY long word, mask off the top 8 BITS.
  102. These bits were used in ST REPLAY, PEPLAY PROFESSIONAL and the first version
  103. of the PRO-SERIES editors. This byte took the form of a value from 0 to 7
  104. which was used to denote a fixed SYSTEM frequency (0 = 5 kHz, 7 = 48 kHz
  105. etc.). If this value is read as $FF, then the editor assumes that the
  106. sample frequency is not immediately compatible with the choice which the
  107. cartridge and EDITOR support.
  108.  
  109. When writing a file
  110. -------------------
  111.  
  112.         i) ALWAYS wipe the eintrire header area with zero's when constructing
  113. a new header.
  114.  
  115.         ii) ALWAYS force default values and never leave RUBBISH in areas
  116. unused by the program in question, remember, another program may look for
  117. DATA which is nonsense otherwise.
  118.  
  119.         iii) If looping is not used within an sample, ALWAYS force the start
  120. loop to be zero and end loop to match the sample length.
  121.  
  122.         iv) When writing the sample record frequency long word into the
  123. header, ensure that the default of $FF is placed into the top 8 BITS.
  124.  
  125. SIZES and POINTER OFFSETS
  126. -------------------------
  127.  
  128.         Please note the use of the phrase 'WORD size' when expressing the
  129. size of a sample or the offset of the loop pointers from the start of the
  130. sample. It is assumed that if the sample is an 8 BIT sample (or less), then
  131. the WORD size is BYTE. If the sample is greater that 8 BITS then the size is
  132. assumed to be a 16 BIT data WORD. Hence a 16 BIT file size of 10000 words
  133. would actually be 20000 BYTES in length. The value stored in the header
  134. should be 10000.
  135.  
  136.                              Appendix - Page 14
  137.