💾 Archived View for nytpu.com › gemlog › 2023-06-27.gmi captured on 2023-07-10 at 13:20:10. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
In my now slightly outdated post about using NetMD devices with Linux, I included an appendix comparing LP2 and LP4 audio (as encoded by atracdenc) with MP3. I wanted to expand that into a full post with many more comparisons, since I'd always heard that the quality of ATRAC audio *greatly* depends on what encoded it, with decoding not having a significant effect—i.e. you can use a high-quality encoder and then play it back on a device with a bad encoder and still have the good encoder's quality.
I was on paper waiting until I got a “top of the line” recorder like a Hi-MD unit or something, but really I just didn't see a strong reason to make a post solely comparing atracdenc's quality, especially since atracdenc itself says the quality of its encodings is subpar. A year ago someone discovered exploits in most NetMD players that allow you to dump raw audio data off of discs, which revived my interest in a comparison but I still put off pursuing it.
…Until a few days ago. I found out about an official Sony ATRAC3 encoder called `at3tool` that came with the PlayStation Portable SDK. It's supposed to be even better than any hardware encoder and the encoder that came with SonicStage; and after “obtaining” a copy of PSP SDK I was delighted to find it even had a Linux version that I could directly use! I'd only seen references to an `at3tool.exe` and assumed it was Windows-only like SonicStage was, dreading the inevitable pain of trying to get non-mainstream software running in Wine.
Finally, several reasons to do a full ATRAC comparison post! So here it is, a semi-comprehensive roundup. I have samples encoded with ATRAC1 at SP quality from Type-R hardware as well as atracdenc (AFAICT there's no readily available official ATRAC1 encoder), and ATRAC3 samples in LP2 & LP4 quality from hardware, at3tool, and atracdenc. I also included the original lossless audio sample and MP3 & OPUS versions for comparison.
The audio sample used is from the track “Alternative Treatment” from the album 10 Years by an Unkindness.
10 Years is licensed under the terms of the CC BY-NC-SA 3.0
It really is a fantastic album, you should check out the whole thing
The ATRAC3 samples unfortunately will most likely not play with your browser's built-in media player. They should be decodable by anything that uses libavcodec in its backend: VLC, MPV, mplayer, and most desktop music players should work. While your browser that likely uses libavcodec too, many browsers disable more obscure formats for nebulous reasons.
Also, if you'd prefer to download all the files at once, here's an archive with all of them:
Original lossless audio sample. Converted from FLAC to WAV since all the utilities expect raw PCM audio. I confirmed that despite being a digital download rather than a CD rip, it is true 44.1 kHz 16-bit audio.
ATRAC1/SP mode, 292 kbit/s. Approximately equivalent encodings in other formats are grouped in.
ATRAC3 in LP2 mode, 132 kbit/s.
ATRAC3 in LP4 mode, 66 kbit/s.
Note that for all the ATRAC1 tests, the AEA files have versions converted back to WAV. While ffmpeg can decode AEA files, almost all media players I've tried refuse to play them; so it is much easier to play back a WAV file that is losslessly[1] transcoded from the ATRAC1. The original AEA files are included in the ZIP for those interested, or available at these links:
[1]: “losslessly” as in faithfully reproducing encoding artifacts, as the audio itself clearly isn't lossless.
IMO the hardware SP encoder is marginally better than atracdenc. For LP2 and LP4, the PSP at3tool is marginally better than hardware encoder which is itself marginally better than atracdenc.
All ATRAC encodings blow MP3 of a similar bitrate out of the water, especially as you get into lower bitrates; but Opus of an equivalent bitrate is always unequivocably better, to an astonishing degree. Even Opus of *half* the bitrate remains better than ATRAC and MP3 until you get up to “transparent” bitrates (i.e. SP mode).
However, as with many audio encoding comparisons, when not comparing side by side it is very difficult to tell. It's only when you get into LP4 that you can begin readily telling which format is which—all formats have awful compression artifacts and they all have different-sounding ones. Honestly, while I consider 128 kbit/s MP3s unlistenable for music, LP2 is really good and I can barely tell the difference between SP even when playing side-by-side, and I retain my preference for using it on most of my MiniDiscs (although I will be switching to at3tool for the marginal benefits).
SP is just silly good and unless you have a multi-thousand-dollar hi-fi system it's impossible tell the difference between it and lossless. Even with an absurd hi-fi system I still lean more towards “audiophile hogwash” rather than there being any human-audible differences. Especially since I'm younger and can hear the highest-pitch frequencies encodable by 44.1 kHz[2] that most people even a few years older can't.
[2]: highest-pitch frequencies encodable by 44.1 kHz
SP hardware test was done by transferring the raw WAV to MiniDisc using Linux-Minidisc-FFWD, which uses the hardware ATRAC encoder. LP2 and LP4 hardware tests were done using real-time dubbing over a TOSLink optical cable from my MacBook Pro 2015 running Artix Linux and the JACK real-time sound server. Afterwards all samples had the raw audio tracks copied off with Web MiniDisc's “Homebrew Mode Ripping”—exploits in the recorder's firmware that allow copying the raw audio off the disc like a MZ-RH1. They were all conducted on a Sony MZ-N505 with ATRAC Type-R and a fresh battery.
The ripping gave me a raw AEA file for the ATRAC1 test, but for some reason wrapped the AT3 streams (LP2 & LP4) in a WAV container. That WAV container still contains the raw, unmodified ATRAC3 stream though. Check with `ffprobe -i lp2_hardware.wav` if you don't believe me.
These commands were run to encode the software-generated samples:
ffmpeg \ -i "/mnt/storage/Music/FLAC/an Unkindness - 10 Years/11 - Alternative Treatment.flac" \ -ss 00:00:53 -to 00:01:12 -map_metadata -1 \ raw.wav # dubbed raw.wav to disc and downloaded back as detailed above... ffmpeg -i sp_hardware.aea sp_hardware.wav atracdenc --encode -e atrac1 --bitrate 292 -i raw.wav -o sp_atracdenc.aea ffmpeg -i sp_atracdenc.aea sp_atracdenc.wav atracdenc --encode -e atrac3 --bitrate 128 -i raw.wav -o lp2_atracdenc.at3 atracdenc --encode -e atrac3_lp4 --bitrate 64 -i raw.wav -o lp4_atracdenc.at3 at3tool -e -br 132 raw.wav lp2_at3tool.at3 at3tool -e -br 66 raw.wav lp4_at3tool.at3 lame -V 1 raw.wav lame_vbr1.mp3 lame -b 320 raw.wav lame_320.mp3 lame -b 128 raw.wav lame_128.mp3 lame -b 64 raw.wav lame_64.mp3 opusenc --vbr --bitrate 128 raw.wav opusenc_128.opus opusenc --vbr --bitrate 64 raw.wav opusenc_64.opus opusenc --vbr --bitrate 32 raw.wav opusenc_32.opus
Note that the bitrates for atracdenc had to be slightly fudged to the nearest power of 2 because otherwise it misencodes the audio and nothing else can decode it (everything else that uses atracdenc also fudges the bitrate like above). Conversely, when using at3tool the bitrates *must* be the exact values specified for LP2 and LP4 modes, because otherwise it'll automatically switch to ATRAC3plus mode which would not be a fair comparison with plain ATRAC3. At any rate ATRAC3plus is only supported on Hi-MD recorders so it's pointless when looking at for standard MiniDiscs.
Linux-Minidisc-FFWD, improved netmdcli/libnetmd codebase
Web MiniDisc Pro, using netmd-exploits in the backend
ffmpeg, general-purpose multimedia handler
atracdenc, FOSS ATRAC1 and ATRAC3 encoder
LAME, high-quality MP3 encoder
opusenc, official Opus encoder
$ at3tool SCEI ATRAC3plus Codec TOOL Version 3.0.0.0 *** built w/ ATRAC3plus library version 1.02 *** $ cd ~/Tools/atracdenc && git log --pretty=reference -n 1 52271de (Add support for writing .at3/.wav files with ATRAC3 (#30), 2022-05-08) $ ffmpeg -v ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 13.1.1 (GCC) 20230429 libavcodec 60. 3.100 / 60. 3.100 libavformat 60. 3.100 / 60. 3.100 libswresample 4. 10.100 / 4. 10.100 $ lame --version LAME 64bits version 3.100 (http://lame.sf.net) $ opusenc --version opusenc opus-tools 0.2 (using libopus 1.4)
(Listings trimmed down to the relevant version numbers for brevity)
I've updated my netmd-upload script to support using at3tool if it's installed, falling back to atracdenc otherwise:
There is some weirdnewss to install at3tool. After downloading the SDK from the link above, it's buried at the following path: `psp_sdk_660/usr/local/psp/devkit/tool/at3tool`.
You either need to temporarily add the libatrac.so library to your library path like
export LD_LIBRARY_PATH="$(pwd)/libatrac.so.1.2.0:${LD_LIBRARY_PATH}" ./at3tool
Or install at3tool globally:
install -m755 libatrac.so.1.2.0 /usr/local/lib/ ln -s /usr/local/lib/libatrac.so.1.2.0 /usr/local/lib/libatrac.so.1 ldconfig install -m755 at3tool /usr/local/bin/
(run all of the above as root, prefixing all with `sudo` or whatever.)
⁂