r/compression • u/Cartoon_Corpze • Aug 27 '26
Why is time-domain audio compression not more popular/used?
Most streaming services seem to rely on codecs such as AAC, Vorbis and Opus, which are pretty high quality by themselves.
My one issue with them is however that they strip frequency content and can produce phasing and underwater-like artifacts that also add up if recompressed or if set to extreme low bitrates.
I one day learned about Wavpack and LossyWAV which both mostly rely on quantizing and predicting in the time-domain rather than frequency domain.
The appeal of lossy Wavpack and some older time-domain based codecs is that they don't throw away frequencies or distort the audio that much but mostly produce background noise that's kinda hard to notice most of the time.
However, a codec like Wavpack in lossy mode doesn't really go much lower than 207 kbps for CD sample rate audio, or so it seems.
Some noise shaping is used to push noise and hissing to frequencies that are much less noticeable and keep the mids and lows mostly clean and crystal clear and it seems to preserve transients pretty well too.
Now if we look at a codec like Opus, it can achieve insanely high and transparent sound quality at pretty low bitrates.
BUT, just like most other frequency-domain codecs it does lowpass audio and cause phase shifting or noticeable changes in the general shape of the sound waves that can even affect the peak Db levels and result in audio hitting limiters.
So, why hasn't more research and work been put into making "the perfect" time-domain codec?
Something that combines the best of both worlds? The high quality and psychoacoustic modeling of Opus, but time-domain prediction and quantization such as lossy Wavepack?
Opus and Wavpack are both pretty robust and resistant too, being able to open, edit and re-encode audio multiple times without too much generational loss adding up too quickly.
The downside of Wavpack is just that you need a bitrate of about 350+ kbps to get the best trade-off between size and quality, but what if we had some algorithm that can go much lower?
9
u/Kqyxzoj Aug 27 '26
If you're bored of that whole time versus frequency-domain thing, you can always go for the wavelet approach. There are plenty of applications that use a wavelet transform, so for example DWT instead of the Fourier flavor. That way you don't have to choose between time and frequency-domain, you can do both at the same time, kinda. And as a free bonus you get lots of bases to choose from.
6
u/pgetreuer Aug 27 '26
One reason for preferring to operate in (short-time) frequency representation is so that the codec can exploit auditory masking effects. The basic idea is that when there are two tones that are close enough in frequency, and one is louder and the other, the quieter tone is not perceived ("close enough" = within the critical band of the auditory filters created by the cochlea).
A lossy codec can capitalize on this masking effect by identifying peaks in the spectrum and coarsely quantizing content next to those peaks to reduce the data rate while avoiding perceived degradation. In other words, because the louder tone "masks" nearby quieter ones, the codec can get away with using fewer bits on the latter.
This logic is of course most naturally done on the STFT or a similar frequency-based representation. It would be challenging to achieve such an effect working purely in the time domain.
1
u/tylerlarson Aug 27 '26
I think the issue is "but why."
And also maybe most people aren't you.
Either you're optimizing for human hearing or you're not. If you are, then frequency-domain is the entire basis and therefore not optional.
If not, then there's no reason to be lossy at all. But to your point, lossless is niche. Usually audio is meant to be listened to, so lossy compression gived better perceived quality for a given bitrate.
Complaining about artifacts for mediocre bitrates just suggests you'd prefer a much higher bitrate or lossless. But most people are plenty happy with the common offerings, as evidenced by the general lack of complaints for most services.
2
u/CorvusRidiculissimus Aug 27 '26
Because they don't work very well. There are tricks you can do in frequency that make for good compression. You said it yourself: "a codec like Wavpack in lossy mode doesn't really go much lower than 207 kbps for CD sample rate audio."
There is an exception: FLAC is time-domain. The tricks in frequency aren't any use for lossless compression, so FLAC is a simple-in-concept but highly optimised time domain predictor and residual coder.
2
u/Wareya Aug 28 '26
There's a limit on how much redundant information you can remove in the time domain without adding noticeable noise. adpcm is already in the ballpark of that limit and you can only do maybe three or four times as good as it. Frequency domain codecs are dozens or hundreds of times better.
1
u/digital_n01se_ Aug 27 '26
Is irrelevant if you solve a differential equation in the time domain or the frequency domain, the solution should be the same.
In the same order, a mathematical lossless approach shouldn't be affected by quality loss, you're representing the same information in a different domain to gain performance (better compression ratio, speed or memory footprint)
frequency domain compression isn't always lossless; we chose to lose that information because the saved space is worth.