CFanのBlog

A good day for snow-viewing

Noise from multichannel Ogg Vorbis in Chrome / Edge 156: Symphonia, the newly adopted Rust decoder, writes partition classifications into the next channel

No comments on Noise from multichannel Ogg Vorbis in Chrome / Edge 156: Symphonia, the newly adopted Rust decoder, writes partition classifications into the next channel
49 views

Translated from the Chinese original by Claude.

A karaoke web player I’ve been working on lately ran into backing tracks in three-channel Ogg Vorbis, with the guide melody on one of the channels. After Chrome and Edge updated themselves to 156 on 27 October, the backing went muddy and choppy as soon as it reached a section where the guide melody came in. Nothing was wrong with the files, the server or the player.

The cause: from 156 on, Chrome decodes Vorbis with Symphonia, written in Rust, instead of FFmpeg. When Symphonia 0.6.1 reads the residue and a channel has an odd number of partitions, the spare entry in the last classword is written onto the first partition of the next channel; that partition is later read with the wrong codebook, and the rest of the packet is read as garbage. My files have 39 or 5 partitions per channel, and both happen to be odd.

An engineer at Google had already sent Symphonia a fix for this [1], merged in early November. While testing, we found another problem, in the order of multichannel coupling, and submitted a fix [2], which has also been merged. The player now does its own decoding in a Web Worker with Xiph’s official libvorbis (compiled to WebAssembly) and no longer depends on the browser. A retest with Edge 158 in early December shows it’s fixed there. Below is how I tracked it down.

Written by Claude from here

Environment

ItemDetails
BrowserChrome / Edge 156 (auto-updated on 27 October 2026); Chromium 152 for comparison
AudioOgg Vorbis, 3 channels, encoded with aoTuV, 44.1 kHz; 101 songs saved for testing
Reference decodersFFmpeg, Xiph’s libvorbis 1.3.7
Decoder in Chrome 156Symphonia 0.6.1 (Rust), feature flag SymphoniaVorbisDecoding

Symptoms

  • Only in Chrome / Edge 156; fine before the update.
  • Sections where the guide channel is silent sound normal; as soon as the guide melody comes in, the whole backing goes muddy and keeps cutting out. For a moment I thought my singing was so awful it had broken the browser
  • Every song does it; it doesn’t play favourites.

Ruling out the files and the player

First, making sure the files hadn’t changed: the original source, my server and the file the browser downloaded all have identical SHA-256 hashes, and the files haven’t been touched since 2023.

Then I wrote a test page: decode the same file with the browser’s decodeAudioData(), subtract the PCM that FFmpeg decodes from it, sample by sample, and see how big the difference is.

Chromium 152’s output is identical to FFmpeg’s. Edge 156’s error is only 5–7 dB below the music itself, which means the whole thing is decoded wrongly, not just a little off. Like playing a song while someone runs the hoover right next to it

The problem is already there at decodeAudioData(), before the player’s own mixing gets a look in, so the player is ruled out too.

Chrome 156 has a new Vorbis decoder

Comparing the source of 155 and 156: Chromium’s bundled FFmpeg barely changed (just one commit, to do with H.264), but 156 adds the Symphonia decoder, written in Rust and controlled by the feature flag SymphoniaVorbisDecoding. Chrome had already tried Symphonia out on FLAC; this time it was Vorbis’s turn.

Decoding the same file locally with Symphonia 0.6.1 gives exactly the same output as Edge 156: the difference between the two is 136.7 dB below the signal, nothing but floating-point rounding. So the problem is in Symphonia. Mystery solved: it’s written in Rust, so it put the data in the wrong place in a perfectly memory-safe way

The cause: partition classifications written past the end

First, a quick word on Vorbis residue (section 8.6.2 of the spec) [3]. Each channel’s spectral residue is cut into fixed-length partitions, and each partition has a classification, which decides which codebooks are used to read that partition’s data. Classifications aren’t stored one by one: several are packed into a classword and read together.

Symphonia keeps the partition classifications of all channels in one array, one stretch per channel. After reading a codeword, it writes all the classifications in it into the array, but the slice it passes in isn’t cut off at the end of this channel:

In these files each codeword holds 2 classifications. When the number of partitions is odd, the spare entry in the last codeword lands on the first partition of the next channel. Overstepping its jurisdiction, quite literally

