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: De-emphasis components (Read 98337 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

De-emphasis components

Reply #75
lvqcl: I have Monkey's Audio and WavPack lossless files, which work only with foo_dsp_deemph. Possibly older versions these codecs do not support postprocessing?

De-emphasis components

Reply #76
What versions of foobar2000 and foo_input_monkey do you use?

De-emphasis components

Reply #77
lvqcl: I tested it again and the problem is with files image + cue sheet. The first must load only image file, add metadata and Apply. Only then you can load cue file. If first load cue file, so add metadata don't save and it does not work!

De-emphasis components

Reply #78
I see. I tried a little with status bar syntax and here are some possibilities. It was easier than I thought.

Code: [Select]
Pre-Emphasis: $if($meta(pre-emphasis),Yes,No)
or
Code: [Select]
Pre-Emphasis: $if($meta(pre_emphasis),Yes,No)
Depends on your tag name. It doesn't matter which value you are using 1, on or yes. It simply scans for PRE-EMPHASIS or PRE_EMPHASIS tag name presence.


or also
Code: [Select]
$if(%pre-emphasis%or%pre_emphasis%,Yes,No)

De-emphasis components

Reply #79
Sorry if this was already discussed, but what advantages does this component over foo_dsp_effect's own CD de-emphasis post-processor, in terms of implementation? In other words, which one should I use if I am looking for accuracy?

De-emphasis components

Reply #80
Plugins to do de-emphasis of pre-emphasized CDs:
* Postprocessing (foo_deemph): works only with lossless sources; always active during playback and ReplayGain scan.
* DSP plugin (foo_dsp_deemph): works with any source


* To de-emphasize a track, add a tag named PRE_EMPHASIS or PRE-EMPHASIS with a value 1, on or yes. Other tracks are unaffected.
* There's no reason to use both components at the same time.
* Don't use both foo_deemph and foo_dsp_effect (the latter has its own de-emphasis postprocessor).
*  Note that even foo_dsp_deemph works only when a track is tagged: just  adding it to the list of active DSPs is not enough to make it  work.

Use postprocessing if you want to add correct ReplayGain tags to your files.
Use DSP if you have lossy files that you want to de-emphasize.
Otherwise, there's no difference.

De-emphasis components

Reply #81
Thank you for replying, but please re-read what I've posted above; I'm already aware of that information, and it does not answer my question. I'm asking which plugin has a higher quality CD de-emphasis post-processor: mudlord's foo_dsp_effect plugin, or lvqcl's foo-deemph.

Note that the plugin name "foo_dsp_effect" is a tad misleading, as it contains the functionality of both of lvqcl's plugins: foo_deemph (a post-processor), as well as foo_dsp_deemph (a dsp filter). I am only discussing the former (the post-processor).

De-emphasis components

Reply #82
As mentioned in my post earlier in this thread, they are all within a fraction of a dB of each other. Sonically they should be indistinguishable.

Here's the image that is supposed to be in that post. The original image link is no longer working in some browsers due to the forum going to HTTPS.



original sweep = green
foo_dsp_effect = red
SoX deemph = yellow (foo_deemph, foo_dsp_deemph, foo_dsp_convolver are identical to this)
WaveEmph = blue

Re: De-emphasis components

Reply #83
Hi, I have a problem with the "foo_deemph" component. I think is taking too much treble off some Flac files.

The Flac files are from the Human League CD, Dare! (CDV 2192); known to have pre-emphasis.

I tested the component with Michael Jackson's Thriller (35.8P-11) and it sounds great. It's just that Dare! album that's having the problem.

Re: De-emphasis components

Reply #84
The original image link is no longer working in some browsers due to the forum going to HTTPS.
It should at least display a thumbnail, since that's what the current HTTPSizer script does. Cache locally as a thumbnail, display a link to the original image.

Re: De-emphasis components

Reply #85
Here's my experience with these guys.

Contrary to what's stated in the OP, foo_deemph / foo_dsp_deemph do work when fed AAC LC as M4A - but foo_deemph will indeed disregard MP3s. (I suppose the DSP component has no way of checking input file format.)

I'd rather have them work irrespective of format, since I've encountered at least one case of an album on Amazon MP3 and iTunes lately that seems to have been sourced from a rip of an emphasis CD with no deemphasis applied, with the CD issue not being easily available.

It also gets a bit messy when you've got both DLLs installed at the same time. If foo_dsp_deemph is in the DSP chain, then:
MP3, PRE-EMPHASIS tag set: Deemphasis applied once
M4A/FLAC, PRE-EMPHASIS tag set: Deemphasis applied twice
This potentially affects both playback and conversion.
I'd rather have the DSP component be entirely "dumb", so you can just add it to the DSP chain when needed and be sure that it'll apply deemphasis no matter what (sample rate permitting). Modifying the DSP chain or creating an additional conversion preset is no biggie (emphasis material isn't that common either unless you're into Japanese '80s stuff), but unpredictable / incorrect results are.

Another source of confusion arises when you use the converter to create a second version with deemphasis already applied to audio data. Foobar will duly transfer all tags, including the PRE-EMPHASIS field, so on playback of the converted files, deemphasis will be applied again (and potentially even twice as we've seen, so if you don't know what you're doing this could be up to 4 times total). You have to remove the field by hand. I don't think there's much that can be done about this, but it's still a nuisance. I suppose that's what happened with the guy two posts up.

I do wish things could be made to work just a little more predictably, without having to double-check that you're in fact getting the desired results.

Re: De-emphasis components

Reply #86
Tested the post-processor foo_deemph only, since I am lazy:

foo_deemph / foo_dsp_deemph do work when fed AAC LC as M4A - but foo_deemph will indeed disregard MP3s. (I suppose the DSP component has no way of checking input file format.)

mp3 as m4a: pre-emphasis APPLIED
mp3 as mka: pre-emphasis tag DISREGARDED

As for conversion: is there any way the component can interfere with the conversion when DSP is set to be applied, so that it removes the tag?

Re: De-emphasis components

Reply #87
Contrary to what's stated in the OP, foo_deemph / foo_dsp_deemph do work when fed AAC LC as M4A - but foo_deemph will indeed disregard MP3s.
foo_dsp_deemph should work with all formats, but foo_deemph should be inactive with lossy formats.
So the fact that foo_deemph is also active for AAC all codecs in MP4 container looks like a bug in foobar2000.

It also gets a bit messy when you've got both DLLs installed at the same time. If foo_dsp_deemph is in the DSP chain, then:
MP3, PRE-EMPHASIS tag set: Deemphasis applied once
M4A/FLAC, PRE-EMPHASIS tag set: Deemphasis applied twice
If you have them both installed and active then it's expected, no?

This potentially affects both playback and conversion.
It affects conversion only if "Enable decode postprocessing" checkbox is on, in this case foo_deemph is also active during conversion.
If this checkbox is off then only foo_dsp_deemph can work.

mp3 as m4a: pre-emphasis APPLIED
Maybe foobar2000 sends anything in MP4 container into postprocessing service because of ALAC codec.

As for conversion: is there any way the component can interfere with the conversion when DSP is set to be applied, so that it removes the tag?
I doubt it.


Re: De-emphasis components

Reply #89
I've encountered at least one case of an album on Amazon MP3 and iTunes lately that seems to have been sourced from a rip of an emphasis CD with no deemphasis applied, with the CD issue not being easily available.

lvqcl:
If you allow a little bit of user configuration, this could be accommodated.
The component will apply de-emphasis if it reads a tag value of "1", "on" or "yes".
Suggestion: let the user choose the tag values that the DSP shall observe. E.g., the user could choose to let the DSP be triggered by the tag value "lossy". That is "human readable": the user will know that this is a file that "arrived as lossy with the wrong EQ". (Makes it easier to know whether I did myself carelessly convert from lossless to lossy.)

Re: De-emphasis components

Reply #90
Hi, is there any chance to let "foo_deemph" active with lossy format (with pre-emphasis tag) as well? Like a switch?

The reason I asked so is because I have some MP3 rips of pre-emphasis CDs which unfortunately are not available any more. So all I have are those MP3 copies.

While I can just use foo_dsp_deemph instead, the problem is that one doesn't work with ReplayGain. I.e. when calculating RG, it doesn't take de-emphasis into consideration because it's a DSP, not in post-processing.

Thanks.

Re: De-emphasis components

Reply #91
It's limited by foobar2000 itself, not by this component.

Re: De-emphasis components

Reply #92
The reason I asked so is because I have some MP3 rips of pre-emphasis CDs which unfortunately are not available any more. So all I have are those MP3 copies.

Your problem is to get RG calculated? Unless you want to rely on the issue I had with mp3-in-m4a, see above, then I suggest:

1) Transcode them to a lossless format, with tags preserved.
2) Throw in the PRE-EMPHASIS tag in the lossless ones.
3) RG scan those.
4) Use MP3Tag to copy over the tags. It copies RG tags too.
5) Fix the PRE-EMPHASIS tag in the mp3s. (Delete or keep as a reminder, whatever suits you.)

