The VHDR chunk of a 16SV file has the layout of the 8SVX voice header, the Voice8Header:
20 bytes, all numbers big-endian, required, and before the BODY chunk. SoundBox’s description of 16SV says
that all chunk types exist and that the values in the chunks, “e.g. in VHDR”, always refer to samples and not to offsets (bytes).
Fields
Offsets are from the start of the chunk’s data. The chunk’s size is 20.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | u32 | oneShotHiSamples | the number of samples (not bytes) in the one-shot part of the highest octave |
| 4 | 4 | u32 | repeatHiSamples | the number of samples in the repeating part of the highest octave |
| 8 | 4 | u32 | samplesPerHiCycle | the average number of samples per cycle in the highest octave, or 0 if unknown |
| 12 | 2 | u16 | samplesPerSec | the sample rate in hertz |
| 14 | 1 | u8 | ctOctave | the number of octaves stored |
| 15 | 1 | u8 | sCompression | 0, no compression: below |
| 16 | 4 | Fixed | volume | playback volume from 0 to Unity, 0x00010000 (a signed 32-bit number with 16 fractional bits) |
A count of n samples is 2 × n bytes of BODY: multiply a count by two to get the offset in bytes. The meaning of the octave
counts, and of samplesPerHiCycle, is the one the 8SVX voice header describes; the
octave layout is on the sample data page.
Compression
SoundBox’s description of 16SV has no compression: it lists compression as not supported for either of its IFF formats, and the reference implementation, Roland Mainz’s
16sv.datatype, answers a header whose sCompression is not 0 with “unknown compression” (the source comments “BODY data compression is currently not implemented yet”).
SoundFX, however, writes compressed 16SV files: its IFF-16SV saver guide offers “FDPCM16_6: FibonacciDelta (8:3) compressed 16bit” and “EDPCM16_5: ExponentialDelta (16:5) compressed 16bit”, and the saver module (disassembled)
writes sCompression 1 and 2 for them. The ratios say the codes are 6 and 5 bits; their tables and packing are described nowhere found, so the viewer flags any value other than 0 and does not decode it.
Example
The header of a one-shot sound of 8,000 samples (16,000 bytes of body) at 22,050 Hz, in one octave, at full volume:
| Offset | Bytes | Field | Value |
|---|---|---|---|
| −8 | 56 48 44 52 | chunk ID | VHDR |
| −4 | 00 00 00 14 | chunk size | 20 |
| 0 | 00 00 1F 40 | oneShotHiSamples | 8,000 samples |
| 4 | 00 00 00 00 | repeatHiSamples | 0 |
| 8 | 00 00 00 00 | samplesPerHiCycle | unknown |
| 12 | 56 22 | samplesPerSec | 22,050 |
| 14 | 01 | ctOctave | 1 |
| 15 | 00 | sCompression | none |
| 16 | 00 01 00 00 | volume | 1.0 |
Source: Richard Koerber, SoundBox guide (Aminet mus/misc/SoundBox), section B.2, “The 16SV format”; the structure is the 8SVX one (Steve Hayes and Jerry Morrison, Electronic Arts, 1985, Voice8Header).
The compression statement is from the 16sv.datatype source (Aminet util/dtype/16svdtc012, dispatch.c) and the SoundBox guide’s list of supported formats.