I updated the AVS format document today. VAG and I believe it to be correct. But we won’t know for sure until something (maybe me, maybe someone else) creates a fresh implementation based on the information.

# Monthly Archives: December 2005

# Sound Blaster Frequency Redux

After hashing it out with Trixter in the comments of the previous post, I have seen the light regarding the Sound Blaster frequency divisor. This should be the correct formula:

frequency = 1000000 / (256 - sample_rate_divisor)

sample_rate_divisor should be treated as an unsigned quantity (0..255). Thus, as the divisor runs from 0 -> 255, the total divisor will get smaller and the output frequency will be higher. The low end is 3921 Hz and the high end is 1000000 Hz, though frequencies above 45454 Hz (divisor 234/0xEA) are unsupported by the original Sound Blaster DAC hardware.

The reason the other formula appeared to work along with the signed sample rate is that key divisors yielded similar numbers. For example, for actual sample .VOC files I have collected from various games:

Signed divisor formula:

divisor = -47 (0xD1), frequency = 21532 divisor = -45 (0xD3), frequency = 22478

Unsigned divisor formula:

divisor = 209 (0xD1), frequency = 21276 divisor = 211 (0xD3), frequency = 22222

Pretty close. The unsigned divisor formula yields the trademark “weird” SB frequencies like 22222 Hz. Plus, the unsigned formula is able to accommodate much lower frequencies.

One last point of closure: I always thought the certain weird frequencies common in the early days of PC multimedia such as 11127 Hz and 22254 Hz were artifacts of the original Sound Blaster hardware. It turns out that they were the result of Apple Macintosh hardware. Thanks to Trixter for pointing me to this page on the subject.

# Sound Blaster Frequencies

Remember when the original Creative Labs Sound Blaster was released? It was quite revolutionary for PC audio at the time since it was basically a stock AdLib FM synthesizer card and but with an 8-bit, monophonic digital to audio converter (DAC) that could output raw PCM data.

One of the more curious artifacts of the original Sound Blaster is the frequency divisor used to initialize the DAC for PCM playback.

# World’s Simplest Vector Quantizer

Vladimir “VAG” Gneushev has uncovered the world’s simplest vector quantizer codec. An FMV format named AVS was used in a 1994 CD-ROM title called *Creature Shock*. Intraframes carry a vector codebook and vector map; interframes also carry a change map. The audio chunks are actually Creative VOC chunks. Complete details are here.

The strangest thing about this particular VQ codec is that the vectors can have a dimension of 3. For example, the intraframes are comprised of 3×3 pixel vectors. 3 is not divisible by many common video frame resolutions. This game ran on IBM VGAs in 320x200x256 color mode. But the resolution of the movies was actually 318×198. Look carefully at a screenshot from the game:

*screenshot courtesy of MobyGames*

The top row, bottom row, and 2 right columns are all left undrawn.

So, who wants to implement this format first? If the inspiration strikes you, here are some sample files.