• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Digital filter "game"

kchap

Addicted to Fun and Learning
Forum Donor
Joined
Jun 10, 2021
Messages
586
Likes
572
Location
Melbourne, Oz
I wish I read this a few months ago, before started to up-sample my ripped CDs. I made a lot of mistakes during the process. Oh well, "all's well that ends well"

Edited
 
Last edited:

tcli

Member
Joined
Oct 9, 2021
Messages
36
Likes
34
Location
France
It's a fun game.
A good web site to design your FIR filter online :
http://t-filter.engineerjs.com/
I use it often for fast design.
An example of what you can get for the first stage :
FIRonline.png
 

dualazmak

Major Contributor
Forum Donor
Joined
Feb 29, 2020
Messages
2,850
Likes
3,047
Location
Ichihara City, Chiba Prefecture, Japan
Really interesting and important discussions you are having, although I am not an expert in these topics.

Since my music library consists of mixture of intact CD ripped tracks (44.1 kHz 16 bit stereo up to 22.05 Hz) and download-purchased various HiRes music in flac and DSD up to 11.2 MHz DSD256(4x) of high quality to really poor quality recording/mastering, I sometimes rather concern the UHF garbage noises over 30 kHz in the poorly processed HiRes tracks.

My post here is also summarizing the important links to @amirm's recent concerns on the same issue and also the link to a nice web article written in Japanese in 2015.

After my careful analysis of those UHF-noise contaminated tracks with MusicScpoe and Adobe Audition 3.0.1 as shared here through here, I decided to usually use -48 dB/Oct low-pass (high-cut) filters at 25 kHz in my digital XO/DSP/EQ software "EKIO"; this is my self-defensive measure against possible damages to high Fq SP drivers, to my ears (and brain), and also to our beloved pets (dogs, birds, etc.).

Of course, I know and understand that "the above self-defensive measure of cutting-off at 25 kHz" means the digital format up to 96 kHz 24 bit (max. 48 kHz stereo) or 88.2 kHz 24 bit (max. 44.1 kHz stereo) would be just enough for my usual audio listening enjoyments.
 
Last edited:
OP
B

bennetng

Major Contributor
Joined
Nov 15, 2017
Messages
1,634
Likes
1,693
It's a fun game.
A good web site to design your FIR filter online :
http://t-filter.engineerjs.com/
I use it often for fast design.
An example of what you can get for the first stage :View attachment 158105
Yes I also tried this online tool as well, sometimes it can quickly generate a filter with the required parameters, sometimes not (like your screenshot), sometime it may take a lot of time and even freeze the browser:facepalm:

I am frustrated about the recent ESS datasheets as the filter graphs are extremely small and low-res, for example the old ES9018 has a much bigger filter plot (red vertical line by me):

index.php
 
Last edited:

dualazmak

Major Contributor
Forum Donor
Joined
Feb 29, 2020
Messages
2,850
Likes
3,047
Location
Ichihara City, Chiba Prefecture, Japan
It's a fun game.
A good web site to design your FIR filter online :
http://t-filter.engineerjs.com/
I use it often for fast design.
An example of what you can get for the first stage :View attachment 158105

Interesting...
As I shared here, Adobe Audition 3.0.1 looks using the similar type of filter in "erase/delete" the selected Fq zone;
WS001624.JPG


As l also shared here, Steinberg SpectraLayers Pro7's "erase/delete" command looks just fully cutting-off any sound signal in the selected zone;
WS001622.JPG
 

tcli

Member
Joined
Oct 9, 2021
Messages
36
Likes
34
Location
France
Yes I also tried this online tool as well, sometimes it can quickly generate a filter with the required parameters, sometimes not (like your screenshot), sometime it may take a lot of time and even freeze the browser
Really it works very well for simple filters.

Here the result of the following command :
sox -V impulse.wav -r 352800 -b 32 long.wav upsample 2 fir F1.txt vol 2 upsample 2 fir F2.txt vol 2 upsample 2 fir F3.txt vol 2
Where F1.txt, F2.txt and F3.txt (135/27/9 taps) have been generated with Tfilter :
plot.png

(Red : with Tfilter, Blue : your long filter example with sox).

I have a question about ESS :
Your datasheet extract tells about only 2 upsampling stages with 128 and 26 taps FIR filters.
x8 oversampling need 3 x2 stages. What about the 3rd stage?
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,705
Location
Hampshire
I have a question about ESS :
Your datasheet extract tells about only 2 upsampling stages with 128 and 26 taps FIR filters.
x8 oversampling need 3 x2 stages. What about the 3rd stage?
The first stage is x4.
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,705
Location
Hampshire
Ok.
128 taps is not a lot for a 1st x4 filter.
It's not a lot, but it's enough to be useful. For example, here's something I whipped up quickly in Matlab with coefficients rounded to 24-bit precision as required by the ESS chip:
1633882940613.png


Contrary to what Rob Watts would have you believe, there is no need for ridiculously long filters.
 

tcli