Symphonia 0.6.1 overruns while reading partition classifications The partition classifications of three channels sit one after another in a single array; each channel has 5 partitions, and each classword holds 2 classifications. The spare entry in the last codeword of channels 0 and 1 is written into the next channel’s p0; channel 2’s is not written, because the array ends there. Classifications are read only in the first pass; from the second pass on, the overwritten partitions are read with the wrong codebook, and the rest of the packet is all misread. All channels’ partition classifications in one array Example: 3 channels, 5 partitions each (p0–p4), 2 classifications per classword Ch. 0 codeword ③ p4 spare Ch. 1 codeword ③ p4 spare Ch. 2 codeword ③ p4 spare p0 p1 p2 p3 p4 p0 p1 p2 p3 p4 p0 p1 p2 p3 p4 array ends, not written ① ② ③ ① ② ③ ① ② ③ Channel 0 Channel 1 Channel 2 Order when decoding a packet Pass 0 Group 1: read ① per channel write p0, p1 and decode them Group 2: read ② per channel write p2, p3 and decode them Group 3: ③ writes p4 spare overwrites next ch.’s p0 Pass 1+ Pass 0’s classifications reused: p0 of ch. 1, 2 now has another, so wrong codebook, wrong number of bits → the rest of the packet is all misread (no harm if the spare happens to match the original) this channel’s spare entry in a codeword, and the classification it overwrites
When Symphonia 0.6.1 reads partition classifications, the spare entry in each channel’s last codeword overwrites the first partition of the next channel.

Classifications are read only in the first pass (pass 0) and reused in the passes after it. The overwritten partition has already been read with the correct classification in the first pass, but from the second pass on it has a different classification and is read with the wrong codebook. Vorbis data is one continuous stream of bits: read one partition wrongly and you read the wrong number of bits, and everything after it in the packet is garbage. When the spare entry happens to be the same as the original classification, no harm is done.

My files have 39 or 5 partitions per channel, both odd, so every song gets hit. Test files made with libvorbis’s own encoder have 22 or 6, both even, which is why ordinary testing doesn’t catch it.

Cut the slice off at the end of this channel’s range, and Symphonia’s output matches FFmpeg’s (difference −137 dB):

As it turns out, someone had already fixed it: Symphonia #592 [1], submitted by Syed AbuTalib at Google, changes exactly this (plus an identical line in another residue type), and cites Chromium issue 574545168 [4]. It was merged in early November. All that time spent poring over waveforms, and the answer had been sitting in someone else’s PR all along

A second problem found along the way: the coupling order

To make sure nothing else was wrong, I also encoded a few dozen test files with libvorbis (1–8 channels, 8–96 kHz, every quality from lowest to highest) and compared Symphonia with FFmpeg on each one. That turned up another problem, in channel coupling. First, what coupling is.

What channel coupling is

In stereo music the left and right channels are often very alike: vocals and bass usually sit dead centre, almost identical on both sides. Which is why plenty of people can wear their headphones the wrong way round for an entire song and never notice Storing a full copy of each channel means a good deal of it is duplicated.

So encoders usually restate the two channels in another form before storing them. MP3 and AAC often use ‘sum and difference’: store the sum of left and right, then their difference; the more alike the two sides, the closer the difference is to 0 and the less space it takes. Vorbis uses something else, which the spec calls square polar mapping (sections 1.3.2 and 4.2.4 of the spec) [3]: a pair of channels becomes a ‘magnitude’ channel and an ‘angle’ channel.

Coupling is done in the frequency domain, separately for each frequency. When Vorbis decodes a frame, it first reads the rough outline of the spectrum (the floor) and each channel’s detail (the residue), then undoes the coupling, then multiplies the floor and residue together to get the spectrum, and finally turns that back into a waveform. The partition classification problem above is in the step that reads the residue; the one in this section is in the inverse coupling straight after it.

Steps in decoding a Vorbis frame A frame’s data goes through five steps in turn: read the floor (the rough outline of the spectrum), read the residue (each channel’s detail), inverse coupling (turn magnitude and angle back into the original channels), multiply floor by residue to get the spectrum, and an inverse transform to turn the spectrum back into a waveform. The first problem is in reading the residue, the second in the inverse coupling. Decoding a Vorbis frame: the main steps Each channel is first a set of numbers ordered by frequency, and only becomes sound at the end frame data ① Read floorfloorspectral outline ② Read residueresidueper-channel detail ③ Uncoupleinverse couplingmag. + angle → ch. ④ Multiplydot productoutline × detail ⑤ TransformIMDCTspectrum→wave au- dio Problem 1: classifications overrun Problem 2: order reversed
The two problems are in steps ② and ③ respectively (section 4.3 of the spec).