Re: De-emphasis components

Reply #93
The reason I asked so is because I have some MP3 rips of pre-emphasis CDs which unfortunately are not available any more. So all I have are those MP3 copies.

Your problem is to get RG calculated? Unless you want to rely on the issue I had with mp3-in-m4a, see above, then I suggest:

1) Transcode them to a lossless format, with tags preserved.
2) Throw in the PRE-EMPHASIS tag in the lossless ones.
3) RG scan those.
4) Use MP3Tag to copy over the tags. It copies RG tags too.
5) Fix the PRE-EMPHASIS tag in the mp3s. (Delete or keep as a reminder, whatever suits you.)

Very elegant solution! Thanks!

Re: De-emphasis components

Reply #94
I should add, though, the whole process is actually more tedious:

To get RG scan to include de-emphasis, I have to use foo_deemph (because DSP version will not work when calculating RG).

Then, when I finished the whole process, I have to switch back to DSP version for playback, because foo_deemph doesn't work with lossy format. And I can't just keep two versions active at the same time because that will double de-emph the lossless ones, obviously.

So basically, everytime I want to deal with some pre-emphasized lossy formats, I have to restart foobar2000 quite a few times to disable those components.

(Also, you said I can delete those pre-emphasis tag in MP3s at the end, but I actually still need them because my MP3s are still pre-emphasized.)

