Raw audio is rarely written for its own sake. It is the sample data of another format with the header cut off, the output of a recorder or radio, or a dump from a program or a machine. This page lists the sources and the settings that read them. Items marked checked were tested in the explorer’s tests or against FFmpeg; the others follow the documentation named.
The sample data of other formats
| Source | Samples | Rate and channels come from |
|---|---|---|
WAVE data chunk (WAV) | the format code in the fmt chunk: 8-bit unsigned, 16, 24, 32-bit signed little-endian, 32/64-bit float, A-law, µ-law, ADPCM; the canonical header is 44 bytes, so Skip 44 (checked) | the fmt chunk |
AIFF SSND chunk (AIFF) | big-endian signed 8, 16, 24, 32-bit; after the chunk’s 8-byte offset and block size fields | the COMM chunk |
| Sun/NeXT AU (AU) | big-endian; encoding codes include µ-law, A-law, 8, 16, 24, 32-bit signed and floats; data starts at the header’s offset (24 or more) | the header |
IFF 8SVX BODY chunk (8SVX), Amiga | 8-bit signed, mono, unless the Voice8Header says compression 1 (Fibonacci-delta) or 2 (exponential-delta); then 4-bit codes. Skip to the start of the BODY’s data (checked with the delta formats) | the Voice8Header’s samplesPerSec, and its octave count for several octaves in one BODY |
| Creative Voice File sound-data blocks (VOC) | block type 1: unsigned 8-bit after a 2-byte start (time constant and codec); block type 9: the codec, bits and channels are in the block. Codec 0 is unsigned 8-bit PCM; 4 is signed 16-bit little-endian; 6 is A-law and 7 µ-law | type 1: 1,000,000 ÷ (256 − time constant); type 9: a 32-bit rate |
| CAF and W64 audio data (CAF, W64) | as their description chunks say; both can carry either byte order | the description chunks |
| Tracker module samples (MOD and others) | 8-bit signed in MOD; XM stores 8 or 16-bit samples as differences from the last one (Format DPCM, byte or word deltas, little-endian); S3M and IT have flags for 8 or 16-bit and signed or unsigned | the note being played: no fixed rate |
Telephony
- G.711 µ-law (
.ul,.ulaw,.mulaw) or A-law (.al,.alaw) at 8,000 Hz, one byte a sample, one channel: Format µ-law or A-law, rate 8,000 Hz (checked against FFmpeg). - Asterisk
.sln: “signed linear”, 16-bit little-endian, 8,000 Hz; FFmpeg reads it as theslnformat..sln16and.sln48are the same at 16,000 and 48,000 Hz (the explorer does not open.slnfiles as audio, because Visual Studio uses that extension; use Read as to choose Raw PCM audio). - Dialogic
.vox: OKI ADPCM, 4 bits a sample, 6,000 or 8,000 Hz (checked against FFmpeg’sadpcm_ima_oki). - Call recorders and SIP tools often write the audio of one direction as one such file and the other direction as a second file; the two together are the two channels of a stereo recording.
Games and consoles
Dumps of sound memory and extracted samples are the other rich source of raw files. The usual forms, from the machines’ documentation:
| Machine | Usual raw form |
|---|---|
| Sega Mega Drive / Genesis (YM2612 DAC samples) | 8-bit unsigned, mono, at a rate set by the sound driver |
| Sega CD / Mega CD (RF5C164) | 8-bit sign and magnitude (use Sign: sign and magnitude) |
| Sega Saturn (SCSP) | 16-bit signed big-endian, or 8-bit signed |
| Sony PlayStation (SPU) | 4-bit ADPCM in 16-byte blocks of 28 samples, not offered as a raw reading; once decoded, 16-bit signed little-endian at up to 44,100 Hz |
| Nintendo 64 | 16-bit signed big-endian, often 32,000 Hz; its VADPCM is not offered as a raw reading |
| Game Boy Advance direct sound | 8-bit signed, mono |
| Archimedes (Acorn) | VIDC logarithmic, 8-bit (checked against FFmpeg’s vidc); the 8 bits are the µ-law magnitude with the sign in bit 0 |
Radio recordings: I/Q pairs
A software-defined radio samples the antenna signal as two numbers per sample: I (in-phase) and Q (quadrature). A recording is a file of I, Q, I, Q … pairs: a stereo file whose two “channels” are one complex signal. In the explorer, set Signal to Radio I/Q pairs (or open a file with one of these extensions): the waveform shows I and Q, the spectrogram uses both parts so negative frequencies appear below the middle and positive above, and a second waveform plays the signal demodulated as AM (the magnitude) or FM (the change of phase), averaged down to about 48 kHz. A made-up AM carrier at +0.2 of the sample rate shows as a bright line at +0.2 of the spectrogram’s height above the middle (checked).
| Extension | Samples | Made by |
|---|---|---|
.cu8 | unsigned 8-bit I, Q | RTL-SDR (rtl_sdr writes this form whatever the name; 2,048,000 Hz is its default rate) |
.cs8 | signed 8-bit I, Q | HackRF (hackrf_transfer) |
.cs16 | signed 16-bit little-endian I, Q | several recorders and converters |
.cf32, .fc32, .cfile | 32-bit float little-endian I, Q (“complex float”) | GNU Radio’s File Sink with a complex float input; also SoapySDR tools |
.cf64 | 64-bit float I, Q | some analysis tools |
.iq, .sdr | no fixed form: the name does not say, so only the Signal is set and the format is left to be chosen or detected | various |
No header says the sample rate or the centre frequency; they are in the name, a sidecar file or the notes of the
person who recorded. The explorer reads a rate from names like capture_2400k.cu8
or fm_2.048msps.iq (checked), and its presets include 250,000, 1,024,000,
2,048,000, 2,400,000 and 3,200,000 Hz.
S/PDIF, AES3 and HDMI captures
A capture of a digital audio link is raw data of two kinds, and the explorer reads both.
IEC 60958 subframes
S/PDIF and AES3 send 32-bit subframes, one a channel, alternating A (left) and B (right). Captures that keep the subframes as 32-bit words
(ALSA’s IEC958_SUBFRAME_LE format, and similar dumps) hold, bit by bit:
| Bits | Meaning |
|---|---|
| 0 to 3 | the preamble (which subframe this is); capture tools leave it empty and the explorer ignores it |
| 4 to 27 | the audio: a 24-bit two’s-complement sample whose most significant bit is bit 27. A 20-bit word occupies bits 8 to 27 and bits 4 to 7 are auxiliary data below it |
| 28 | V, the validity bit: 1 marks a sample that is not suitable for conversion to audio |
| 29 | U, a user-data bit |
| 30 | C, a channel-status bit (192 of them, one a frame, make the status block: sample rate, copy bits, professional or consumer) |
| 31 | P, parity: bits 4 to 31 hold an even number of ones |
The explorer’s IEC 60958 subframes format reads the audio from bits 4 to 27 of each little-endian or big-endian word, counts the parity failures and the
validity bits and reports them as problems. It also gathers the C bits of the first 192 frames into the 24-byte channel-status block of channel A and shows what it says in
the Header and name section (below). The layout follows the standard’s description as the AES3 and S/PDIF specifications and ALSA’s asoundef.h give it; there is no
tool in this set that reads such a file, so it is tested against subframes built from known samples (test-pcm-burst.mjs).
Channel status
The explorer decodes the 24-byte block with the first transmitted bit in bit 0 of byte 0. Bit 0 chooses the layout: 1 professional (AES3), 0 consumer (S/PDIF); bit 1 says
non-audio. Consumer bytes 0 to 5 (copyright, emphasis, category, source and channel number, sample rate, clock accuracy, word length, original rate, CGMS-A) follow ALSA’s asoundef.h (verified).
Professional bytes 0 to 23 (rate, emphasis, channel mode, user bits, word length, extended rate, origin and destination text, the two 32-bit addresses, reliability flags, CRC byte) follow the layout in the AES3 article on Wikipedia (verified against that text only);
byte 3 (multichannel) is shown as a raw number. The CRC is the polynomial x8+x4+x3+x2+1 preset to ones; the bit order and the bytes it covers were not checked against a transmitter or a test vector (inferred), so a “CRC differs” note is only a hint. AES3-2009 and IEC 60958-3 were not read. Tested in test-pcm-channel-status.mjs with blocks built by hand from the ALSA values.
IEC 61937 and SMPTE 337M data bursts
The same links often carry a compressed bitstream (AC-3, DTS …) dressed as a stereo PCM signal. Played as audio it is loud noise. Each burst opens with four words, Pa, Pb, Pc and Pd, repeated at every frame:
| Word | 16-bit words (IEC 61937) | 24-bit words (SMPTE 337M) |
|---|---|---|
| Pa, Pb | F872 4E1F | 96F872 A54E1F (20-bit words use 6F872 54E1F) |
| Pc | bits 0 to 4 the data type, bit 7 the error flag, bits 8 to 12 type-dependent, bits 13 to 15 the stream number | as the 337M standard places it |
| Pd | the payload length in bits | as the 337M standard places it |
The data types are the IEC 61937-2 list as FFmpeg’s spdif.h gives it: 1 AC-3, 4 MPEG-1 layer 1, 5 MPEG-1 layer 2 or 3 (or MPEG-2 without extension), 6 MPEG-2 with extension,
7 MPEG-2 AAC (ADTS), 8 to 10 the MPEG-2 low-sampling-rate layers, 11 to 13 DTS type I, II and III (512, 1,024 and 2,048 samples), 14 ATRAC, 15 ATRAC3, 16 ATRAC3+,
17 DTS-HD, 18 WMA Pro, 19 MPEG-2 AAC at half sampling rate, 21 E-AC-3, 22 TrueHD, and 0 null and 3 pause.
The explorer looks in the first mebibyte (after Skip) for the preamble in four forms: 16-bit little-endian words (the bytes 72 F8 1F 4E, what FFmpeg’s S/PDIF muxer writes),
16-bit big-endian (F8 72 4E 1F), and 24-bit big and little-endian. A match shows a This is not sound row with the standard, the offset, the data type, the payload length and how
many bursts begin in the window (up to 64 are counted), and a problem is listed. For 24-bit words only the preamble is reported: the layout of Pc and Pd in a 24-bit word is in the SMPTE 337M standard, which was not obtained, and SMPTE 338M, which numbers its data types differently from IEC 61937, was not either.
Verified against FFmpeg’s muxer and demuxer: AC-3, E-AC-3 and DTS bursts, in both byte orders, are found with the same codec as ffprobe -f spdif names; none is found in random bytes or in the real raw files tried.
DVD and Blu-ray LPCM
The linear PCM on DVD-Video and Blu-ray discs is big-endian PCM with a small header in front of each packet of the MPEG program or transport stream. A packet is not a file
and the header repeats, so this is not a raw file: the explorer reads such audio from the container (an MPEG file), and these are the layouts, from FFmpeg’s decoders
(pcm-dvd.c, pcm-bluray.c).
DVD-Video (private stream 1, substream A0–A7)
| Byte | Bits | Meaning |
|---|---|---|
| 0 | 7, 6, 5 and 4 to 0 | emphasis, mute, reserved, frame number |
| 1 | 7-6 | quantisation: 0 = 16 bits, 1 = 20 bits, 2 = 24 bits (3 is invalid) |
| 5-4 | sampling rate: 0 = 48 kHz, 1 = 96 kHz, 2 = 44.1 kHz, 3 = 32 kHz (FFmpeg notes that 44.1 and 32 kHz appear in no commercial title) | |
| 3 | reserved | |
| 2-0 | channels minus one (1 to 8 channels) | |
| 2 | 7-0 | dynamic range control (0x80 = off) |
The samples follow, big-endian. 16-bit samples are in frame order. 20 and 24-bit samples are stored in groups of four for the channels in turn: the four samples’ upper 16 bits first (four big-endian words), then their remaining bits: four low bytes for 24-bit audio, or four nibbles in two bytes (first sample in the high nibble) for 20-bit audio. With 1, 2 or 4 channels a group holds all the samples needed (so one channel takes two 4-sample groups to make a block of 8), with 8 channels two groups make a frame, and with 3, 5, 6 or 7 channels a block is as many groups as channels.
Blu-ray (4-byte header in the transport stream)
| Byte | Bits | Meaning |
|---|---|---|
| 0-1 | not read by FFmpeg | |
| 2 | 7-4 | channel assignment: 1 mono, 3 stereo, 4 3.0, 5 2.1 (FL FR BC), 6 4.0, 7 FL FR SL SR, 8 5.0, 9 5.1, 10 7.0, 11 7.1 (the others are reserved) |
| 3-0 | sampling rate: 1 = 48 kHz, 4 = 96 kHz, 5 = 192 kHz | |
| 3 | 7-6 | bits: 1 = 16, 2 = 20, 3 = 24 (FFmpeg decodes 16 and 24) |
The samples are big-endian words in frame order: 16-bit words, or 24-bit words with no grouping. An odd channel count is padded with an empty channel (mono audio carries two channels, one empty), so every frame has an even number of channel slots. For 5.1 the disc order is L R C Ls Rs LFE, which the decoder remaps to the usual L R C LFE Ls Rs.
Scope (pending the owner’s ruling): these are stream layouts that belong with the MPEG program and transport stream pages. The explorer does not offer them as raw readings, because a headerless file cut from the payload has lost the header that says which layout it is, and no tool writes such a file; the layouts are documented here so that the payload can be read by hand. They are taken from FFmpeg’s source.
Tools that write and read raw audio
| Tool | Raw settings |
|---|---|
| FFmpeg | -f s16le (and u8, s24be, f32le, alaw, mulaw, vidc …), -ar for the rate and -ac for the channels, defaulting to 44,100 Hz mono (checked). More under Conversion commands. |
| SoX | file types raw, s16 and so on with -r rate, -c channels, -b bits and -e encoding; the extensions .sw .uw .sb .ub .ul .al .sl name the type, which is where the explorer’s extension list comes from |
| Audacity | File, Import, Raw Data: Encoding, Byte order, Channels, Start offset (bytes), Amount to import (%) and Sample rate: the same questions as the explorer’s options bar |
| libsndfile | a raw file is opened by giving the format SF_FORMAT_RAW with a sub-format, rate and channels |
| NumPy | numpy.fromfile(path, dtype='<i2') reads 16-bit little-endian; the dtype strings < and > are the byte order |
| Web Audio / audio worklets, speech APIs | raw 16-bit little-endian or 32-bit float PCM at 16,000 or 48,000 Hz, mono, is the usual hand-over form (the file speech-model-check.pcm, found in a speech application on this Mac, is 16-bit signed little-endian mono; the explorer detects it first) |
Source: the sub-frame layout (time slots 0 to 3, 4 to 27, 28 to 31, even parity over slots 4 to 31, the validity bit, the 192-frame block and the preambles X, Y and Z): EBU Tech 3250, Specification of the digital audio interface (the EBU’s free text of AES3), section 2.2. The IEC 60958 and IEC 61937 standards and SMPTE 337M are sold and were not read; the IEC 61937 preamble words and data types are as FFmpeg’s spdif.h gives them.