Science and technology

Recovering audio from a misplaced format with open supply

Back within the early 2000s, we made a household determination to improve the lounge stereo. The tools in place on the time was based mostly on a set of substances that I had bought some 20 years earlier once I first had a gentle post-university revenue. That early assortment might finest be described as “industrial chic,” most notably the Hafler amplifiers I had constructed from kits and the Polk speakers made out of some type of composite wooden product and completed with an unpleasant faux-rosewood vinyl wrap. They produced respectable sound, however the dorm-room-style decor simply wasn’t understanding in the lounge.

Those of you who keep in mind the early 2000s will recall that a lot of the world was nonetheless consuming music on CD. Our household was no exception, and we ended up with a high quality CD participant that had an fascinating function—it was capable of decode common CDs in addition to high-definition-compatible digital (HDCD) discs.

According to Wikipedia, HDCD is a proprietary audio encode-decode course of that claims to supply elevated dynamic vary over that of ordinary Red Book audio CDs, whereas retaining backward compatibility with present compact disc gamers.

The manual for our CD player states: “HDCD system is manufactured under license from Pacific Microsonics, Inc.” and “HDCD is a digital signal processing system developed by Pacific Microsonics of California which conceals control codes into a very small fraction of the recorded CD digital audio stream. An HDCD decoder recognizes these control codes and uses them to process the digital audio to increase its dynamic range and resolution, while leaving the original digital stream compatible with conventional CD players.”

How does HDCD work this magic, it’s possible you’ll ask? The identical Wikipedia entry states, “HDCD encodes the equivalent of 20 bits worth of data in a 16-bit digital audio signal by using custom dithering, audio filters, and some reversible amplitude and gain encoding; Peak Extend, which is a reversible soft limiter; and Low-Level Range Extend, which is a reversible gain on low-level signals.”

Whatever the deserves of this expertise, its mum or dad firm was unable to proceed enterprise and ceased operations someday in 2000. The Wikipedia article signifies that Microsoft acquired the corporate and included code in Windows Media Player to permit the decoding of HDCD, however seemingly misplaced curiosity in its promotion. Perhaps this was because of the emergence of different proprietary high-resolution audio codecs corresponding to SACD and DVD-A, which have been capable of encode a full 24 bits of sign on a similar-looking however incompatible media. Neither of those latter codecs was particularly profitable, not less than not in business phrases, although studios proceed to launch music on SACD. As it occurs, SACD included a “hybrid” customary that offered each SACD and backward-compatible CD layers on the identical disc, permitting the playback of these albums on common CD gamers at customary CD decision.

How many artists and studios really made use of HDCD? Well, Discogs presents a list of 11,284 HDCD recordings (as of this writing). This web site presents an fascinating evaluation of among the amenities HDCD offered, utilizing precise HDCD encoded music. And for these within the authentic patent, which Google Patents claims has expired, it can be found here.

My HDCD story

Anyone who’s sufficient in audio tools to learn promotional brochures or audiophile magazines will acknowledge the fascination many audiophiles have with proprietary designs—they appear to view a patent as validation of the tools that makes use of that expertise.

Though now I do what I can to keep away from being swayed by “proprietary technology fascination,” I admit I used to be not such a staunch proponent of all issues open again within the early 2000s. Not solely did I purchase the aforementioned high quality CD participant with its proprietary innards, however I additionally purchased—the horror!—a couple of precise HDCD-encoded titles.

This previous weekend, I managed to seek out three of them in our assortment, however I’m sure there are extra. The three I managed to seek out embody Ensemble Dumont’s La Messe du Roi, Musica Secreta’s Dangerous Graces, and the Orchestra of the Age of Enlightenment’s Vivaldi Concerti, all from the Linn Records Linux-friendly music store. While ensuring these titles have been nonetheless out there, I observed that they’re now not provided in HDCD.

Given that I’ve these albums readily available and that the patent appears to have expired, I made a decision to seek out out whether or not I might convert these discs of their full meant decision to an open music format, and furthermore, whether or not I might accomplish that with out utilizing proprietary software program.

The first software program I stumbled upon for decoding HDCD format was hdcd.exe., described and offered here. Since the supply code for this software program was not provided, and because it required Windows, or not less than Wine, to run, my preliminary curiosity largely evaporated.

The Wikipedia article famous above talked about that another Windows-based music gamers provided HDCD decoding. Hmm. But then I noticed:

“FFmpeg’s libavfilter includes an HDCD filter as of FFmpeg 3.1 (June 2016) that will convert 16-bit PCM with HDCD data to 20-bit PCM.”

