Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: TSAC: Very Low Bitrate Audio Compression (Read 3979 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

TSAC: Very Low Bitrate Audio Compression

TSAC: Very Low Bitrate Audio Compression available at : https://bellard.org/tsac/ . It achieves about 5.5 kb/s for mono or 7.5 kb/s for stereo at 44.1 kHz with a good perceptual quality. It is based on a modified version of the Descript Audio Codec and a Transformer model to further increase the compression ratio.

Re: TSAC: Very Low Bitrate Audio Compression

Reply #1
TSAC (2024-04-08) displays help when running without flags on my end and crashes when encoding.

Command: tsac.exe -v c tolle.wav tolle.tsac
Source: PCM 44.1 kHz, 16-bit, 2 channels
Setup: Core2Duo with SSE3, 4 GB RAM, Windows 7 x64


• Join our efforts to make Helix MP3 encoder great again
• Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs
• Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data

Re: TSAC: Very Low Bitrate Audio Compression

Reply #2
Sorry it is not in the readme file : a CPU with AVX2 support is required to use the program.

Re: TSAC: Very Low Bitrate Audio Compression

Reply #3
@fab7, is AVX critical for TSAC? Perhaps you could recompile it to work with a wider range of hardware? Or at least could you explain why a very low bitrate audio compression tool, whose output is designed to use as few resources as possible for storage and transmission, requires modern hardware for encoding? E.g. Google Lyra works on my end.
• Join our efforts to make Helix MP3 encoder great again
• Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs
• Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data

Re: TSAC: Very Low Bitrate Audio Compression

Reply #4
@fab7, is AVX critical for TSAC? Perhaps you could recompile it to work with a wider range of hardware? Or at least could you explain why a very low bitrate audio compression tool, whose output is designed to use as few resources as possible for storage and transmission, requires modern hardware for encoding? E.g. Google Lyra works on my end.
TSAC needs a lot of compute power. That's why a GPU is recommended. Using an AVX2 capable CPU is possible but quite slow. I don't think it is worth supporting older CPUs because it would be too slow to be usable.

Re: TSAC: Very Low Bitrate Audio Compression

Reply #5
I am impressed by the sound sample on the web site! Imagine the small size of podcasts and audio books using the ~2kbbps!

What kind of CPU speeds are needed to decode in realtime?

Re: TSAC: Very Low Bitrate Audio Compression

Reply #6
Assuming the samples posted on the website are genuine, and I'm not suggesting that they are not, the quality at ridiculously low bitrates is quite extraordinary. This should be followed with interest. There comes a point with developments of this nature where supporting older hardware becomes irrelevant and is not the target audience. One cannot, and should not, support decades old hardware and OSs for ever.

Re: TSAC: Very Low Bitrate Audio Compression

Reply #7
Using the Linux build on my Intel(R) Core(TM) i3-7100U CPU @ 2.40GHz the encoding speed using CPU mode was about 0.5x. Decoding was almost the same. The audio I encoded ended up being 8.35 kbps and the sound quality was impressive for that bitrate. The sound quality of distorted guitars sound like too much noise reduction has been used and ambience/reverbs are attenuated. When I listen to my low quality speakers in my laptop I can gladly listen to the TSAC encoded files.

The encoder only used on logical core even though I passed -T 2. That logical core used 100% CPU while the three others were idling.

The music in the attached files is Lagwagon - Beer Goggles.


Re: TSAC: Very Low Bitrate Audio Compression

Reply #9
I tried, and it worked wonder.

encoding:
Code: [Select]
./tsac -v -q 12 --separate_channels -m dac_stereo_q8.bin -M tsac_stereo_q8.bin c ../../music300sec.wav ../../music300sec.q12.separate.tsac
decoding:
Code: [Select]
./tsac -v -m dac_stereo_q8.bin -M tsac_stereo_q8.bin d ../../music300sec.q12.separate.tsac ../../music300sec.decoded.wav

However, typical use cases should be more concerned about fidelity than the bit rate. Can't I increase the quality even more than the -q 12 --separate_channels?
I would like to perform a private double-blind test of TSAC against USAC, exhale-v1.2.1 and exhale-v1.1.9.

Re: TSAC: Very Low Bitrate Audio Compression

Reply #10

However, typical use cases should be more concerned about fidelity than the bit rate. Can't I increase the quality even more than the -q 12 --separate_channels?

I would like to perform a private double-blind test of TSAC against USAC, exhale-v1.2.1 and exhale-v1.1.9.

These codecs target discernibility, not fidelity. And their biggest problem is potential hallucinations. So, what testers should be looking out for most, IMHO, are issues like completely the wrong letter being pronounced, not the general quality of the output.

One can think of these codecs as good lip readers. Fun, cool, and maybe impressive, but not something one would/should use with trust in practice.

As for exhale. Per the project's own README, the encoder shouldn't be used for very low-bitrate use cases, or considered representative of USAC's full potential at such rates.

Re: TSAC: Very Low Bitrate Audio Compression

Reply #11
These codecs target discernibility, not fidelity. And their biggest problem is potential hallucinations. So, what testers should be looking out for most, IMHO, are issues like completely the wrong letter being pronounced, not the general quality of the output.

I haven't heard a single case like that in my several minutes of listening tsac, but I'm going to be careful whether anything like that is present in the decoded sounds.

Re: TSAC: Very Low Bitrate Audio Compression

Reply #12
-q value(number of codebooks, which sets the quality and bit rate) vs Bitrate table, 44.1kHz music albums, for those wondering.

commandlinebitrate (kbps)speed (x realtime in Ryzen 7 5700X)
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 1 in.wav out.tsac5571.1
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 2 in.wav out.tsac11431.1
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 3 in.wav out.tsac17441.1
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 4 in.wav out.tsac23851.1
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 5 in.wav out.tsac30371.1
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 6 in.wav out.tsac36891.1
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 7 in.wav out.tsac43361.0
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 8 in.wav out.tsac49821.0
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 9 in.wav out.tsac56191.0
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 10 in.wav out.tsac62531.0
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 11 in.wav out.tsac68741.0
./tsac-2024-04-08-win64 -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 12 in.wav out.tsac74971.0
The commandline is according to the -h output. Spoiler (click to show/hide)

Re: TSAC: Very Low Bitrate Audio Compression

Reply #13
It's a pity to realize that TSAC needs a lot of computing power. Why? Because there are still plenty of places on Earth where people either can barely afford access to electricity (e.g. in Madagascar, 600 000 households out of 5.8 million) or it becomes expensive and requires to tighten the belts (e.g. in Europe, prices of electricity and gas have surged as much as 15-fold since 2021). As you know, power-hungry operations drain the battery of portable devices much faster, requiring frequent recharging, thereby shortening the lifespan and forcing to break the piggy bank again. And what for? For an audio-book to take up a little less space than, say, 22 kHz 32 kbit/s or 24 kHz 40 kbits/s fast and battery-friendly MP3 (encoded not by LAME, but by the resurrected Helix)? A dubious trade-off. Thus, TSAC, at least until its intended scope is officially announced, appears to be an academic study on sound compression using a GPU, which at first may stun with the grandeur, but in practical terms there is a sore temptation to take it as another exhibition of exotic animals.

The need to hear is so dire on our planet that the compression that makes it difficult to access the myriads of stories conveyed via sound vibrations is doomed either to niche status or to oblivion. A few decades ago in the US, people of color were forced to ride in a different part of the bus, and today it is not uncommon to meet a programmer (not you, dear @fab7) who is one step away from forcing users to be content with the sound of rain and wind if they are not in a hurry to buy the latest Silicon Valley stuff. What is it if not the resurgence of segregation, albeit in the digital domain? Think of a Cuban barista, a Palestinian builder, and a Tibetan teacher, not to mention the frugal residents of former Western colonies and millions of families who lost their savings due to tragedies such as earthquakes and floods, bank failures and wars — they are lucky to get second-hand vintage hardware, rent it or receive as a gift. Can we treat them as brothers and consider their cases when developing apps solutions? Or will our vision remain clouded by an intellectual feast divorced from empathy, with arguments about the elusive difference between 44.1 and 192 kHz?
• Join our efforts to make Helix MP3 encoder great again
• Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs
• Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data

Re: TSAC: Very Low Bitrate Audio Compression

Reply #14
One word - amazing.
How on Earth did you achieve this? Amazing quality at such low bitrate.
It took around ~12-13 seconds with RTX 4070 to encode 4 minute song.
I also included 30 second sample if somebody is interested.
gold plated toslink fan

Re: TSAC: Very Low Bitrate Audio Compression

Reply #15
My GPU is too old and weak (GTX950 2GB) so looks like it is unsupported, but in terms of CPU speed (i3-12100) it is not really slow when compared to something like flac -8pe (of course, flac decoding is much faster), especially when considering tsac is based on bleeding edge tech.

I also suspected that it may spew out wrong lyrics and such, so I encoded a song with a less popular language but I found no issue.

One issue I found is that the decoded version is somewhat louder than the input and even with some clipped samples, can it be fixed?

[edit]Also attached the encoded tsac file so that @fooball can have some idea about file size.

Re: TSAC: Very Low Bitrate Audio Compression

Reply #16
I also included 30 second sample if somebody is interested.
Please confirm whether I understand this correctly: the "[FLAC]" file is a FLAC encode of the sound clip, and the "[TSAC]" file is a FLAC encode of the same sound clip after it's been TSAC encoded and decoded?

In which case, how big was the TSAC file?

It would also be interesting to hear a (eg) AAC version of the same clip encoded into the same size file.
It's your privilege to disagree, but that doesn't make you right and me wrong.

Re: TSAC: Very Low Bitrate Audio Compression

Reply #17
On Windows 10 Professional, when --cuda is enabled, error message
Code: [Select]
Could not load: cublasLt64_12.dll (error=126)
was fixed by installing CUDA Toolkit 12.0, Windows, x86_64, Version 10, exe(local), install it, and copy dll from NVIDIA GPU Computing Toolkit\CUDA\v12.0\bin\cublasLt64_12.dll to the same folder as tsac.exe. The dll is 465,925,120 bytes so be careful.
https://developer.nvidia.com/cuda-12-0-0-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exe_local

Re: TSAC: Very Low Bitrate Audio Compression

Reply #18
-q value(number of codebooks, which sets the quality and bit rate) vs Bitrate vs Encoding speed table, 44.1kHz music albums.
TSAC is capable of encoding music at about 17 times faster than the realtime in GPU GeForce RTX 3060.

commandlinebitrate (bps)encoding speed (x realtime in NVIDIA GeForce RTX 3060)
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 1 c in.wav out.tsac55728.0
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 2 c in.wav out.tsac114326.6
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 3 c in.wav out.tsac174525.2
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 4 c in.wav out.tsac238524.0
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 5 c in.wav out.tsac303722.9
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 6 c in.wav out.tsac368921.9
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 7 c in.wav out.tsac433620.9
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 8 c in.wav out.tsac498220.0
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 9 c in.wav out.tsac561919.3
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 10 c in.wav out.tsac625318.6
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 11 c in.wav out.tsac687417.9
./tsac-2024-04-08-win64 --cuda -m dac_stereo_q8.bin -M tsac_stereo_q8.bin -q 12 c in.wav out.tsac749717.2

Re: TSAC: Very Low Bitrate Audio Compression

Reply #19
@Kamedo2

How is the decoding speed when CUDA is utilized. Software decoding is actually slower than encoding on my workstation.

----

I gave it a quick test yesterday (speech tests only). The quality is very impressive. No hallucinations noticed either. There was one case where not the clearest N sound (like the one here) sounded closer to an L. But that can be attributed to bit starvation, and the subtle issue goes away at higher qualities.

Comparing lower bitrate encodes against LPCNet, and higher bitrate ones against Opus with new ML decoding, and the difference is night and day. But LPCNet and Opus are bounded by practicality and format compatibility, so the comparison is not really fair!

Re: TSAC: Very Low Bitrate Audio Compression

Reply #20
Hmmm, what about Turing support? OpenCL?

Re: TSAC: Very Low Bitrate Audio Compression

Reply #21
Quote
It's a pity to realize that TSAC needs a lot of computing power. Why?

I'll take the exceptionally obvious bait, because why not:

Sometimes its nice to program something just to see if something is possible, without any regard to how its supposedly meant to be done by others. Sometimes coding can be a creative exercise to solve a particular problem with completely random out of the box solutions. Such as requiring AVX2 or even GPGPU methods. Or sometimes programming something without actual needed care for resources because it works for yourself fine is enough of a reason. Considering who wrote TSAC, no doubt it was one such exercise, like thier other mini projects.

Case in point: one of my personal things which requires GL4.6/GLES2, Windows 10/modern Linux, C++20, SSE4/NEON etc. I do it because its intended for me only and my stuff runs it just fine. Even a old Linux box and RPI4.

Re: TSAC: Very Low Bitrate Audio Compression

Reply #22
[edit]Also attached the encoded tsac file so that @fooball can have some idea about file size.
Thanks... but I had no idea my question had been answered (until I happened to chance on it now).  Updating something up-thread doesn't get flagged up.

100x compression is incredible!
It's your privilege to disagree, but that doesn't make you right and me wrong.