+==========================================================================================+ |Keen 1-3 sound format: | +==========================================================================================+ The conversion from Keen frequenc to wave frequency is complicated, for most purposes using a mono 44'100Hz wave file, 1 'tick' of gametime data (1/128s) is equal to about 375 bytes of wave data with a frequency of $0030 (48) representing a change in tone every wave-byte. Frrequency is INVERSE, meaning the larger the number, the lower the tone. (Try and think of it as listing how long it takes for a tone to change.) Sound tones are at three levels; quiet (0) medium and max (255) Sound is generated by switching between two tones at varying frequencies. ------------------------------------------------------------------------------- FILE STRUCTURE: HEADER SOUND HEADER SOUND HEADER .... ... SOUND DATA SOUND DATA .... ... ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- FILE HEADER: 0 4 Identifier SND + $00; indicates the start of a sound file 4 2 Filesize Size of file, from SND to end of last sound 6 2 ??? Always $3C $00 8 2 Sndnum Number of sounds in file 10 6 Spacer Padded with nuls 16 16 Snd head Sound header entries ------------------------------------------------ SOUND HEADER: (1 per sound) ? 2 Location Location of sound start relative to "SND" start of sound information above +2 1 Priority Whether or not sound will be interrupted by another sound if said sound starts playing while the first is. Sounds can only be interrupted by sounds that have an equal or higher value of this. 255 is max, 0 is inadvisable +3 1 Validater If a sound is a 'placeholder' to be ignored, this is 1, if it is a proper sound it is 8 +4 12 Name Sound name, padded with nuls. not really functional ------------------------------------------------ ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- SOUND DATA (Can be used by many or no sounds, whatever) ? 2x Data Consists of 2-byte values between $0000-$FFFE, indicating INVERSE frequency played for 1/128s (tick) of gametime. In-game capability is for values between $0030 and $3000 with 0 being no tone played (Quiet) ? 2 End $FF $FF, indicates to stop playing sound ------------------------------------------------------------------------------- +------------------------------------------------------------------------------------------+ |Crystal Caves sound format: | +------------------------------------------------------------------------------------------+ This sound format seems similar to Keen, but less well understood. I am not sure about the exact relation between frequency, pitch and sound data, so this should only be used as a rough guideline. Here sounds are of a fixed length, 600 bytes, except the first which is 610. Sounds are padded with nuls to make them the required length and have an 'extra' terminator at their end. This overcomes the need for a sound file header, but imposes restrictions in that a sound cannot be more than 3 seconds long. ------------------------------------------------------------------------------- FILE STRUCTURE: SOUND 1 SOUND 2 ... .. SOUND 12 FOOTER ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- SOUNDS: 0 ? SND 1 First sound entry, made up, like Keen 1-3 2-byte of INVERSE frequency data. 610 bytes long total. ? 2 End 1.1 Sound terminator, $FF $FF, stops playing sound +2 ? Spacer Nuls bytes to make the sound the required length ? 2 End 1.2 Nonfunctional terminator at end of first sound space +2 600 SND Remaining sounds, each 600 bytes long total 7310 10 Footer Soundfile footer ------------------------------------------------ REMAINING SOUNDS: ? ? SND Sound data ? 2 End 1.1 Sound terminator, $FF $FF, stops playing sound +2 ? Spacer Nuls bytes to make the sound the required length ? 2 End 1.2 Nonfunctional terminator at end of first sound space ------------------------------------------------ ------------------------------------------------ FOOTER: (This data is vital, if only to pad space) ? 2 ? Unknown, often small number +2 2 ? x thousand (E.g 6'000) unknown function +4 2 ? $02 $00 +6 4 ? $F8 $58 $8B $D7 ------------------------------------------------ -------------------------------------------------------------------------------