Z Sound Format
Sampled sound effects and speech in Z are stored in headerless RAW files. Playback metadata is supplied separately by sound lists.
File format
The viewer interprets the usual samples as unsigned 8-bit PCM. Silence is 128. Mono files store successive samples; stereo playback uses interleaved channels. There is no RIFF header, embedded sample rate, or reliable magic number.
Use the sound-list entry to choose the rate and channel count. Duration is byteLength / (sampleRate * channels) for eight-bit samples. To export WAV, add a PCM RIFF/WAVE header with the actual rate and channel count; do not include that header in a RAW replacement.
Notes
A .RAW extension alone does not encode the rate. The asset viewer allows alternate interpretation settings; those controls do not prove that all encodings occur in the original files.
Source code
From re-z, the open-source browser port:
- src/viewer/formats.js – soundList and waveFile
- src/viewer/main.js – RAW audition settings
- src/game/sound.js – sample setup
Credits
This file format was reverse engineered by VorticonCmdr. 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!)