How magnitude and angle are worked out

For each frequency, take the two channels’ values at that frequency and call them x and y (x goes into the magnitude channel, y into the angle channel):

  • Magnitude: whichever of x and y has the larger absolute value, sign and all.
  • Angle: the difference between x and y. When the magnitude is positive it is x − y; when the magnitude is negative it is the other way round, y − x.

A few examples:

xyMagnitudeAngleNotes
5451x is a bit bigger; the difference is 1
455−1y is a bit bigger, so the angle goes negative
5550Both the same: the angle is 0
−6−4−62Negative magnitude: the difference is taken the other way round
6−5611One positive, one negative: a large angle

The more alike the two channels, the closer the angle is to 0. The angle channel is mostly zeros or very small numbers, which compress into few bits, while the magnitude channel carries most of the loudness.

Decoding goes the other way: given magnitude m and angle a, their signs tell you which side was bigger, and both values can be worked back out. Section 4.3.5 of the spec sets out exactly these four cases [3]. In Python it looks like this (the encoding half is one way of writing it that I worked out backwards from the decoding rules):

Take uncouple(5, -1): the magnitude is positive and the angle isn’t, so y was the bigger one; hence y = 5 and x = 5 + (−1) = 4.

Why ‘square polar’? Plot (x, y) as a point on a plane: the points with the same absolute magnitude form a square loop, not the circle of ordinary polar coordinates; the angle says where on that loop the point is.

Square polar coordinates The two channels’ values are the x and y coordinates. Points with the same absolute magnitude form a square loop: on the top and right sides the magnitude is positive, on the left and bottom sides negative. On the diagonal where x equals y the angle is 0; the further along the half-loop from the diagonal, the larger the absolute angle. Examples: P is (5, 4), magnitude 5, angle 1; Q is (5, −3), magnitude 5, angle 8; R is (−5, −4), magnitude −5, angle 1. Why it’s called ‘square polar’ Plot the two channels’ values at one frequency, (x, y), as a point x y 2 5 −2 −5 A = 0 A = 0 P Q R Examples (x goes to magnitude, y to angle) P = (5, 4) → magnitude 5, angle 1 Q = (5, −3) → magnitude 5, angle 8 R = (−5, −4) → magnitude −5, angle 1 Half-loop with positive magnitude (top and right) Half-loop with negative magnitude (left and bottom) x = y: the two channels are the same, angle 0 Points on one loop have the same absolute magnitude: the larger of the two values. The angle says how far, from the corner on the diagonal, you have travelled along this half-loop.
In ordinary polar coordinates, points with the same radius form a circle; here they form a square, hence the name square polar.

Several coupling steps are undone in reverse

With more channels there can be several coupling steps, each carrying on from the result of the one before. Which pairs of channels are coupled, and in what order, is set out in the mapping in the file’s header. Decoding has to undo them in reverse: section 4.3.5 of the spec says to start from the last step and work back to the first [3]. Like putting on a shirt and then a coat: to take them off, the coat has to come off first. Symphonia 0.6.1: I’ll take the shirt off first, thanks

A small example with the Python above. Three channels a = 2, b = 1, c = 5; couple (a, b) first, then (a, c), and the file stores a = 5, b = 1, c = −3:

  • Backwards: undo the second step first, giving a = 2, c = 5; then undo the first step, giving b = 1. All correct.
  • Forwards: undo the first step first, but a is still the 5 left by the second step, so out comes b = 4; then undo the second step: a = 2, c = 5. b is wrong. b: What did I do wrong?

Symphonia has the order the wrong way round

Symphonia 0.6.1 undoes the steps starting from the first. When a channel takes part in only one coupling step, the order doesn’t matter; when it takes part in several, the results come out wrong.

When libvorbis encodes 5.1 at lower qualities, it couples FL/FR, BL/BR, FL/FC and FL/BL, in that order: FL takes part in three steps and BL in two. Undo them forwards and the FL and BL that steps one and two get still have the later steps’ results layered on top, so FL, FR, BL and BR all come out wrong; the wrong FL is then carried into step three, and FC goes wrong with it.

