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.