Hocus Pocus SFX Format
The SFX format is used by Hocus Pocus to store PC Speaker sound effects.
The files have no header and consist entirely of INT16LE values. Each INT16LE value stores a sound frequency in Hertz, which is played through the PC Speaker by using the sound() function, which is present in many progamming tools, including Borland C and Turbo Pascal.
The sounds are played at a rate of 140 Hz, so the game sends a new frequency to the PC Speaker 140 times per second. But only every fourth frequency value is ever played.
The sound playback works pretty much like this:
140 times per second DO BEGIN IF sound_is_active THEN BEGIN sound(frequencies[sound_index]); sound_index := sound_index + 4; IF (sound_index >= sound_length) THEN BEGIN nosound(); sound_is_active := FALSE; END; END; END;
This file format was reverse engineered by K1n9_Duk3. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)