Oh, but maybe I can just apply de-emphasis during transcoding via DSP (instead of using tag; actually you surely should remove the tag afterwards to avoid essential double deemph), then RG scan, then copy RG info to previous MP3s. This way, I don't need foo_deemph at all.

Also thanks for your reply, lvqcl.

Re: De-emphasis components

Reply #95
Bug:

foo_deemph doesn't work with FLAC+embedded CUE when only some tracks have pre_emphasis tag.
The tag is totally disregarded (i.e no de-em applied).

foo_dsp_deemph doesn't have this problem.

Re: De-emphasis components

Reply #96
foo_deemph doesn't work with FLAC+embedded CUE when only some tracks have pre_emphasis tag.
The tag is totally disregarded (i.e no de-em applied).
I doubt that it's possible to hava different PRE_EMPHASIS tags in a FLAC file with embedded CUE.

AFAIK this tag inside embedded CUEs is ignored by foobar2000, and if it's in the FLAC file then it's applied to all tracks.


foo_dsp_deemph doesn't have this problem.
Do you mean foo_dsp_deemph made by mudlord or foo_dsp_deemph from this thread?

Re: De-emphasis components

Reply #97
AFAIK this tag inside embedded CUEs is ignored by foobar2000

You're right, but that exactly is why you can add "pre-emphasis" to only part of the the tracks:



You actually can't do it with actual CUE files.