Member
Joined
Oct 9, 2021
Messages
36
Likes
34
Location
France
It's not a lot, but it's enough to be useful. For example, here's something I whipped up quickly in Matlab with coefficients rounded to 24-bit precision as required by the ESS chip:
More than -120db of attenuation is great, but to get it with 128 taps, you had to choose a bit large transition band.
How much pass band ripple ?
Contrary to what Rob Watts would have you believe, there is no need for ridiculously long filters.
Don't kill the fun of the filter game ;)
 
OP
B

bennetng

Major Contributor
Joined
Nov 15, 2017
Messages
1,634
Likes
1,693
I think the mention of Chord, PGGB etc are unavoidable when talking about filter length:p
Some other filter examples I posted years ago:
 

magicscreen

Senior Member
Joined
May 21, 2019
Messages
300
Likes
177
Why is this the only possibly output?
Will it be 1V input -> 1V output?
You have a lots of immediate values between.
 
OP
B

bennetng

Major Contributor
Joined
Nov 15, 2017
Messages
1,634
Likes
1,693
The video talks about the fundamental theorem, not the implementations. For instance you can have PI in 3.14, 3.1416, 3.1415927 etc. It doesn't mean 3.14 is "wrong". It depends on how many precision is needed to accomplish a specific task.

Also, 1V input -> 1V output is not the point of the video, and even not necessarily related to D/A and A/D. It is more about analog things like "unity gain" and so on.
 

hyperknot

Active Member
Joined
Aug 17, 2019
Messages
260
Likes
166
Hi, I'm planning to convert my whole SACD / DSD library to FLAC 24/88. What is the "ultimate" archival quality setting for this? I'm happy to trim frequencies over 30kHz.
Is this command:


dsd -V %1 -p rate -vb 74 88200 | sox -V -p "%~dp1%~n1 88k SoX.flac" gain 5 dither


Is this higher quality compared to Foobar? Even Saracon?

Also, what is the point of using gain 5? Isn't it risky for an unknown source of DSD? My idea is to just leave it at 0 and tag ReplayGain on it.
 
OP
B

bennetng

Major Contributor
Joined
Nov 15, 2017
Messages
1,634
Likes
1,693
If you prefer to use RG, then simply skip the whole "gain 5" command. It is kind of a tutorial/exercise to explain why clipping was occurred in the Saracon and DSD Master converted files downloaded from that website. It seems that the links are dead now, though.

If SoX sees clipping, it will show warnings in the command prompt console, so you will know it.
 

hyperknot

Active Member
Joined
Aug 17, 2019
Messages
260
Likes
166
The reason there might be clipping is that some records don't use -6 dB gain but something less than that, right? For example the album in the post used something like -4.5 dB I guess?

I think the "perfect" solution would be a 2 pass conversion, first with 0 dB, check the peak and then with +peak dB right?
A simpler solution is to use 0 dB + RG. In this case we loose 1 bit of precision, so it'll be 23 bit in practice. I don't think there is any DAC or amp which could resolve 23 bit though, so I think it's perfectly fine to loose 1 bit.

Is this the right way of thinking about it?
 
OP
B

bennetng

Major Contributor
Joined
Nov 15, 2017
Messages
1,634
Likes
1,693
It is not that simple. DSD is always 1-bit (+1, -1 and no 0) so the concept of "clipping" in terms of PCM doesn't apply. A DSD stream can screw up if there are too many (a vague limit depends on many lengthy to explain factors) consecutive + or - values without any switching in-between, but in this case the source is already broken, all sane studio workers must avoid deliver these things to customer otherwise they are simply incompetent.

In the case of DSD to PCM, the 1-bit stream is firstly converted to multibit, then apply a low pass filter to remove ultrasonic noise, this operation can generate multibit amplitude values exceeding the reference 0dBFS limit, and it is dependent on the filter parameters. Therefore it is not 100% safe to assume software A's gain level is always compatible with software B.

Omitting the gain command is identical to gain 0, so if you prefer, simply skip it.
 

hyperknot

Active Member
Joined
Aug 17, 2019
Messages
260
Likes
166
So you are saying that the "decoding" part of the command dsd -V %1 -p rate -vb 74 88200 can already generate clipping? Does SoX show clipping at this point or it happens in the encoding part?
 
OP
B

bennetng

Major Contributor
Joined
Nov 15, 2017
Messages
1,634
Likes
1,693
So you are saying that the "decoding" part of the command dsd -V %1 -p rate -vb 74 88200 can already generate clipping? Does SoX show clipping at this point or it happens in the encoding part?
It can, and SoX will warn you if this happens, if you have these kinds of rare and extreme source materials. In this case, you may need to try a negative gain command before using rate.

Michael Jackson's Thriller SACD is a famous example if you Google it. You can even see people posting waveform showing strange and sudden waveform flipping and peaking. That SACD release is somewhat broken inherently.
 

hyperknot

Active Member
Joined
Aug 17, 2019
Messages
260
Likes
166
But was that the case with the Mahler sample where all software clipped except SoX? Unfortunately the source DSD file is not available on the blog any longer.
 
Top Bottom