Introduction
The EA3 header names the codec in byte 32 and gives its settings in the 24-bit word at bytes 33 to 35. The sound data starts right after the header and, for every codec except the two lossless layers, is a run of packets of one size with nothing between them.
Codec ids
| Id | Codec | Notes |
|---|---|---|
| 0 | ATRAC3 | 1,024 samples a channel in each packet, always two channels. ATRAC3. |
| 1 | ATRAC3plus | 2,048 samples a channel in each packet, one to eight channels. |
| 2 | AAC | An ordinary AAC stream (ADTS) that the codec’s own parser cuts into frames. |
| 3 | MP3 | An ordinary MPEG audio stream that the codec’s own parser cuts into frames. |
| 4 | Linear PCM | 16-bit big-endian two-channel samples at 44,100 Hz; no parameters. |
| 5 | WMA | The id exists in FFmpeg’s table, but its reader rejects it as unsupported. One real file exists (a 55-minute SonicStage file from samples.ffmpeg.org, ticket 6272): its sound data is a complete ASF file, starting at the end of the EA3 header with the ASF header object and ending at the end of the file, holding Windows Media Audio version 2 at 44,100 Hz, two channels, 128 kbit/s. The EA3 header repeats ASF values: bytes 36 to 39 are the duration in milliseconds (3,343,034, which is the ASF play duration of 3,344,613 ms minus the 1,579 ms preroll) and bytes 40 to 43 the ASF packet count (9,000); the ASF file-size field equals the length of the sound data. Bytes 33 to 35 are 40 80 44 and bytes 44 to 95 are zero; what the three bytes mean is not shown by anything read (they are not the ATRAC parameter word; the header table gives what they can be compared with). FFmpeg’s reader rejects the id, but the explorer decodes the sound data as WMA: the WMA section. |
| 33 | ATRAC Advanced Lossless, ATRAC3plus core | Chunked, see below. Two channels, 44,100 Hz. |
| 34 | ATRAC Advanced Lossless, ATRAC3 core | Chunked, see below. Two channels, 44,100 Hz. |
Any other id is an unknown codec; FFmpeg’s reader refuses the file.
The parameter word
Bits are numbered from the least significant bit of the 24-bit value.
ATRAC3 (id 0)
| Bits | Field | Meaning |
|---|---|---|
| 0 to 9 | Packet size | The packet size in bytes is this number times 8. |
| 13 to 15 | Sample rate | An index into 32,000, 44,100, 48,000, 88,200, 96,000. Indices 5 to 7 are not used and make FFmpeg refuse the file; FFmpeg asks for a sample when the rate is not 44,100. |
| 17 | Joint stereo | 1 when the two channels are coded as a joint stereo pair, 0 when they are coded separately. |
The bit rate is the sample rate times the packet size, divided by 128. Real examples: 002030 (44,100 Hz, 384-byte packets, 132 kbit/s, the LP2 rate),
and 192-byte packets with the joint stereo bit set (66 kbit/s, LP4).
ATRAC3plus (id 1)
| Bits | Field | Meaning |
|---|---|---|
| 0 to 9 | Packet size | The packet size in bytes is this number times 8, plus 8. |
| 10 to 12 | Channel id | 1 mono, 2 stereo, 3 three channels (front left, right and centre), 4 four channels, 5 5.1 (back), 6 6.1 (back), 7 7.1. 0 is invalid and makes FFmpeg refuse the file. |
| 13 to 15 | Sample rate | The same index as for ATRAC3. |
The bit rate is the sample rate times the packet size, divided by 256. A real file: 002822 is stereo at 44,100 Hz with 280-byte packets (48.2 kbit/s).
AAC, MP3, linear PCM and the lossless layers
The parameter word is not used by FFmpeg for these ids (files written by this site’s test script put zeros there). The sample rate and channel count come from the stream itself, or are fixed (linear PCM and the lossless layers: 44,100 Hz, two channels).
Packets and the sound data
| Codec | Packet | What a packet holds |
|---|---|---|
| ATRAC3 | the packet size of the parameter word | One frame: 1,024 samples of both channels, a sound unit for each channel (in joint stereo, two units that share the packet). The syntax. |
| ATRAC3plus | the packet size of the parameter word | One frame of 2,048 samples a channel, coded by the ATRAC3plus syntax. The syntax. |
| Linear PCM | 1,024 bytes | 256 stereo samples: left then right, each a signed 16-bit big-endian number. The last packet may be shorter. |
| MP3 | read in 1,024-byte pieces | The MPEG audio frames follow each other; their length comes from the frame header (see MP3). The explorer’s Frames tab lists every frame with its offset, time, size and header fields. |
| AAC | read in 1,024-byte pieces | ADTS frames follow each other (see AAC). The Frames tab lists every ADTS frame with its profile, rate and size. |
The number of packets is the size of the sound data divided by the packet size, rounded up; a last packet that is shorter than the others is read as it is (and flagged as damaged by FFmpeg). The time of a packet is its byte position in the sound data divided by the byte rate. The length of an ATRAC3 or ATRAC3plus file in samples is the number of whole packets times 1,024 or 2,048.
The lossless layers (ids 33 and 34)
The sound data is a run of chunks, each with a 24-byte header, until a header whose first three bytes are zero or the file ends.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 3 | Tag | The letters BLK. |
| 3 | 1 | Padding | Not read by FFmpeg. The number of padding bytes (0 to 7) at the end of the chunk’s data: the enhancement is padded so that the chunk size is a multiple of 8. Confirmed on every chunk of the thirteen real files: with this count taken off, every enhancement packet is read to its last bit. |
| 4 | 2 | Size | The number of data bytes after this header, big-endian. |
| 6 | 2 | Zero | Not read. Zero in every chunk of the real files. |
| 8 | 4 | Block number | The time of the chunk: this number times 1,024 samples (id 34, ATRAC3 core) or 2,048 samples (id 33, ATRAC3plus core). Counts up from 0. |
| 12 | 2 | Samples and last flag | Not read by FFmpeg. Bit 15 is set only in the last chunk. The low 15 bits are the number of samples of the chunk: 1,024 (id 34) or 2,048 (id 33) in every chunk but the last, and in the last chunk the number of samples that are left (the same number as bytes 34 and 35 of the EA3 header). |
| 14 | 10 | Zero | Not read. Zero in every chunk of the real files. |
| 24 | Size | Data | The chunk’s data: the lossy core frame (the ATRAC3 or ATRAC3plus frame, a fixed size for the file) and then the lossless enhancement. FFmpeg passes the whole chunk to its atrac3al or atrac3pal decoder, which decodes the lossy core only (the commit that added it says “Only lossy part is decoded for now”). |
The data of a chunk is the lossy core frame (its size is the core size, named in the EA3 header at byte 48 onwards) and then the enhancement packet. The first chunk (number 0) has no enhancement: it only starts the core decoder. How the two layers combine is below.
ATRAC Advanced Lossless: the enhancement and how it is applied
Every chunk after the first holds a lossy core frame and an enhancement packet. The enhancement is a correction in whole numbers: the sound of the original is the sound that Sony’s integer core decoder makes from the core frame, plus the correction, added as 16-bit numbers that wrap around (modulo 65,536). Chunk n’s correction belongs to the samples that the core frame of chunk n decodes to. The ATRAC Advanced Lossless Profile has no other check data (no checksum), so correctness is shown by decoding, below.
The enhancement packet
The bits are read from the most significant bit of each byte. The packet ends at the chunk’s last byte before the padding.
| Bits | Field | Meaning |
|---|---|---|
| 1 | Reserved | 0. |
| 2 | Channel code | 2 (two channels) in every packet of the real files. |
| 2 | Coding | 0: predicted and Rice coded, as below. 1: the 2 × N samples follow as plain 16-bit numbers, left channel then right. |
| 2 | Decorrelation | 0: the two coded signals are left and right. 1: left and (left minus right). 2: right and (left minus right). 3 is not defined. Only in coding 0. |
| For each of the two coded signals, in coding 0: | ||
| 4 | Prediction mode | 0: none. 1 to 7: a fixed two-tap predictor with the coefficients 32, 28, 16, 0, −16, −28, −32 for modes 1 to 7 and a second coefficient of −16 (the prediction is (c1 × previous − 16 × the one before + 8) shifted right by 4). 8: an order-8 predictor whose eight coefficients follow. |
| 11, 11, then 6 × 6 | Predictor codes | Mode 8 only: two 11-bit reflection codes (value minus 1,023, or minus 1,024 from 1,024 up), then six 6-bit codes that go through a 32-entry sine table (values from 0 to 1,022; a code below 32 is the negative of the entry 31 minus the code, a code from 32 the entry code minus 32). The reflection values become the eight coefficients by the step-up recursion with a rounding add of 512 and a shift of 10; the prediction is the coefficient-weighted sum of the previous eight outputs, plus 512, shifted right by 10. |
| 2 | Partitions | The number of partitions minus 1; 2 partitions (value 1) in every packet of the real files. The N samples (1,024 or 2,048) are split into two halves. |
| per half | Rice block | 5 bits: the Rice parameter k (0 to 15). Then the quotient of every sample of the half: read bits and compare them with the pattern 0, 1, 0, 1, …; the quotient is the number of bits that match before the first bit that does not (so a first bit of 1 is the quotient 0). After 15 matching bits the next bit must be 0 and is followed by 16 plain bits that are the quotient (an escape). Then the k-bit remainders of all the samples of the half. A value u = quotient × 2k + remainder maps to a signed number with the zigzag rule (an odd u is negative). |
| 2 | End marker | 0, then the bits are padded to a whole byte. |
The predicted value is added to each decoded number and wrapped to 16 bits; with a decorrelation the second signal is then turned back into the right (or left) channel with the same wrap. Every enhancement packet of the thirteen real files (17,766 packets) is read to exactly its length with a zero end marker.
The lossy core of the lossless profile
The core is not the stream that a player decodes. Sony’s lossless core leaves out the tone components (the sine-wave part) of ATRAC3plus and runs entirely in 16-bit and 32-bit integer arithmetic. A decoder that includes the tones, or runs in floating point, makes a different signal, so the correction no longer fits: against the 256 kbit/s file the correction measured as large as the core (rms 2,154 against 2,478) when the tones were included, and about a hundredth of that once they were left out. The steps of the integer core for ATRAC3plus are:
- Dequantise the spectral values of the 2,048 lines to whole numbers, with the word-length shift and the scale of the band, then swap and negate channels as the stream says.
- For each of the sixteen subbands, a 128-point integer inverse MDCT with window A or window B (the choice comes from the previous frame’s flag), overlapped with the previous frame, and then the gain compensation of the previous frame.
- A 16-band integer inverse polyphase quadrature filter that joins the subbands. Only the first 8, 12 or 16 subbands are used, by core size: 744 bytes or fewer, 1,488 or fewer, and larger.
Because the decoder starts with empty overlap state, the first 368 samples of the first decoded frame (138 samples for an ATRAC3 core) have no correction; the sound starts after them, and the last chunk gives the number of samples that are left. The explorer’s aalint.js and aaltables.js are this decoder; the integer tables in it (windows, filters, scales, gain curves) are identical to those of the third-party project below, and each was checked equal to the saved copy.
What is proven
ATRAC3plus core (id 33): the sum is exact. Twelve real files that come from one source sound but have different cores (64, 128, 256 and 352 kbit/s, normal and high profiles, with different tone content and subband limits) all decode to identical samples (the first nine were compared over 5,193,728 samples in both channels, the other three over the first eight seconds), apart from the 368 start-up samples of the first frame that carry no correction. Two different integer decodes plus two different corrections cannot agree on every sample by chance, so the combination, the alignment and the core arithmetic are all right. With the floating-point core with tones, 83.9 % of the samples differed.
ATRAC3 core (id 34): only one real file exists (132 kbit/s) and it comes from a different source, so there is no second decode to compare with. The explorer adds the correction to an integer core (the ATRAC3 core written from the data flow of the ATRACodec original-132 source: integer inverse quantisation with the tone components, a 256-point integer inverse MDCT with window and overlap, gain compensation with the previous frame’s gain points, and a 24-tap integer inverse QMF over the two lower subbands). The sum with this core is cleaner than the sum with the floating-point core (an order-16 prediction gain of 40.9 dB against 38.6 dB over 300 blocks of the real file), which is the evidence that it is the closer core, but it is not shown to be exact: no second real file, no second decoder and no Sony binary could be compared (the Sony 4.3 installer on archive.org is a solid RAR archive that no tool on this machine opens). The integer core also differs from the floating-point core by about 12 rms steps that are not explained, and it comes out with the opposite polarity: the viewer plays minus (core plus correction), the combination with the highest prediction gain on the real file (40.9 dB, against 37.7 dB for the negated core plus the correction), so the played samples can differ from the original. The format of the enhancement is the same and parses exactly.
Where the syntax comes from
The enhancement syntax and the integer tables were taken as leads from ATRACodec, a third-party project (licence GPL-3, one repository created on 2 November 2026, a single commit), which states that it was reverse-engineered from Sony’s programs. Its origin cannot be confirmed from outside, so nothing here rests on it alone: the explorer’s code is written from the syntax, and every claim above was checked on the real files (parsing to the exact length, and the two-core comparison).
WMA: an ASF file inside the OMA file
With codec id 5 the sound data is a complete ASF (Advanced Systems Format) file, from the ASF header object to the end of the OMA file. The stream properties are not in the EA3 header: the sample rate, channel count, bit rate and block size are in the ASF stream properties object as a WAVEFORMATEX (format tag 0x161 is WMA version 2, 0x160 version 1), followed by the codec’s extra data. In the real file the format tag is 0x161, 44,100 Hz, two channels, 16,002 bytes a second, block size 5,945 bytes, and the extra data is 00 88 00 00 0F 00 E5 5C 00 00.
The ASF container
- The header object holds the File Properties object (file size, data packet count 9,000, play duration 33,446,130,000 in units of 100 ns, preroll 1,579 ms, packet size 5,976 bytes), the Stream Properties object of the audio stream and objects of descriptions (title, album, encoding time).
- The Data Object follows, then 9,000 packets of 5,976 bytes. A packet starts with optional error correction data and two flag bytes that say how long the length, sequence and padding fields are, then the send time, and one payload or several. A payload carries the stream number, the media object number, the offset into that object, replicated data (the object size and its presentation time) and a piece of the object. Here every packet holds one payload, a whole media object of 5,945 bytes, which is one WMA block: the packet size is the block size plus 31 bytes: a three-byte error correction field, the flag and length fields, the payload header and four bytes of padding.
The WMA frames
A media object (“superframe”) of the block size is decoded on its own, with a bit reservoir that lets a frame run on into the next object. The extra data word at bytes 4 and 5 (0x000F here) switches on exponent coding by Huffman code, the bit reservoir and variable block lengths. A frame is 2,048 samples a channel at 44,100 Hz; it is cut into one to sixteen blocks of 2,048 down to 128 samples, each with its own exponents (the spectral envelope, coded as differences by a Huffman code), run-length and level coded spectral coefficients, an optional mid/side stereo step and, at low bit rates, noise substitution for the top bands. The inverse MDCT of each block is windowed with a sine window that follows the block lengths and added to the tail of the block before it.
The explorer’s decoder (asf.js, wma.js, the tables in wmadata.js) was written from FFmpeg’s wmadec.c, wma.c, wmadata.h and wma_freqs.c and the ASF specification. It decodes the whole 55-minute file, 147,427,328 samples a channel, to within 4.8e−7 of full scale of what FFmpeg decodes from the extracted ASF file (root mean square 3.4e−8; no sample differs by more than 1e−4). FFmpeg drops the first 4,096 samples of the stream (two frames of start-up) and so does the explorer. The same check on streams that FFmpeg’s own encoder wrote covers version 1 and version 2, mono and stereo, rates from 16,000 to 44,100 Hz and the noise substitution path, all with the same agreement. The Playback tab decodes only the first part of the file (the Seconds option), packet by packet, so the length of the file does not matter. The exponent coding by line spectral pairs (a stream whose extra data word does not set bit 0) is checked on real streams: a version 1 mono file at 16,000 Hz, a second version 1 file and two version 2 files with variable block lengths, all from samples.ffmpeg.org, decode to within 6.3e−5 of full scale of FFmpeg’s output over their first 60 seconds (most within 7e−6), and a version 1 file with exponent Huffman coding to within 1.8e−7.
Some real ASF files carry audio that is spread over several packets (the error correction data of the packet has the span, the packet length, the chunk length and the silence length). Each media object then holds span × packet length bytes that must be put back in order: for output position p (counted in chunks), row = floor(p / span) and column = p mod span, and the chunk copied there is chunk number row + column × (packet length / chunk length) of the object. The decoder then takes block-size pieces from the result and drops a short rest. This is the rule of FFmpeg’s libavformat/asfdec_f.c (the stream properties give the spread data, asf_read_packet reorders), and the real version 1 files agree with FFmpeg only with it.
Sources
- FFmpeg
libavformat/omadec.c(oma_read_header,read_packet,aal_read_packet),oma.c(the rate table and the codec table) andoma.h: codec ids, the parameter word, the packet sizes and the chunk header. - FFmpeg
libavcodec/atrac3.candatrac3plusdec.c: samples a packet for ATRAC3 and ATRAC3plus. - ATRACodec (third-party, GPL-3, repository created 2 November 2026): used as a lead for the enhancement syntax and the integer tables; each statement in the lossless section was checked on the real files, see the section above.
- The thirteen real AL files of samples.ffmpeg.org (FFmpeg ticket 5334) and the parser and two-core tests in parser-test/test-oma-built.mjs.
- FFmpeg
libavcodec/wmadec.c,wma.c,wma.h,wma_common.c,wmadata.h,wma_freqs.candaactab.c(the exponent code is the AAC scale factor code): the WMA version 1 and 2 decoder;libavformat/asfdec_f.c,asf.candasf.h: the ASF objects and packets;riff.c: the format tags. The Microsoft Advanced Systems Format (ASF) specification, revision 01.20.06, gives the header and data objects. - The WMA check:
scripts/oma/check-wma-ffmpeg.mjsdecodes the ASF file of the real WMA file (and ASF files that FFmpeg’s encoder wrote) with the explorer’s decoder and compares every sample with FFmpeg’s output. - The parameter words of the real files in samples/oma (
002030and002822) and of the files made by atracdenc and FFmpeg were checked against FFmpeg’s output.