home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / alt / sb / programm / 426 < prev    next >
Encoding:
Text File  |  1992-11-09  |  8.0 KB  |  251 lines

  1. Path: sparky!uunet!psgrain!ee.und.ac.za!shrike.und.ac.za!shrike.und.ac.za!mahlknec
  2. From: mahlknec@shrike.und.ac.za (Gregory Mahlknecht)
  3. Newsgroups: alt.sb.programmer
  4. Subject: Re: HELP: .wav or .voc file formats
  5. Date: 8 Nov 1992 22:36:40 GMT
  6. Organization: University of Natal (Durban), South Africa
  7. Lines: 239
  8. Message-ID: <1dk4poINNqlv@shrike.und.ac.za>
  9. NNTP-Posting-Host: shrike.und.ac.za
  10. X-Newsreader: Tin 1.1 PL4
  11.  
  12. pdavies@alchemy.chem.utoronto.ca (Paul Davies) writes:
  13.  
  14. >I have been looking for a document that details the .voc or .wav file
  15. >formats and I can't find one.  If someone could tell me or at least
  16. >point me to a source I'd really appreciate it.
  17.  
  18. >thanks,
  19.  
  20. I have it all in Norton Guide format, and extracted it to a file, and here it 
  21. is (If you have a fit of enthusiasm, you could compile it and make a norton
  22. Guide for yourself)...
  23.  
  24. ------ CUT HERE ------
  25.  
  26. !short:^BCreative Voice File (VOC) Format^B
  27.  
  28.  The Creative Voice file is organized into two main blocks, the Header
  29.  Block and Data Block. The Header Block contains identifier, version number
  30.  and pointer to the start of the Data Block.
  31.  
  32.  The Data Block is divided into various sub-blocks of various types such as
  33.  Voice Data, Silence, ASCII text, Repeat and End Repeat, and Terminator.
  34.  
  35.  The CT-VOICE driver only processes the Data Block. It is important that
  36.  you pass the address of the Data Block and not the Voice File when calling
  37.  the driver to perform voice output.
  38.  
  39. !short:   Header Block
  40.  ^BHeader Block^B
  41.  
  42.  ─────────┬─────────────────────────────────────────────────────────────────
  43.   Offset  │ Description
  44.  ─────────┼─────────────────────────────────────────────────────────────────
  45.   00h-13h │ ^UFile type description.^U
  46.           │ The following message is stored here: "Creative Voice File",1Ah
  47.           │
  48.   14h-15h │ ^UOffset of Data Block from the start of the voice file^U
  49.           │ This word points to the Data Block. It helps the application
  50.           │ programs to locate the Data Block in case the size of header
  51.           │ block is changed.  For this version, the value here is always
  52.           │ 1A hex.
  53.           │
  54.   16h-17h │ ^UVoice file format version number^U
  55.           │ This version number allows your program to identify different
  56.           │ organization formats of voice data file in case of future
  57.           │ enhancement. LSB and MSB are the minor and major version number
  58.           │ respectively.  Current version is 1.10.
  59.           │
  60.   18h-19h │ ^UVoice file identification code^U
  61.           │ This code allows your program to check that this file is a VOC
  62.           │ file.
  63.           │
  64.           │ Its content is the complement of the file format version number
  65.           │ then plus 1234 hex.  For current version of 1.10, its complement
  66.           │ (010Ah) +1234h = 1129h
  67. ──────────┴──────────────────────────────────────────────────────────────────
  68.  
  69. !seealso: "Data Block"
  70.  
  71. !short:   Data Block
  72.  ^BData Block^B
  73.  
  74.  The Data Block is sub-divided into multiple sub-blocks of data.
  75.  
  76.  a)  The first byte of each sub-block is called the Block Type (BLKTYPE).
  77.       It indicates the type of data contained in the sub-block.
  78.  
  79.  b)  The next three bytes is the 24-bit Block Length (BLKLEN). It is the
  80.       number of bytes in the sub-block _excluding_ the BLKTYPE and BLKLEN
  81.       fields. Only the Terminator sub-block does not have a BLKLEN field.
  82.  
  83.  c)  Depending on BLKTYPE, the rest of the data in the sub-block may be
  84.       voice attributes (such as sampling rate and packing), voice data or
  85.       other information (such as Marker and ASCII text).
  86.  
  87.  Your program needs not interpret all the BLKTYPE. For those BLKTYPEs it
  88.  does not recognizem it can move to next sub-block based on the BLKLEN
  89.  easily.  In most of the applications, your program can simply pass the
  90.  address of the Data Block to the CT-VOICE driver which will interpret the
  91.  Voice file and perform the output accordingly.
  92.  
  93. !seealso: "Header Block" "Type 0"
  94.  
  95. !short:      Type 0          Terminator
  96.  ^BType 0 : Terminator^B
  97.  
  98.  ┌────┐
  99.  │ 00 │
  100.  └────┘
  101.  
  102.  This 1-byte sub-block terminates the entire Data Block. It indicates that
  103.  there is no other sub-block after it. CT-VOICE driver terminates voice
  104.  output when this BLKTYPE is encountered.
  105.  
  106.  This BLKTYPE must be the last block in the voice file.
  107.  
  108. !seealso: "Type 4"
  109.  
  110. !short:      Type 1          Voice Data
  111.  ^BType 1 : Voice Data^B
  112.  
  113.  ┌────┬──┬──┬──┬────┬──────┬─----------─┐
  114.  │ 01 │ BLKLEN │ SR │ PACK │ VOICE DATA │
  115.  └────┴──┴──┴──┴────┴──────┴─----------─┘
  116.  
  117.  This BLKTYPE indicates that this sub-block is a new set of voice data. It
  118.  may use different sampling rate or packing method.
  119.  
  120.  The SR field(1 byte) is the Sampling Rate. It is defined as
  121.  
  122.     SR = 256 - 1000000/sampling rate
  123.  
  124.  For instance, if the sampling rate is 10,000 Hz, SR is set to 156.
  125.  
  126.  The PACK field (1 byte) is the Packing method used for this sub-block of
  127.  voice data. It is defined as:
  128.  
  129.   ╔══════╤════════════════════════╗
  130.   ║ PACK │ Description            ║
  131.   ╠══════╪════════════════════════╣
  132.   ║   0  │ 8-bit raw or unpacked  ║
  133.   ║   1  │ 4-bit packed           ║
  134.   ║   2  │ 2.6-bit packed         ║
  135.   ║   3  │ 2-bit packed           ║
  136.   ╚══════╧════════════════════════╝
  137.  
  138.  The voice data length is calculated as follows:
  139.  
  140.    voice data length = BLKLEN - 2
  141.  
  142. !seealso: "Type 2"
  143.  
  144. !short:      Type 2          Voice Continuation
  145.  ^BType 2 : Voice Continuation^B
  146.  
  147.  ┌────┬──┬──┬──┬─----------─┐
  148.  │ 02 │ BLKLEN │ VOICE DATA │
  149.  └────┴──┴──┴──┴─----------─┘
  150.  
  151.  This sub-block is a continuation of the voice data from the last Voice
  152.  Data sub-block.
  153.  
  154.  The length of the voice data is BLKLEN.
  155.  
  156. !seealso: "Type 1"
  157.  
  158. !short:      Type 3          Silence
  159.  ^BType 3 : Silence^B
  160.  
  161.  ┌────┬──┬──┬──┬───┬───┬────┐
  162.  │ 03 │ BLKLEN │ PERIOD│ SR │
  163.  └────┴──┴──┴──┴───┴───┴────┘
  164.  
  165.  This sub-block defines silence period in the voice data.
  166.  
  167.  The length of the silence period (period, 2 bytes) is stored after the
  168.  BLKLEN field in units of sampling cycle. Its value is one less than the
  169.  silence period. The sampling rate (SR) is defined as above.
  170.  
  171.  The BLKLEN for this sub-block is always 3.
  172.  
  173. !seealso: "Type 1" "Type 2" "Type 0"
  174.  
  175. !short:      Type 4          Marker
  176.  ^BType 4 : Marker^B
  177.  
  178.  ┌────┬──┬──┬──┬───┬───┐
  179.  │ 04 │ BLKLEN │ MARKER│
  180.  └────┴──┴──┴──┴───┴───┘
  181.  
  182.  This is a special sub-block that specifies a Marker (MARKER, 2 bytes) in
  183.  the voice data.
  184.  
  185.  During voice output, the CT-VOICE driver updates the status word
  186.  ct_voice_status with this marker value. Your program may check for the
  187.  desired MARKER value to perform synchronization with the voice output
  188.  process.
  189.  
  190.  The Marker value must be within the range of 1 to 0FFFE hex. Note that 0
  191.  and FFFF hex are reserved by the CT-VOICE driver. Also refer to the
  192.  following section Essentials of using the CT-VOICE driver.
  193.  
  194.  The BLKLEN field is always set to 2.
  195.  
  196. !seealso: "Type 5"
  197.  
  198. !short:      Type 5          ASCII Text
  199.  ^BType 5 : ASCII Text^B
  200.  
  201.  ┌────┬──┬──┬──┬──--------──┬──────┐
  202.  │ 05 │ BLKLEN │ ASCII DATA │ NULL │
  203.  └────┴──┴──┴──┴──--------──┴──────┘
  204.  
  205.  This sub-block specifies a null-terminated ASCII string in the voice data
  206.  file.
  207.  
  208.  Most programs choose to ignore this BLKTYPE. It is defined for a program
  209.  which requires ASCII information on the voice such as name, type or
  210.  remarks on the voice data.
  211.  
  212. !seealso: "Type 4"
  213.  
  214. !short:      Type 6          Repeat Loop
  215.  ^BType 6 : Repeat Loop^B
  216.  
  217.  ┌────┬──┬──┬──┬───┬───┐
  218.  │ 06 │ BLKLEN │ COUNT │
  219.  └────┴──┴──┴──┴───┴───┘
  220.  
  221.  This sub-block specifies the beginning of a repeat loop. The data
  222.  sub-blocks between this block and the next End-Repeat Loop sub-block is
  223.  repeated by the CT-VOICE driver for (COUNT+1) times.
  224.  
  225.  The COUNT (2 bytes) field takes a value from 1 to FFFE hex as a loop
  226.  count. If COUNT is FFFF hex, then it is to be an endless loop. In this
  227.  case, refer to the following section Reference fir SBC Voice functions on
  228.  how to break out of the endless loop.
  229.  
  230.  The BLKLEN field is always 2.
  231.  
  232. !seealso: "Type 7"
  233.  
  234. !short:      Type 7          End Repeat Loop
  235.  ^BType 7 : End Repeat Loop^B
  236.  
  237.  ┌────┬──┬──┬──┐
  238.  │ 07 │ BLKLEN │
  239.  └────┴──┴──┴──┘
  240.  
  241.  This sub-block specifies the end of a Repeat Loop. Refer to Block Type 6
  242.  for details.
  243.  
  244.  The BLKLEN field is always 0.
  245.  
  246. !seealso: "Type 6"
  247.  
  248. --------- CUT HERE -------
  249.  
  250.   - Greg
  251.