In the same vein, you can even have different "ALBUM" tags for different tracks within one single FLAC file, despite you can't do it with CUE (in foobar2000, embedded CUE is only there to provide index timestamps AFAIK).


Do you mean foo_dsp_deemph made by mudlord or foo_dsp_deemph from this thread?

The one developed by you in this thread. It can detect the tag correctly, de-em (and only de-em) the tracks with pre-em tags.

Re: De-emphasis components

Reply #98
These quite accurate coefficients are calculated in Octave using MIM (Magnitude Invariance Method). I did these calculations 'bout a year ago.

Code: [Select]
IIR filter coefficients for CD 

pre-emphasis

order  [num]
       [den]

1   [ 0.46502919 -0.08587729 ]
    [ 1.0        -0.62084810 ]

2   [ 0.46039863 0.12793807 -0.04856151 ]
    [ 1.0       -0.15829192 -0.30193289 ]

3   [ 0.46017735 0.36661178 -0.00875582 -0.02057091 ]
    [ 1.0        0.36049763 -0.44176711 -0.12126812 ]

4   [ 0.46016861 0.60879421  0.15632160 -0.03386380 -0.00771702 ]
    [ 1.0        0.88680338 -0.31259764 -0.34623051 -0.04427164 ]

5   [ 0.46016813 0.85120377  0.44874398  0.02498515 -0.02531949 -0.00269302 ]
    [ 1.0        1.41358954  0.09309909 -0.53516182 -0.19924854 -0.01518974 ]

6   [ 0.46016811 1.09387524 0.869244888  0.22317697 -0.02253671 -0.01394880 -0.00090035 ]
    [ 1.0        1.94094357 0.776877703 -0.54272822 -0.46296216 -0.09803154 -0.00502000 ]

8   [ 0.46016811 1.07486732 0.614144690 -0.28201629 -0.37418109 -0.08705805  0.01121497 0.00482825 0.00025508 ]
    [ 1.0        1.89963712 0.240531593 -1.39566438 -0.70552789 0.172873179  0.17618023 0.03277840 0.00141473 ]

de-emphasis

order  [num]
       [den]
1   [ 2.12788780 -1.30498995 ]
    [ 1.0        -0.17710215 ]

2   [ 2.17089358 -0.30993361 -0.67547310 ]
    [ 1.0         0.29340958 -0.10792271 ]

3   [ 2.17300832  0.81716225 -0.96263811 -0.27531828 ]
    [ 1.0         0.81222848 -0.01347376 -0.04654055 ]

4   [ 2.17311339  1.95699625 -0.66588831 -0.76587166 -0.10071593 ]
    [ 1.0         1.33672688  0.35187712 -0.07344653 -0.01752371 ]

5   [ 2.17311860  3.10009349  0.23008501 -1.17063737 -0.44398916 -0.03464344 ]
    [ 1.0         1.86274168  0.99361199  0.05978604 -0.05597792 -0.00613466 ]

6   [ 2.17311885  4.24512445  1.72940632 -1.17435914 -1.02141556 -0.21945040 -0.01146182 ]
    [ 1.0         2.38964825  1.91337654  0.49890284 -0.04781872 -0.03109218 -0.00205401 ]

8   [ 2.17311887  3.84681874 -0.22310992 -3.62676223 -1.51777033  0.61575440  0.49615426 0.08964053 0.00387487 ]
    [ 1.0         2.20636064  0.93494492 -1.07017666 -1.03881467 -0.22165432  0.03315453 0.01320640 0.00069833 ]

Magnitude response comparison against sox (new) and BLT based filters:
https://s26.postimg.org/qzlvoowex/cd_emph.png
(plot range: 20Hz-22050Hz)

Re: De-emphasis components

Reply #99
MIM method has some aliasing issue with low order filters so I made improved 1st order coefficients :

Code: [Select]
1 [ 0.45855794 -0.08474775 ]
  [ 1.0    -0.62618980 ]

1 [ 2.15724369 -1.33446450 ]
  [ 1.0    -0.17722082 ]

Magnitude quite close with sox new.