BLAS LFD Resource Type Author: Jagged Fel (jaggedfel621@gmail.com) Site: http://idmr.empirereborn.net Updated: 2009.10.05 ===== The BLAS Resource type is actually a *.VOC file (Creative Voice) within the LFD and maintains the *.VOC file structure. Because of the pre-existing file format, the structure layout will be displayed a little different. NOTE: The BLAS and VOIC resources are identical, the reason behind two different types for the same WAV format are unknown. BLAS is typically weapons and sound effect, VOIC is usually voice data. Substitute "VOIC" for "BLAS" in this file to magically create "Resource_VOIC.txt". ===== BLAS Structure The following values are used through this and all of my file definitions unless otherwise specified: NAME LENGTH DESC ---- ------ ---- BYTE 1 unsigned 8-bit CHAR 1 ASCII character SHORT 2 signed Int16 INT 4 signed Int32 -- 0x0 Header 0x10 VocHeader 0x2A VocDataBlock[] -- struct Header (size 0x10) { 0x0 CHAR[4] "BLAS" 0x4 CHAR[8] Name 0xC INT Length } struct VocHeader (size 0x1A) { 0x00 CHAR[19] "Creative Voice File" 0x13 BYTE Reserved (0x1A) 0x14 SHORT HeaderLength (0x1A) 0x16 SHORT Version (0x010A) 0x18 SHORT VersionVerify (0x1129) } struct VocDataBlock { 0x0 BYTE Type #if (Type != 0) 0x1 3BYTE Length #if (Type == 1) (Sound Data) 0x4 BYTE FrequencyDivisor 0x5 BYTE Codec 0x6 BYTE[Length-2] AudioData #elseif (Type == 6) (Repeat) 0x4 SHORT NumRepeat #endif #endif } ===== BLAS Detail For the most part, the Header is a formality, the only way to sync it into the LFD file. Since this is simply a pre-existing file format that has been placed into the LFD, the format is very reliable and is safe to use. The VocHeader is for the most part fixed. There is technically a possiblity of the Version and Verify values being different, but TIE sticks with the older version, so we don't have to worry about it. -- VocDataBlock -- The VocDataBlock array primarily consists of a single Sound Data block followed by the EOF block (00). There are a handful of resources that use the Repeat block, they all have a NumRepeat value of -1 (endless). These resources also contain the End Repeat block after the Sound Data block before EOF. There are other Type values for *.voc files, but TIE doesn't use them. The sound block is simple. The Divisor has values of 0xA1 to 0xA6 seen, the Codec is 0x00, and the Length's behaviour is normal. The sample rate of the sound is defined as 1MHz / (256 - Divisor), which gets us 10.526-11.111 KHz. Codec = 00 simply tells us that the sound data is uncompressed 8 bit PCM, which is easy enough to extract and form a wave file, or if you have a VOC reader, you can just cut up the LFD and be done with it. The only trick to the block is the damn 3-byte Length value. Go, make noises, be free. =====