I have one pre-emphasis CD and ripped it to FLAC files. In order to play it correctly, de-emphasis is necessary. So started to design de-emphasis filter for 44.1kHz PCM.
There are many ways to design filters. I chose frequency-sampling method to create linear-phase FIR filter.
De-emphasis filter curve
From the following page, there is a frequency response table: https://archimago.blogspot.com/2020/09/how-to-cd-pre-emphasis-and-dealing-with.htmlf(kHz) | De-emphasis filter gain (dB) |
---|---|
0 | 0 |
1 | -0.37 |
2 | -1.29 |
3 | -2.43 |
4 | -3.54 |
5 | -4.53 |
6 | -5.38 |
7 | -6.09 |
8 | -6.69 |
9 | -7.19 |
10 | -7.6 |
11 | -7.95 |
12 | -8.24 |
13 | -8.49 |
14 | -8.71 |
15 | -8.89 |
16 | -9.04 |
17 | -9.18 |
18 | -9.3 |
19 | -9.4 |
20 | -9.49 |
Polynomial fitting
In order to design the filter, it is necessary to know the filter gain of arbitrary frequency. So I tried Excel polynomial fit to find the best polynomial equation.
Note: this process is not necessary, because reference frequency response function is available: https://yamamoto2002.blogspot.com/2020/11/designing-de-emphasis-digital-filter.html
Fig.2 2nd degree polynomial fit
Fig.3 3rd degree polynomial fit
Fig.4 4th degree polynomial fit
Fig.5 5th degree polynomial fit
Fig.6 6th degree polynomial fit
From the graphs above, 6th degree polynomial is the best and I decided to use it. other functions have a problem on the 0Hz~2kHz region, and its frequency band is very important for music. the error can be reduced further by increasing polynomial degree but I think < 0.1 dB is sufficient.
Calculating Polynomial coefficient
Excel shows 6th degree polynomial coefficient values on Fig.6, but it is ballpark values and more precise coefficient values are needed. Polynomial fit code WWPolynomialFit.cs to get 6th polynomial coefficient values.
Result is:constant | 1st | 2nd | 3rd | 4th | 5th | 6th |
0.028327961846712043 | -0.11354738870338571 | -0.40078216359333169 | 0.071110615465301924 | -0.0054888099286801205 | 0.00020291497408909238 | -0.0000029212346025337816 |
Table 2. 6th degree polynomial coefficients
There is a very small constant value but it should be 0 to prevent PCM integer overflow, so I just modified constant coefficient to zero.
Resulted equation is:
Note: Math equations of this article uses MathML and it seems it is displayed correctly only on Firefox (as of November 2020).
Error from the table values are: 0.079 dB on 1kHz, 0.053 dB on 2kHz, and so on.
No comments:
Post a Comment