Coupling order for 5.1 channels When encoding 5.1, libvorbis does four coupling steps in turn: ① FL and FR, ② BL and BR, ③ FL and FC, ④ FL and BL. Under the spec, a decoder undoes them in the order ④ ③ ② ①; Symphonia 0.6.1 undoes them in the order ① ② ③ ④, so FL, FC, FR, BL and BR are all decoded wrongly, and only LFE, which is not coupled, is right. Four coupling steps for 5.1: encoding does ①→④, decoding must undo ④→① Each step turns the two dotted channels into a ‘magnitude + angle’ pair, building on the step before Encoding: couple ①→④ Correct decoding: undo ④→① Symphonia 0.6.1: ①→④ FLfront L FCcentre FRfront R BLback L BRback R LFE ① ② ③ ④ ④ ③ ② ① ① ② ③ ④ × × × × × OK Undoing forwards, the FL and BL that steps ① ② get still carry later steps’ results, so FL, FR, BL, BR come out wrong; the wrong FL is then carried into step ③, and FC goes wrong too. Only LFE, which isn’t coupled, is unharmed.
The four coupling steps libvorbis uses for 5.1 at lower qualities. The spec says to undo them backwards from the last step; Symphonia 0.6.1 undoes them forwards.

Testing with 5.1 music encoded by libvorbis, five of the six channels come out wrong; only LFE, which isn’t coupled, is unharmed. Not that most people have 5.1 speakers at home anyway FFmpeg’s test sample vorbis/6.ogg (a 5.1 speaker test encoded with libvorbis 1.3.3), decoded with Symphonia 0.6.1, has a wrong BR channel.

The fix is a single line: walk the coupling steps in reverse.

I submitted this as Symphonia #604 [2]; it was merged in early November.

What to do

Browser users

Quit Chrome or Edge completely (background processes too), then start it with this command-line switch, and it goes back to decoding with FFmpeg. In PowerShell:

Or type msedge --disable-features=SymphoniaVorbisDecoding into Run (Win+R). I’ve checked on Edge 158 that with this switch the decoded output really does change to FFmpeg’s.

Web developers

Don’t rely on the browser’s built-in Vorbis decoder. My player now does its own decoding in a Web Worker with Xiph’s official libogg 1.3.6 and libvorbis 1.3.7 [5] (compiled to WebAssembly with Emscripten), and uses the browser’s decoder only as a fallback.

On the 101 saved backing tracks, the difference between its output and FFmpeg’s is below −135 dB for every one. Decoding runs in the Worker, so it doesn’t freeze the page.

Upstream and newer browsers

Both fixes have been merged. On 28 November I tested again with Symphonia’s main branch after the merges: the 101 backing tracks differ from FFmpeg by −148.9 dB, and the 61 test files encoded with libvorbis all match as well.

On 2 December I decoded one of them with Edge 158: with default settings it still uses Symphonia, now −137 dB from FFmpeg, so it’s fixed; with the switch above, using FFmpeg, it’s −140 dB. I haven’t tested whether 157 is fixed. Mostly out of laziness

If you’ve run into this too

  • If you’re on Chrome / Edge 156 and Ogg Vorbis plays back muddy or noisy, update to the latest version first; if you can’t update, try the command-line switch above, and if that cures it, it’s Symphonia.
  • To be sure, decode with decodeAudioData() and compare the result with FFmpeg’s sample by sample.
  • Files with three or more channels and an odd number of partitions per channel are the most likely to be hit; files with several coupling steps, such as 5.1, also run into the second problem.
  • To play Vorbis reliably on a web page, ship your own WebAssembly build of libvorbis; then it doesn’t matter when the browser swaps decoders.

References

  1. [1]S. AbuTalib, “vorbis: Support >8 discrete channels and bound residue part_classes slice,” pdeljanov/Symphonia pull request #592, GitHub, Nov. 2026. [Online]. Available: https://github.com/pdeljanov/Symphonia/pull/592 ↩1↩2
  2. [2]computerfan, “vorbis: Fix inverse coupling order,” pdeljanov/Symphonia pull request #604, GitHub, Nov. 2026. [Online]. Available: https://github.com/pdeljanov/Symphonia/pull/604 ↩1↩2
  3. [3]Xiph.Org Foundation, “Vorbis I specification,” Jul. 2020. [Online]. Available: https://xiph.org/vorbis/doc/Vorbis_I_spec.html ↩1↩2↩3↩4
  4. [4]“Issue 574545168,” Chromium Issue Tracker. Accessed: Dec. 2, 2026. [Online]. Available: https://issues.chromium.org/issues/574545168 ↩
  5. [5]Xiph.Org Foundation, “Downloads,” Xiph.Org. Accessed: Dec. 2, 2026. [Online]. Available: https://xiph.org/downloads/ ↩

Leave a comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.