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: sharing some results (Read 36242 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

De-emphasis: sharing some results

Reply #50
this thread has suffered from a lack of rigour which could mislead future readers.


What is not rigourous? Posting pictures with no explanations of the methods used and no scale, or the contrary?

How can't it be rigourous when I found the allegedly theoretical error of SoX which Audacity does not have within the audible range? Compare it with the theoretical function you draw!




There is definitely something wrong going above 20kHz, and if you two godlike people both know why, then tell so that I know and stop searching.


This can't all be explained by quantization.

De-emphasis: sharing some results

Reply #51
Here's another simple experiment you can try:

sox -r 44100 -n -b 16 input.wav synth 30 whitenoise
sox input.wav output.wav deemph

Check the spectrum of output wav, nothing weird happens at 20k.

I don't know what went wrong with your experiment, but if you can upload a 30s sample of your input file that shows the problem, then I can take a look.


De-emphasis: sharing some results

Reply #53
Again, all looks as expected:

De-emphasis: sharing some results

Reply #54
The ideal curve seems a bit odd for my taste. 1dB difference at 20kHz.

I think that what has happened here is that coefficients for a filter designed to run at 441k have been used with a filter running at 44.1k, hence the error.


Confirmed (copied the plot code into Gnuplot).

Is there any way to modify plot calculations of Ideal curve suitable for 44.1k?

Juha

De-emphasis: sharing some results

Reply #55
Which plot calculations?
"I hear it when I see it."


De-emphasis: sharing some results

Reply #57
Here's another simple experiment you can try:

sox -r 44100 -n -b 16 input.wav synth 30 whitenoise
sox input.wav output.wav deemph

Check the spectrum of output wav, nothing weird happens at 20k.


It does work indeed fairly well, I compared the 16 bits Audacity file using shaped dither after applying the EQ (as default) and the SoX's. Nothing weird above 20kHz and the theoretical error is found quite precisely.



Closer look:





I suggest this test signal: http://www.hydrogenaudio.org/forums/index....ost&id=6459

Same here. I did check twice I hadn't used bandpass'white noise, but it was indeed your test.wv. SoX automatically produced a 24bits file (yours had a 32bits resolution) so I exported to 24 bits in Audacity as well after having applied the EQ (which is done using a 32bits).






By the way, I did use a 16384 FFT size again and a Hanning window to compute it, as usual. Nothing is jagged, more "complex"(songs?) files may look jagged due to the windowing, but that's nothing more than an assumption, we didn't do much signal processing courses in 3th year.

I don't know what went wrong with your experiment, but if you can upload a 30s sample of your input file that shows the problem, then I can take a look.


MODERATION: REMOVED LINK PER TOS #9

De-emphasis: sharing some results

Reply #58
Well, I found a copy of the file elsewhere.

There is no signal above ~20k in the input file, so, as suggested by others above, attenuating the noise floor is not possible unless you increase the bit depth.  If you try

sox input.flac -b 32 input.wav
sox input.wav output.wav deemph

then the hi-freq noise will be attenuated too:

De-emphasis: sharing some results

Reply #59
SoX implements it as a IIR filter. I implemented the same filter coefficients into foo_dsp_effect's IIR filter.
In addition, it can be used in a audio decode post processor service, so appropriately tagged lossless sources
automatically get deemphasised in realtime.

Nice.  What is the appropriate tagging for this—is it a standard across players?

De-emphasis: sharing some results

Reply #60
Is there any way to modify plot calculations of Ideal curve suitable for 44.1k?

Only by using a higher order filter, but it depends what you mean by 'ideal'; for most people 0.04dB mid-range and 0.06dB <20k is plenty good enough.

De-emphasis: sharing some results

Reply #61
Only by using a higher order filter, but it depends what you mean by 'ideal'; for most people 0.04dB mid-range and 0.06dB <20k is plenty good enough.


Hmm...

This picture shows the result of gnu plot mentioned in deemph.h on sox site.




There is also mentioned that the resulting filter accuracy is < +-0.1dB ... isn't the accuracy got from comparison against the ideal one?

BTW, isn't the Audacity filter based on the ~Ideal one?

Juha

De-emphasis: sharing some results

Reply #62
Is there any way to modify plot calculations of Ideal curve suitable for 44.1k?

Only by using a higher order filter, but it depends what you mean by 'ideal'; for most people 0.04dB mid-range and 0.06dB <20k is plenty good enough.

These days processing power is plenty for such things. When we are at it why not makiing it that perfect that no one ever has to ask in future or offer some more equalizer settings? We simply link to the VST plugin then



Only by using a higher order filter, but it depends what you mean by 'ideal'; for most people 0.04dB mid-range and 0.06dB <20k is plenty good enough.


Hmm...

This picture shows the result of gnu plot mentioned in deemph.h on sox site.


There is also mentioned that the resulting filter accuracy is < +-0.1dB ... isn't the accuracy got from comparison against the ideal one?

BTW, isn't the Audacity filter based on the ~Ideal one?

Juha

The Audacity filters as i read it are based on the ideal one but when entered are off a bit and most likely in the tolerance of +- 0.05 like sox. Must be that these 30 filers interact a bit with each other. Also they have still a different phase charachteristics. Having a nice filter function based plugin is absolutely preferable imho. The one i´ve build after your guide works flawlessly. Would be nice if someone that has the rights or a registered version of Synthedit can share a finished dll for all.

Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

De-emphasis: sharing some results

Reply #63
While reading CompDSP forum, I noticed there pre-emphasis coefficients calculated by Robert Orban. These are accurate 

1st order: MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS  0.0457582dB
2nd order: MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS  0.0012157dB
3rd order: MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS  0.0000327dB

and also coefficients for 8th order filter, calculated by Greg Berchin,

but, these are all for 48kHz.

http://www.dsprelated.com/showmessage/76256/2.php

Could someone skilled person transform those Orban's coefficients suitable for 44.1kHz ?

Juha

De-emphasis: sharing some results

Reply #64
I prepared 2nd order filter (VST) using Orban's coefficients as 48kHz implementation and compared it against ideal ... it sure is about that accurate.


Juha

De-emphasis: sharing some results

Reply #65

You've plotted the response beyond the nyquist, so most of the 'error' shown doesn't really exist.

Quote
There is also mentioned that the resulting filter accuracy is < +-0.1dB ... isn't the accuracy got from comparison against the ideal one?


The file you are using is out-of-date (>4 years old) and does not represent the current SoX curve.

Quote
BTW, isn't the Audacity filter the ~Ideal one?


The ideal filter is the analogue one, unless you can't use analogue, in which case it's a digital filter with the same amplitude and phase response as the analogue filter, whilst using the smallest possible amount of CPU. An adequate filter is one which can't be ABX'd from the ideal one.

The Audacity filters as i read it are based on the ideal one but when entered are off a bit and most likely in the tolerance of +- 0.05 like sox. Must be that these 30 filers interact a bit with each other. Also they have still a different phase charachteristics. Having a nice filter function based plugin is absolutely preferable imho. The one i´ve build after your guide works flawlessly. Would be nice if someone that has the rights or a registered version of Synthedit can share a finished dll for all.

AFAIK, the audacity EQ curve method generates a single symmetric FIR which produces an amplitude response curve fitted to the given points and a linear phase response.  There is no interaction of multiple filters, but the phase response is wrong for deemph (and the CPU usage is relatively high).

I prepared 2nd order filter (VST) using Orban's coefficients as 48kHz implementation and compared it against ideal ... it sure is about that accurate.


Juha

As mentioned on comp.dsp, Orban's filter has the wrong phase response.

Here's an FIR which should have very good amplitude and phase response at the expense of some roll-off above the audible band (which could be reduced by using a longer filter).

Code: [Select]
   -1.1920929e-07 
    2.3841858e-07
   -3.5762787e-07
    5.9604645e-07
   -8.3446503e-07
    1.0728836e-06
   -1.3113022e-06
    1.5497208e-06
   -1.6689301e-06
    1.6689301e-06
   -1.5497208e-06
    1.1920929e-06
   -4.7683716e-07
   -5.9604645e-07
    2.1457672e-06
   -4.1723251e-06
    7.0333481e-06
   -1.0490417e-05
    1.4901161e-05
   -2.0027161e-05
    2.6106834e-05
   -3.2901764e-05
    4.0531158e-05
   -4.8875809e-05
    5.7578087e-05
   -6.6518784e-05
    7.5340271e-05
   -8.3565712e-05
    9.0837479e-05
   -9.6678734e-05
    0.00010025501
   -0.00010097027
    9.8347664e-05
   -9.1314316e-05
    7.9274178e-05
   -6.1631203e-05
    3.7550926e-05
   -6.4373016e-06
    -3.194809e-05
    7.8082085e-05
   -0.00013208389
     0.0001937151
   -0.00026273727
    0.00033855438
   -0.00041985512
    0.00050568581
   -0.00059401989
    0.00068306923
   -0.00077044964
    0.00085330009
   -0.00092852116
    0.00099301338
    -0.0010429621
     0.0010749102
    -0.0010849237
     0.0010691881
    -0.0010238886
    0.00094556808
   -0.00083088875
    0.00067698956
   -0.00048136711
    0.00024223328
    4.1484833e-05
   -0.00037014484
    0.00074338913
    -0.0011595488
     0.0016163588
    -0.0021101236
     0.0026364326
    -0.0031895638
     0.0037629604
    -0.0043486357
     0.0049380064
    -0.0055208206
     0.0060864687
    -0.0066227913
      0.007116437
     -0.007552743
       0.00791502
    -0.0081839561
     0.0083360672
    -0.0083409548
     0.0081566572
    -0.0077190399
     0.0069212914
    -0.0055605173
     0.0031895638
     0.0014249086
     -0.013352752
       0.43149769
         0.243837
       0.10042858
       0.10354936
      0.032808781
      0.049585462
     0.0059072971
      0.026760936
    -0.0037335157
      0.016287565
    -0.0063693523
      0.010830164
    -0.0062414408
     0.0074821711
    -0.0050988197
     0.0051002502
     -0.003673315
     0.0032455921
    -0.0022798777
     0.0017570257
     -0.001057148
    0.00057637691
   -6.3896179e-05
   -0.00032126904
    0.00068187714
   -0.00095582008
     0.0011868477
    -0.0013524294
     0.0014731884
     -0.001543045
     0.0015735626
    -0.0015654564
     0.0015267134
    -0.0014606714
     0.0013734102
    -0.0012692213
     0.0011531115
    -0.0010290146
    0.00090098381
    -0.0007724762
    0.00064647198
   -0.00052559376
    0.00041174889
   -0.00030684471
    0.00021183491
   -0.00012743473
    5.4240227e-05
    7.7486038e-06
    -5.877018e-05
    9.9301338e-05
   -0.00013017654
    0.00015199184
   -0.00016582012
    0.00017273426
   -0.00017368793
    0.00016975403
   -0.00016188622
    0.00015103817
   -0.00013816357
    0.00012385845
   -0.00010895729
    9.4056129e-05
   -7.9631805e-05
    6.5922737e-05
   -5.3167343e-05
    4.1842461e-05
   -3.1709671e-05
    2.3126602e-05
   -1.5854836e-05
     9.894371e-06
   -5.1259995e-06
    1.5497208e-06
    1.1920929e-06
   -2.9802322e-06
    4.1723251e-06
   -4.6491623e-06
    4.8875809e-06
   -4.6491623e-06
    4.4107437e-06
   -3.8146973e-06
    3.3378601e-06
   -2.7418137e-06
    2.1457672e-06
   -1.6689301e-06
    1.1920929e-06
   -8.3446503e-07
    5.9604645e-07
   -3.5762787e-07
    2.3841858e-07
   -1.1920929e-07

De-emphasis: sharing some results

Reply #66
The Audacity filters as i read it are based on the ideal one but when entered are off a bit and most likely in the tolerance of +- 0.05 like sox. Must be that these 30 filers interact a bit with each other. Also they have still a different phase charachteristics. Having a nice filter function based plugin is absolutely preferable imho. The one i´ve build after your guide works flawlessly. Would be nice if someone that has the rights or a registered version of Synthedit can share a finished dll for all.

AFAIK, the audacity EQ curve method generates a single symmetric FIR which produces an amplitude response curve fitted to the given points and a linear phase response.  There is no interaction of multiple filters, but the phase response is wrong for deemph (and the CPU usage is relatively high).

In theory, yes, but as you see in the pic of post No 40 the response has some unregularities that seem to correlate to the single equalizing points. These are somehow like a kind of ripple to me.
As far as abxable goes there really shouldn´t be much of a problem. Lately someone here abxed 0.1dB loudness difference between songs. I wouldn´t wonder if there is someone that can abx +-0.5dB with some kind of song.
Having an even more precise implementation was only meant as "when we are at it" If it is really difficult to archive then ok. I have no clue about the needed math here.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

De-emphasis: sharing some results

Reply #67
You can always increase quite a lot the number of equalizing points as mjb2006 suggested me (many thanks to him) to get even better results as for amplitude reponse. You can check it yourself. CPU usage may change too but it was not different enough on mine to check.

Code: [Select]
<curve name="15/50 EIAJ de-emphasis">
  <point f="20" d="-0.0002"/>
  <point f="50" d="-0.0010"/>
  <point f="150" d="-0.0088"/>
  <point f="250" d="-0.0243"/>
  <point f="350" d="-0.0475"/>
  <point f="450" d="-0.0782"/>
  <point f="550" d="-0.1161"/>
  <point f="650" d="-0.1612"/>
  <point f="750" d="-0.2130"/>
  <point f="850" d="-0.2714"/>
  <point f="950" d="-0.3359"/>
  <point f="1050" d="-0.4063"/>
  <point f="1150" d="-0.4821"/>
  <point f="1250" d="-0.5630"/>
  <point f="1350" d="-0.6486"/>
  <point f="1450" d="-0.7386"/>
  <point f="1550" d="-0.8324"/>
  <point f="1650" d="-0.9298"/>
  <point f="1750" d="-1.0304"/>
  <point f="1850" d="-1.1338"/>
  <point f="1950" d="-1.2397"/>
  <point f="2050" d="-1.3477"/>
  <point f="2150" d="-1.4575"/>
  <point f="2250" d="-1.5689"/>
  <point f="2350" d="-1.6815"/>
  <point f="2450" d="-1.7950"/>
  <point f="2550" d="-1.9093"/>
  <point f="2650" d="-2.0240"/>
  <point f="2750" d="-2.1391"/>
  <point f="2850" d="-2.2542"/>
  <point f="2950" d="-2.3692"/>
  <point f="3050" d="-2.4840"/>
  <point f="3150" d="-2.5983"/>
  <point f="3250" d="-2.7121"/>
  <point f="3350" d="-2.8253"/>
  <point f="3450" d="-2.9376"/>
  <point f="3550" d="-3.0491"/>
  <point f="3650" d="-3.1596"/>
  <point f="3750" d="-3.2690"/>
  <point f="3850" d="-3.3774"/>
  <point f="3950" d="-3.4845"/>
  <point f="4050" d="-3.5905"/>
  <point f="4150" d="-3.6951"/>
  <point f="4250" d="-3.7984"/>
  <point f="4350" d="-3.9004"/>
  <point f="4450" d="-4.0011"/>
  <point f="4550" d="-4.1003"/>
  <point f="4650" d="-4.1981"/>
  <point f="4750" d="-4.2945"/>
  <point f="4850" d="-4.3894"/>
  <point f="4950" d="-4.4829"/>
  <point f="5050" d="-4.5750"/>
  <point f="5150" d="-4.6656"/>
  <point f="5250" d="-4.7547"/>
  <point f="5350" d="-4.8424"/>
  <point f="5450" d="-4.9287"/>
  <point f="5550" d="-5.0136"/>
  <point f="5650" d="-5.0970"/>
  <point f="5750" d="-5.1790"/>
  <point f="5850" d="-5.2597"/>
  <point f="5950" d="-5.3389"/>
  <point f="6050" d="-5.4168"/>
  <point f="6150" d="-5.4934"/>
  <point f="6250" d="-5.5686"/>
  <point f="6350" d="-5.6425"/>
  <point f="6450" d="-5.7151"/>
  <point f="6550" d="-5.7864"/>
  <point f="6650" d="-5.8565"/>
  <point f="6750" d="-5.9253"/>
  <point f="6850" d="-5.9929"/>
  <point f="6950" d="-6.0592"/>
  <point f="7050" d="-6.1244"/>
  <point f="7150" d="-6.1885"/>
  <point f="7250" d="-6.2513"/>
  <point f="7350" d="-6.3131"/>
  <point f="7450" d="-6.3737"/>
  <point f="7550" d="-6.4333"/>
  <point f="7650" d="-6.4918"/>
  <point f="7750" d="-6.5492"/>
  <point f="7850" d="-6.6056"/>
  <point f="7950" d="-6.6610"/>
  <point f="8050" d="-6.7153"/>
  <point f="8150" d="-6.7687"/>
  <point f="8250" d="-6.8212"/>
  <point f="8350" d="-6.8727"/>
  <point f="8450" d="-6.9233"/>
  <point f="8550" d="-6.9730"/>
  <point f="8650" d="-7.0217"/>
  <point f="8750" d="-7.0697"/>
  <point f="8850" d="-7.1167"/>
  <point f="8950" d="-7.1629"/>
  <point f="9050" d="-7.2083"/>
  <point f="9150" d="-7.2529"/>
  <point f="9250" d="-7.2967"/>
  <point f="9350" d="-7.3397"/>
  <point f="9450" d="-7.3820"/>
  <point f="9550" d="-7.4235"/>
  <point f="9650" d="-7.4643"/>
  <point f="9750" d="-7.5044"/>
  <point f="9850" d="-7.5438"/>
  <point f="9950" d="-7.5824"/>
  <point f="10050" d="-7.6205"/>
  <point f="10150" d="-7.6578"/>
  <point f="10250" d="-7.6945"/>
  <point f="10350" d="-7.7306"/>
  <point f="10450" d="-7.7660"/>
  <point f="10550" d="-7.8008"/>
  <point f="10650" d="-7.8351"/>
  <point f="10750" d="-7.8687"/>
  <point f="10850" d="-7.9018"/>
  <point f="10950" d="-7.9343"/>
  <point f="11050" d="-7.9663"/>
  <point f="11150" d="-7.9977"/>
  <point f="11250" d="-8.0286"/>
  <point f="11350" d="-8.0589"/>
  <point f="11450" d="-8.0888"/>
  <point f="11550" d="-8.1181"/>
  <point f="11650" d="-8.1470"/>
  <point f="11750" d="-8.1754"/>
  <point f="11850" d="-8.2033"/>
  <point f="11950" d="-8.2308"/>
  <point f="12050" d="-8.2578"/>
  <point f="12150" d="-8.2843"/>
  <point f="12250" d="-8.3104"/>
  <point f="12350" d="-8.3361"/>
  <point f="12450" d="-8.3614"/>
  <point f="12550" d="-8.3863"/>
  <point f="12650" d="-8.4108"/>
  <point f="12750" d="-8.4348"/>
  <point f="12850" d="-8.4585"/>
  <point f="12950" d="-8.4818"/>
  <point f="13050" d="-8.5048"/>
  <point f="13150" d="-8.5273"/>
  <point f="13250" d="-8.5495"/>
  <point f="13350" d="-8.5714"/>
  <point f="13450" d="-8.5929"/>
  <point f="13550" d="-8.6141"/>
  <point f="13650" d="-8.6349"/>
  <point f="13750" d="-8.6555"/>
  <point f="13850" d="-8.6757"/>
  <point f="13950" d="-8.6956"/>
  <point f="14050" d="-8.7151"/>
  <point f="14150" d="-8.7344"/>
  <point f="14250" d="-8.7534"/>
  <point f="14350" d="-8.7721"/>
  <point f="14450" d="-8.7905"/>
  <point f="14550" d="-8.8087"/>
  <point f="14650" d="-8.8265"/>
  <point f="14750" d="-8.8441"/>
  <point f="14850" d="-8.8615"/>
  <point f="14950" d="-8.8785"/>
  <point f="15050" d="-8.8953"/>
  <point f="15150" d="-8.9119"/>
  <point f="15250" d="-8.9282"/>
  <point f="15350" d="-8.9443"/>
  <point f="15450" d="-8.9602"/>
  <point f="15550" d="-8.9758"/>
  <point f="15650" d="-8.9912"/>
  <point f="15750" d="-9.0063"/>
  <point f="15850" d="-9.0213"/>
  <point f="15950" d="-9.0360"/>
  <point f="16050" d="-9.0505"/>
  <point f="16150" d="-9.0648"/>
  <point f="16250" d="-9.0789"/>
  <point f="16350" d="-9.0928"/>
  <point f="16450" d="-9.1065"/>
  <point f="16550" d="-9.1200"/>
  <point f="16650" d="-9.1333"/>
  <point f="16750" d="-9.1465"/>
  <point f="16850" d="-9.1594"/>
  <point f="16950" d="-9.1722"/>
  <point f="17050" d="-9.1848"/>
  <point f="17150" d="-9.1972"/>
  <point f="17250" d="-9.2095"/>
  <point f="17350" d="-9.2215"/>
  <point f="17450" d="-9.2335"/>
  <point f="17550" d="-9.2452"/>
  <point f="17650" d="-9.2568"/>
  <point f="17750" d="-9.2682"/>
  <point f="17850" d="-9.2795"/>
  <point f="17950" d="-9.2906"/>
  <point f="18050" d="-9.3016"/>
  <point f="18150" d="-9.3125"/>
  <point f="18250" d="-9.3231"/>
  <point f="18350" d="-9.3337"/>
  <point f="18450" d="-9.3441"/>
  <point f="18550" d="-9.3544"/>
  <point f="18650" d="-9.3645"/>
  <point f="18750" d="-9.3745"/>
  <point f="18850" d="-9.3844"/>
  <point f="18950" d="-9.3941"/>
  <point f="19050" d="-9.4038"/>
  <point f="19150" d="-9.4132"/>
  <point f="19250" d="-9.4226"/>
  <point f="19350" d="-9.4319"/>
  <point f="19450" d="-9.4410"/>
  <point f="19550" d="-9.4500"/>
  <point f="19650" d="-9.4589"/>
  <point f="19750" d="-9.4677"/>
  <point f="19850" d="-9.4764"/>
  <point f="19950" d="-9.4850"/>
  <point f="20050" d="-9.4934"/>
  <point f="20150" d="-9.5018"/>
  <point f="20250" d="-9.5101"/>
  <point f="20350" d="-9.5182"/>
  <point f="20450" d="-9.5263"/>
  <point f="20550" d="-9.5342"/>
  <point f="20650" d="-9.5421"/>
  <point f="20750" d="-9.5498"/>
  <point f="20850" d="-9.5575"/>
  <point f="20950" d="-9.5651"/>
  <point f="21050" d="-9.5726"/>
  <point f="21150" d="-9.5800"/>
  <point f="21250" d="-9.5873"/>
  <point f="21350" d="-9.5945"/>
  <point f="21450" d="-9.6016"/>
  <point f="21550" d="-9.6087"/>
  <point f="21650" d="-9.6156"/>
  <point f="21750" d="-9.6225"/>
  <point f="21850" d="-9.6293"/>
  <point f="21950" d="-9.6360"/>
  <point f="22050" d="-9.6427"/>
</curve>

De-emphasis: sharing some results

Reply #68
I prepared 2nd order filter (VST) using Orban's coefficients as 48kHz implementation and compared it against ideal ... it sure is about that accurate.
Juha


As mentioned on comp.dsp, Orban's filter has the wrong phase response.

Here's an FIR which should have very good amplitude and phase response at the expense of some roll-off above the audible band (which could be reduced by using a longer filter).





Orban mentioned in one of his posts the method he uses for his calcilations:
Quote
These were computed using a Fortran program I wrote that uses Remes' second  algorithm to make a minimax magnitude approximation on a warped frequency  axis, such that bilinear transformation of the approximation yields the z- plane poles and zeros.  The results are always minimum-phase. So are 75 us and J.17 preemphasis.  However, the group delay of the digital approximation does not match the  analog specification precisely because of the differences in the magnitude  response of the digital and analog curves outside the frequency range of the  minimax magnitude approximation.


I couldn't find any papers for CD pre-emphasis standard so, how's the phase should be in this filter? Minimum or linear?

Phase plot got for 2nd order 48kHz filter (coefficients calculated by Orban)




Sox filter (based on deemph.h linked earlier):



Juha

De-emphasis: sharing some results

Reply #69
The FIR I gave above came in at ~0.0007 dB absolute amplitude error; a little improvement in the filter design and I've now got it to < 0.00002 dB (with the same number of taps).  The phase response should be equally good.

So the filter should now give almost bit-perfect removal of an ideal emphasis filter, providing that the CD audio roll off is below that of the FIR (which seems to be the case at least for the TDSOTM and Abbey Road Japanese discs).  Of course, in fact it doesn't matter either way: the spectrum above 20k is intended to be used for filter roll-off etc.

E.g.

Code: [Select]
sox input.wav output.wav fir deemph.fir
where deemph.fir contains:

Code: [Select]
   -1.1920929e-07 
2.3841858e-07
  -4.7683716e-07
5.9604645e-07
  -8.3446503e-07
1.0728836e-06
  -1.3113022e-06
1.5497208e-06
  -1.6689301e-06
1.6689301e-06
  -1.5497208e-06
1.1920929e-06
  -4.7683716e-07
  -5.9604645e-07
2.1457672e-06
  -4.1723251e-06
7.0333481e-06
  -1.0490417e-05
1.4901161e-05
  -2.0027161e-05
2.6106834e-05
  -3.2901764e-05
4.0531158e-05
  -4.8875809e-05
5.7578087e-05
  -6.6518784e-05
7.5340271e-05
  -8.3565712e-05
9.0837479e-05
  -9.6678734e-05
0.00010025501
  -0.00010097027
9.8228455e-05
  -9.1314316e-05
7.9274178e-05
  -6.1511993e-05
3.7431717e-05
  -6.4373016e-06
-3.194809e-05
7.8201294e-05
  -0.00013208389
0.0001938343
  -0.00026285648
0.00033855438
  -0.00041997433
0.00050568581
-0.0005941391
0.00068318844
  -0.00077056885
0.00085330009
  -0.00092864037
0.00099301338
-0.0010430813
0.0010749102
-0.0010849237
0.0010690689
-0.0010237694
0.00094544888
  -0.00083076954
0.00067675114
  -0.00048112869
0.00024199486
4.1842461e-05
  -0.00037062168
0.00074386597
-0.0011600256
0.0016168356
-0.0021107197
0.0026370287
-0.003190279
0.0037635565
-0.0043493509
0.0049386024
-0.0055214167
0.0060870647
-0.0066232681
0.0071167946
-0.0075529814
0.0079151392
-0.0081838369
0.0083357096
-0.0083402395
0.0081554651
-0.007717371
0.0069189072
-0.0055570602
0.0031843185
0.0014334917
-0.013371706
  0.43148828
  0.24382663
  0.10041237
  0.10355854
  0.032810807
  0.049596071
0.0059109926
  0.026768446
-0.0037311316
  0.016291976
-0.0063681602
  0.010832548
-0.0062408447
0.0074832439
-0.0050983429
0.0051006079
-0.0036728382
0.0032455921
-0.0022794008
0.0017566681
-0.0010566711
0.00057590008
  -6.3419342e-05
  -0.00032174587
0.00068235397
  -0.00095629692
0.0011872053
-0.001352787
  0.001473546
-0.0015434027
  0.001573801
-0.001565814
0.0015269518
-0.0014607906
0.0013736486
-0.0012694597
0.0011531115
-0.0010290146
0.00090098381
-0.0007724762
0.00064647198
  -0.00052559376
0.00041174889
-0.0003067255
0.0002117157
  -0.00012743473
5.4240227e-05
7.7486038e-06
-5.877018e-05
9.9420547e-05
  -0.00013017654
0.00015211105
  -0.00016593933
0.00017285347
  -0.00017368793
0.00016975403
  -0.00016188622
0.00015103817
  -0.00013816357
0.00012385845
-0.0001090765
9.4056129e-05
  -7.9631805e-05
6.5922737e-05
  -5.3167343e-05
4.1842461e-05
  -3.1709671e-05
2.3126602e-05
  -1.5854836e-05
9.894371e-06
  -5.1259995e-06
1.5497208e-06
1.1920929e-06
  -2.9802322e-06
4.1723251e-06
  -4.6491623e-06
4.8875809e-06
  -4.7683716e-06
4.2915344e-06
  -3.8146973e-06
3.3378601e-06
  -2.7418137e-06
2.1457672e-06
  -1.6689301e-06
1.1920929e-06
  -8.3446503e-07
5.9604645e-07
  -3.5762787e-07
2.3841858e-07
  -1.1920929e-07

De-emphasis: sharing some results

Reply #70
I couldn't find any papers for CD pre-emphasis standard so, how's the phase should be in this filter? Minimum or linear?

You should be able to check the phase response using an analogue filter simulation tool such as (P)SPICE.

De-emphasis: sharing some results

Reply #71
You can always increase quite a lot the number of equalizing points as mjb2006 suggested me (many thanks to him) to get even better results as for amplitude reponse. You can check it yourself. CPU usage may change too but it was not different enough on mine to check.

The phase response is still wrong. If you have to use Audacity the VST plugin Juha suggests should take care of that.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!


 

Re: De-emphasis: sharing some results

Reply #73
Sox filter shown in above plot was actually the old version. This plot shows the current biquad HS version:
picture uploading