This appeared like a promising place to begin, so I put in ffmpeg from my distro’s repositories, after which went in search of some extra hints, at which level I discovered the very concise description on hydrogenaudio, which even provides a script for locating HDCD-encoded recordsdata in a single’s music listing. I used the road that runs ffmpeg in opposition to one of many recordsdata ripped from the Musica Secreta CD talked about beforehand, as follows:

ffmpeg  -hide_banner -nostats -y -v verbose -i
'01 - Musica Secreta - Questi odorati fiori.flac'
-vn -af hdcd -f s24le /dev/null 2>&1 | grep "_hdcd_"

and acquired the next output:

[Parsed_hdcd_0 @ 0x55b2137e2c80] Disabling computerized format conversion.
[Parsed_hdcd_0 @ 0x55b2137e2c80] Auto-convert: disabled
[Parsed_hdcd_0 @ 0x55b2137e2c80] Looking for 16-bit HDCD in pattern format s16
[Parsed_hdcd_0 @ 0x55b2137e2c80] CDT interval: 2000ms (88200 samples @44100Hz)
[Parsed_hdcd_0 @ 0x55b2137e2c80] Process mode: course of stereo channels collectively
[Parsed_hdcd_0 @ 0x55b2137e2c80] Force PE: off
[Parsed_hdcd_0 @ 0x55b2137e2c80] Analyze mode: [0] disabled
[Parsed_hdcd_0 @ 0x55b2137e2c80] Channel zero: counter A: zero, B: 1657, C: 1657
[Parsed_hdcd_0 @ 0x55b2137e2c80] Channel zero: pe: 1657, tf: zero, almost_A: zero, checkfail_B: zero, unmatched_C: zero, cdt_expired: zero
[Parsed_hdcd_0 @ 0x55b2137e2c80] Channel zero: tg zero.zero: 1657
[Parsed_hdcd_0 @ 0x55b2137e2c80] Channel 1: counter A: zero, B: 1657, C: 1657
[Parsed_hdcd_0 @ 0x55b2137e2c80] Channel 1: pe: 1657, tf: zero, almost_A: zero, checkfail_B: zero, unmatched_C: zero, cdt_expired: zero
[Parsed_hdcd_0 @ 0x55b2137e2c80] Channel 1: tg zero.zero: 1657
[Parsed_hdcd_0 @ 0x55b2137e2c80] Packets: sort: B, whole: 3314
[Parsed_hdcd_0 @ 0x55b2137e2c80] HDCD detected: sure, peak_extend: enabled completely, max_gain_adj: zero.zero dB, transient_filter: not detected, detectable errors: zero

Note the final line above mentioning that HDCD was, actually, detected. Also, plainly the “peak extend” functionality is enabled. As I perceive this functionality, it reverses the compression/limiting utilized to the loudest elements of the music after dropping the general sign degree by an element of two, thus restoring among the authentic recording’s additional dynamic vary. Goodwin’s High End’s web page has an in depth description of this matter here.

At this level, it was time to do this entire factor out. For some purpose, I didn’t really feel assured doing a one-step conversion from 16-bit undecoded FLAC to 24-bit decoded FLAC, so I ran the conversion in two steps, as follows:

for f16 in *.flac; do
trk=`basename "$f16" .flac`
w24="$trk"_24.wav
ffmpeg -i "$f16" -af hdcd -acodec pcm_s24le "$w24"
flac "$w24"
accomplished

This gave me a set of 24-bit 44.1kHz FLAC recordsdata, which I verified with the file command. At that time, all I wanted to do was make sure that all of the tags appeared good, and that was that.

And talking of music…

I have been taking a break from this music column this yr, as I have never accomplished a lot besides take heed to issues I have already got readily available. But a couple of new objects have crept into my assortment.

Emancipator’s newest, Mountain of Memory, is out there from that nice Linux-friendly and artist-friendly on-line retailer, Bandcamp. If you want Emancipator’s earlier stuff, you will not be upset with this.

The Choir of Clare College at Cambridge and the Dmitri Ensemble have launched a fine collection of music by Arvo Pärt, Peteris Vasks, and James MacMillan, entitled “Arvo Pärt Stabat.” I have never listened to this album rigorously, besides, I’m struck by the similarity between the three composers’ work introduced right here. Maybe one thing concerning the shared affect of a northern European panorama and climate? I purchased this lovely choral music as a 96/24 FLAC obtain from Presto Classical, one other high quality Linux-friendly on-line retailer. For these occupied with extra data on this music, there may be an interview on that website with Graham Ross, the conductor of the Choir of Clare College.

Finally, another fascinating information—an internet retailer with a lot of nice high-resolution downloads that has annoyed me for a few years (to the purpose of sending them quite a few whiny emails), HDtracks, has lastly made it potential to buy music from them with out utilizing their obtain supervisor! I have never really purchased something there but, however I’ll quickly give it a whirl and report again.

Most Popular

To Top