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: Using the HDCD decoder component (Read 3184 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Using the HDCD decoder component

Hello - can anybody help.

I've installed the component

(https://www.foobar2000.org/components/view/foo_hdcd)

But how do I know it's working??

I've seen mentions of people reading "HDCD detected" on a display somewhere but
I don't get that.  Also it doesn't appear in the DSP manager - though I'm not sure if
it would be expected to.

Many thanks in advance




Re: Using the HDCD decoder component

Reply #1
Try this. It's the last 12 seconds from Reference Recordings' HDCD sampler vol 2, 1995.
If you scan it, you should get a gain value of -4.0 and Peak Extension and Transient Filter should both be "Intermittent" (which is because I cut it so near the end).

If you go into the Advanced preferences and then under HDCD decoder, set "Halve output volume" to "Only if peak extension is enabled", then upon playback you should hear a louder split second and then it will attenuate 6 dB. That's because it finds the few Peak Extension packets at the beginning.

If you have ffmpeg installed, you can try to read the output from this command to see what is going on:
ffmpeg -loglevel verbose -i 12secHDCD.flac -af hdcd -c:a pcm_s24le -f wav NUL
(Replace NUL by a filename if you actually want it decoded. You probably don't.)

Re: Using the HDCD decoder component

Reply #2
Hi -
thank you.
But I'm not sure how I would scan it... sorry you're dealing with somebody who's pretty
dense when it comes to this stuff


Re: Using the HDCD decoder component

Reply #3
... also, I have tried playing about with the "Halve output" setting but I can't hear any
differences between them...

Am I right in thinking that there is no way to turn the decoding on and off ? (I mean without
actually installing and un-installing the component)

Re: Using the HDCD decoder component

Reply #4
You need to go into Preferences -> Advanced, type hdcd into the search filter. Make sure "Enable additional decoding" is checked.
To scan: Mark files, right-click and under Utilities.

Re: Using the HDCD decoder component

Reply #5
Thank you.
Scan does indicate Peak Extension present.
I don't get the option "Enable additional decoding" (pretty sure my install is more or less upto date),
but I did find some code to paste into the display preferences so now the status bar does indeed indicate
HDCD detected and that the file is playing as 24 bit.

Now to rip some discs and have a proper listen.



Re: Using the HDCD decoder component

Reply #6
but I did find some code to paste into the display preferences so now the status bar does indeed indicate

Good point. Here is some code you can try:
%playback_time%[ / %length%]      %samplerate% Hz | %channels% | %codec% '('$if(%__hdcd%,HDCD', '$replace(%__hdcd_gain%,0.0 dB, 0.0 dB) gain; $replace(%__hdcd_peak_extend%,yes,PE=Y,no,pe=no); $replace(%__hdcd_transient_filter%,yes,TF=Y,no,tf=no),no HDCD)')' @ %bitrate% kbps

Re: Using the HDCD decoder component

Reply #7
Thank you for the code.
What an amazing piece of kit FB is... assuming a dunce like me can get a bit of help
with it from time to time!

I have a question about status bar refresh rates but I'm going to raise it separately since
it's a more general topic.

Listened to some Dead last night with HDCD activated (which was the point of the exercise)
and it sure sounded good 8)






Re: Using the HDCD decoder component

Reply #8
I have a question about status bar refresh rates but I'm going to raise it separately since
it's a more general topic.
Haha... I just removed the code for transient filter when I did this years ago because, as its name implies, it is transient and tends to go on and off during playback. I didn't like my status bar changing like that during playback.

I was also under the impression that the exact parameters of the filter weren't known, and so while most of the features of HDCD are implemented, that one is not. Someone please correct me if this information is wrong or out-of-date.
Think millionaire, but with cannons.

Re: Using the HDCD decoder component

Reply #9
Yeah, the transient filter is not implemented. Also that is one of the reasons (but not the main reason) that HDCD could well be called "scam": https://www.audioasylum.com/audio/digital/messages/18/184385.html
(Charles Hansen posted some similar explanation at HA too.)

Haha... I just removed the code for transient filter when I did this years ago because, as its name implies, it is transient and tends to go on and off during playback. I didn't like my status bar changing like that during playback.
Since my code has a bitrate, and I have much more VBR MP3s than HDCDs, that hasn't bothered me much.

Re: Using the HDCD decoder component

Reply #10
Haha... I just removed the code for transient filter when I did this years ago because, as its name implies, it is transient and tends to go on and off during playback.

Do you mean you manually removed that bit of the source code?

I have only been listening randomly to maybe ten different GD sets but it seems like more didn't
feature a/the transient filter than did - and even then it seems only to activate very intermittently,
making me wonder what it's actually contributing


Re: Using the HDCD decoder component

Reply #11
No, I only removed it from my status bar display script after I added it. I'm not savvy enough to modify components.
No need to show it anyway since it is literally contributing nothing on playback in foobar2000.
Think millionaire, but with cannons.

Re: Using the HDCD decoder component

Reply #12
but it seems like more didn't
feature a/the transient filter than did - and even then it seems only to activate very intermittently,
making me wonder what it's actually contributing

Likely nothing whatsoever. Surely nothing in foobar2000.
Backstory: It was an anti-aliasing filter used during conversion from analog to digital. Of course, having such a filter isn't anything special, it is necessary - but they had their own. Apparently they intended to use a selection of anti-aliasing filters during encoding, and include some decoding black-box-mumbo-jumbo based on it - but that turned out to be patented and they abandoned it.
So according to the author I linked to above, even the Pacific ADC/DAC didn't switch anything in the DAC when it encountered a "transient filter" flag - likely they never implemented anything such in the chip, which the licensed HDCD DACs would have to use. That is not to say that there is no processing in the DAC (noise shaping blah blah) but likely the device does the same whether the TF is on or off.
As further "evidence" to that, Microsoft didn't include it in Windows Media Player when they bought HDCD (with the rest of Pacific). That is the software implementation all other software implementations are based on, through reverse engineering.

So apart from the job already done at ADC-ing, the TF wouldn't get you anything through the patent owner's software implementation (Microsoft, then) and there is no sign that it would get you anything through their hardware chip either.

See: Above link, and https://www.head-fi.org/threads/hdcd-list.65414/page-38#post-11929774 from the same guy.

Re: Using the HDCD decoder component

Reply #13
Interesting, thanks

Re: Using the HDCD decoder component

Reply #14
Another thing.

When you are playing HDCD content fooBar will report $info(bitspersample) with value 24.
Which is not wrong, but the four most significant bits are always 0, which means actually playing HDCD content is 20bit.

So if you are displaying bitspersample, you might want to correct the value to 20 instead of 24.

Re: Using the HDCD decoder component

Reply #15
I'm still very very confused.  I discovered the existence of HDCD only a couple months ago.  Been racing to learn about it and find some discs.  I've used Foobar2000 for several years solely for converting between WAV and something else, such as FLAC or AC3, etc.  I didn't know you could PLAY a file until reading this thread.

But I don't want to play.  I have JUST found a disc that DOES show 1 or more tracks as HDCD!!!  (All of them do in this case.)  I used the Utility as per above.  However, I don't have the foggiest idea how to CONVERT the file.  I should be able to convert from the original 16bit WAV to the decoded 24bit HDCD WAV.  How the heck do I do that??  That is, I would convert from WAV to WAV.  But when I do that, the resultant file is the same size.  It should be 50% bigger due to 24 bit vs 16 bit.  What am I missing, please!

I also have been of the belief that I could let it decode or NOT decode.  Again, what am I missing?


Re: Using the HDCD decoder component

Reply #17
"Processing" under conversion setup, there is a checkbox for additional decoding.
Forgive me for being lost.  I've replaced and reinstalled your updated (and much larger file) component, and restarted foobar.  But I don't see "conversion" or "processing" anywhere.  Please tell me explicitly what acts (steps) I have to go through to convert a 16 bit WAV file to an HDCD-expanded 24 bit WAV file in Foobar2000.  (I know I have to select the file in the window.  What then?)  The HDCD Decoder switches in Preferences/Advanced/Decoding were already on before I made my post last night.  There may be more switches there now due to your upgrade.

Re: Using the HDCD decoder component

Reply #18
^ Right-click track(s) > Convert > '...' > click blue text 'Processing' > tick box under 'Additional decoding'...

Re: Using the HDCD decoder component

Reply #19
There's one extra step in addition to enabling the above mentioned decode postprocessing. You need to click on the 'Output format' blue text and set output bit depth to 24. Converter unfortunately bases its automatically chosen output bitdepth decision on the source file and not what the post processors indicate.

Re: Using the HDCD decoder component

Reply #20
I've done that (set output to 24 bit).  When I convert wav to wav, I believe it's still not working.  I get 24 bit files.  But when I normalize the unconverted file and the converted file, I was expecting when I zoom in to the peaks, to see the average volume of the overall program to be lower due to the peaks being higher.  But nothing was different.  Every track on this disc shows peak extension "enabled" and minimum gain -4.0 db.  From looking at these waveforms, it seems the conversion is NOT being done.

Even apart from analyzing the before and after waveforms, how I can KNOW that the conversion is taking place??  During the few seconds each track converts, there's no graphical indication of HDCD conversion going on.  In the Converter Setup, there are NO "Active DSPs" listed.  But the "Additional decoding" at the top is enabled.   And in my example, I "know" (believe) it's not working as I'm not seeing evidence of transient peak elongation.  This is my 1st HDCD disc.   I appreciate any coaching.

Update:  Porcus, I've added your status string:

%playback_time%[ / %length%]      %samplerate% Hz | %channels% | %codec% '('$if(%__hdcd%,HDCD', '$replace(%__hdcd_gain%,0.0 dB, 0.0 dB) gain; $replace(%__hdcd_peak_extend%,yes,PE=Y,no,pe=no); $replace(%__hdcd_transient_filter%,yes,TF=Y,no,tf=no),no HDCD)')' @ %bitrate% kbps

Normally I don't "play" audio in foobar but I am now, just to "get things working".  Each of the tracks starts out with -4.0 db gain.  But as soon as audible audio starts in the track (up to a few seconds in), it goes to "0.0 dB gain".  I don't know what to make of this.  I turned off "Exclude apparent false positives".

Re: Using the HDCD decoder component

Reply #21
Convert a test track with the "Additional decoding" option enabled into a sample1, then with the option disabled into sample2. Now compare the two files. You can load them in foobar2000 too and run 'Utilities' -> 'Bit-compare tracks...' to get statistics about their differences. You'll probably want to halve the loudness of the sample2 to see more easily where the differences are.

Re: Using the HDCD decoder component

Reply #22
Convert a test track with the "Additional decoding" option enabled into a sample1, then with the option disabled into sample2. Now compare the two files. You can load them in foobar2000 too and run 'Utilities' -> 'Bit-compare tracks...' to get statistics about their differences. You'll probably want to halve the loudness of the sample2 to see more easily where the differences are.
I may try that.  But the 1st post at this thread contains a very good graphic of how the decoded should look different.  The author discusses it there.
https://www.audiosciencereview.com/forum/index.php?threads/a-little-exploration-of-the-benefits-of-hdcd.40923/