FAAC 3.0: Beating Bigger Encoders on a Budget

Summary

FAAC had to sound better without becoming big or slow. That limit shaped how it passed Apple and FDK on estimated quality scores, and listeners showed what those scores were missing.

FAAC 3.0 now ranks above Apple’s AAC encoder and FDK, Android’s built-in one, on my benchmark’s leaderboard. It also encodes far faster than either.

Those encoders come with far bigger names and budgets. I wanted that top spot, and the users it might bring. FAAC didn’t get past them by doing what they do with less. The limits it works under became the strategy.

One benchmark run with a pre-release build of FAAC 3.0, including its optional Parametric Stereo encoder; the release results are nearly identical in quality. I ran these tests, they’re model estimates rather than listening tests, and the gaps near the top are small. FAAC 3.0 trades a little of 2.2’s speed for its quality.

Still, a listener can catch FAAC out on one clip, and that’s where this story ends.


The Rules

FAAC 2.0 was built for the edge: IP cameras and other hardware where every kilobyte and CPU cycle is budgeted. Chasing the top of a leaderboard didn’t change that. Every stream still had to be legal under the AAC spec, play on real decoders, and pay for itself in code size and speed.

I built a new decoder, FAAD3, partly so I could read what Apple and FDK put in their streams. That was research, not a blueprint: their approach comes with a heavier, slower machine. FAAC had to find its own bargains.


Keep Only What Pays

An AAC encoder constantly chooses how coarsely to store each slice of the spectrum. One of my experiments searched for those choices exactly. A higher score can simply be bought with more bits, so my benchmark asks a stricter question: how many bits does a change need for the same score? By that measure, the search needed about 2.6% fewer bits, a real win that took 244% more CPU instructions.

I tried to imitate the search cheaply with small predictors. Every one of them did worse than doing nothing.

Taking the search apart worked better. Part of its gain needed no expensive measurement at all: neighboring choices are stored as differences, so keeping them close to each other saves bits. What shipped does only that, nudging a choice one step coarser when it becomes cheaper to write down. In a comparable test it kept a little under half of the search’s gain for roughly 1% of the extra work.


Spending Noise to Buy Detail

The clearest bargain is in the treble. At 128 kbps, most of FAAC’s bands above 12 kHz don’t carry the original signal. They’re filled with noise at the right level, using a tool in the AAC spec called Perceptual Noise Substitution. Noise costs very few bits, so FAAC can keep a wide frequency range and spend the savings lower down. By the benchmark’s judge, turning it off would cost about 5% more bits for the same score.

Apple makes the opposite bet: it codes real detail in about half of those bands and leaves the rest empty.


Better Encoder, or Better at Pleasing the Judge?

My benchmark’s judge is software, built to estimate what people hear. In a small test at a lower bitrate, one of its two scoring models rated those empty bands far below FAAC’s noise fill.

So some of FAAC’s lead may be real, and some may be the judge’s taste. A Hydrogenaudio forum member, thientnct, noticed from the outside that leading encoders generally avoid this tool. It’s a fair challenge, and another score can’t answer it.

I had tried my own ears. I blind-tested an earlier change that looked cheaper to the judge, partly by adding more noise. I couldn’t hear a difference, and concluded that I’m bad at ABX tests.


What Ears Caught

Better listeners can, and they had already caught things my scores missed.

AAC allows two shapes of “window,” the curve applied to each block of audio before it’s encoded. FAAC had only ever used one. The other, the Kaiser-Bessel Derived (KBD) window, had sat unused in the code since 2001.

In September I tested it before deleting it. Forced on everywhere, it usually lost. On long blocks only, it was a wash. My verdict was “not a quality lever.”

Less than three weeks later, a forum member, tworojok, reported clearly audible noise on a bass-heavy intro and attached a sample. A loud, low note was leaking across the spectrum and coming out as haze. My test set had no passage like it, and the score barely registered the defect. Within a day the benchmark gained a haze test.

That’s how we discovered what KBD is good for. FAAC now tries it on long blocks and picks it only when it removes enough of that leakage, and the haze all but disappears. I had asked whether KBD raised the average. The useful question was when it pays.

The second report tested a claim I had made in public. In the 2.0 post I wrote that FAAC delivered “effectively transparent audio” at 128k and above. In October, Julien took the newer FAAC 2.2 at 128 kbps and ran ABX tests, blind trials where you have to work out which file is the compressed one. Two clips, eig and fatboy, were easy to catch, and on fatboy the sharp attacks were audibly smeared. Julien got fatboy right 8 times out of 8, something pure guessing would manage about once in 256 tries. An average score had let me claim too much.

That report gave me a concrete target: pre-echo, the smear that arrives ahead of a sharp hit. It also prompted me to measure it in my benchmark. Then came a change that spends more bits where an attack begins. On attack-heavy clips at 128 kbps, it brought pre-echo to FDK’s level. The overall score slipped slightly, and I merged it, because sound quality now meant more than my old definition of success.


Not a Straight Line

Re-measured for this post, pre-echo crept up while the score climbed, then fell sharply once Julien’s report led to the attack fixes. Those fixes were two of the 73 experiments picked for this chart. Nothing else that shipped points down, and most dead ends didn’t hurt either: 24 of 43 made no clear change.

Shape shows how each experiment did on its own tests; filled means it shipped. Hollow marks, including ones that helped but weren’t worth keeping, never reached the two lines, which were measured for this post at ten commits. Diamonds are attack fixes that shipped although the old measure said no. Orange lines mark listener reports. Hover for details or click to open.


Ears Decide

After 3.0 came out, Julien tested again. This time Julien couldn’t pick out eig. fatboy was much improved but still gave itself away 7 times out of 8, odds of about 1 in 28 by luck, with a “coarseness” on the “druggy, druggy, druggy” part of the loop.

My automatic scores rate fatboy very high, yet a person can still hear it. That’s good news: it gives the next release a target.

This is how FAAC has been winning: I trust measurements, and listeners show which ones are missing. You can be the next one, and you’re probably better at ABX than I am:

  1. ABX FAAC 3.0 at 128 kbps ABR against whichever encoder you normally use.
  2. Use clips you know well. Ones outside my test set are worth the most, because that’s where tuning to my own material would show. If noise filling is fooling my scores, bright, treble-heavy clips are where you’d hear it.
  3. Post the clip name, encoder versions, and log in the Hydrogenaudio thread or on GitHub. Only share audio you have permission to share.

The listening guide explains how to run a fair test, and FAAC 3.0 is on GitHub.

The leaderboard got FAAC this far. Your ears can take it further.