• 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!

Why DAC filter tests always use illegal square waves for impulse response?

Oklei

Member
Forum Donor
Joined
Jul 21, 2020
Messages
84
Likes
126
On time domain dac filter tests here and pretty much everywhere else the response is always shown with an squarewave that has more bandwidth than possibly could be in a real recorded digital signal. During adc or while downsampling to 44.1khz higher frequencies have to be filtered out to prevent aliasing. If this is done properly, the recorded signal does not include any frequencies higher than 22kHz anymore. So a squarewave impulse response seems senseless.

We need a low pass filter during dac to attenuate imaging and want the filter to be mostly accurate to the recorded signal in the time domain too. Mathematically unavoidable sharp filters do more harm in time response and less in frequency response and slow filters the other way around.
But why not use the steepest 'square' wave a signal can have at a given sampling rate and bandwidth and compare that to the filter response? Wouldn't that be much more a real world approach to see if the filter really does harm to the time response of actual correctly recorded music than use a square wave that couldn't ever possibly be in a correctly recorded signal at that sampling rate?
 

Blumlein 88

Grand Contributor
Forum Donor
Joined
Feb 23, 2016
Messages
20,796
Likes
37,705
Could you give examples. Most of the time I've seen them use a single impulse response. One bit to max level also called a Dirac pulse.

I've also seen people use white noise at a rather high level to see the filter response.

As for square waves, they are a fundamental and the odd harmonics. The squarest wave possible in a bandwidth limited system will be the lowest frequency. 1 hz square waves or 5 hz square waves will have more of the harmonics than a 10 khz square wave. Giving it a more squared appearance.
 
OP
Oklei

Oklei

Member
Forum Donor
Joined
Jul 21, 2020
Messages
84
Likes
126

Attachments

  • W-DAC_v13A_Filt_SDSharp_Square-768x576.png
    W-DAC_v13A_Filt_SDSharp_Square-768x576.png
    131.5 KB · Views: 108
OP
Oklei

Oklei

Member
Forum Donor
Joined
Jul 21, 2020
Messages
84
Likes
126
I find this a bit misleading as one would compare the filter output to the entered square wave and is seeing all the ringing. But that ideal input square wave has unlimited bandwidth and could never be in a proper recorded anti aliased music file. The same argument would also apply for a Dirac pulse. To generate one properly you would also need unlimited bandwidth which cannot be in the adc filtered recorded file. So this can resolve filter problems that just wouldn't exist in real life.
 

Blumlein 88

Grand Contributor
Forum Donor
Joined
Feb 23, 2016
Messages
20,796
Likes
37,705
I find this a bit misleading as one would compare the filter output to the entered square wave and is seeing all the ringing. But that ideal input square wave has unlimited bandwidth and could never be in a proper recorded anti aliased music file. The same argument would also apply for a Dirac pulse. To generate one properly you would also need unlimited bandwidth which cannot be in the adc filtered recorded file. So this can resolve filter problems that just wouldn't exist in real life.
The purpose of those 'illegal' signals to a DAC is to see the filter response. Overly much has been made of how they 'ring'. An ADC fed a squarewave of wide bandwidth will filter out the excessive frequencies and what it records will look much like the DAC filters with the Gibbs phenomena of 'ringing'. You then feed that to a DAC and it outputs the same shape (assuming ADC and DAC have the same filter). Using those illegal signals fed to a DAC give you the type of filter response without influence of the filter in the ADC. So it makes sense as a test signal, but not much else.
 

dc655321

Major Contributor
Joined
Mar 4, 2018
Messages
1,597
Likes
2,236
A square wave with a suitably chosen duty cycle will encode time-domain characteristics of the filter in its output.
For the example you posted above, we can observe that the filter is minimum phase, it's length is > 500 us, etc
 

DVDdoug

Major Contributor
Joined
May 27, 2021
Messages
3,039
Likes
4,005
They aren't "illegal". A CD can contain square waves (or clipped waves) and some digitally-generated music contains square and rectangular waves.
 

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,723
Likes
6,016
Location
US East
To assess the characteristics of a filter, it make much much more sense to look at it in the frequency domain, i.e. look at the frequency response (including phase). How does one figure out what the cutoff frequency, slope, phase response, stop band rejection, etc. from looking at a square wave response?
 

Blumlein 88

Grand Contributor
Forum Donor
Joined
Feb 23, 2016
Messages
20,796
Likes
37,705
They aren't "illegal". A CD can contain square waves (or clipped waves) and some digitally-generated music contains square and rectangular waves.
Illegal in the sense that no ADC>DAC loop would contain those frequencies above the normal cut-off for the sample rate in use.
 

restorer-john

Grand Contributor
Joined
Mar 1, 2018
Messages
12,743
Likes
39,006
Location
Gold Coast, Queensland, Australia
There's nothing "illegal" about the signals- that's a ridiculous assertion. At what arbitary point do you think a signal becomes against the law? A digital playback system is just that. Whatever signals you want to place in the data stream are perfectly valid and the D/A should reproduce them.

If you want to consider an entire chain from analogue capture to playback, clearly some signals cannot be captured, but we are talking playback systems here. If I can put it on a disc/file whatever- it is valid.

If you take an early 16/44.1 R2R CD player and tap in right after the IV converter and before the LPF, you have beautiful and perfectly square waves- no under/overshoot. Do the same with a single impulse and that's all you get- a single impulse, one sample wide. All compact disc tests discs from day one contained digitally generated impulses, squares and signals to test the system.
 
Last edited:

dc655321

Major Contributor
Joined
Mar 4, 2018
Messages
1,597
Likes
2,236
To assess the characteristics of a filter, it make much much more sense to look at it in the frequency domain, i.e. look at the frequency response (including phase).

Yes, for sure. Frequency domain is much more useful for filter assessment.

How does one figure out what the cutoff frequency, slope, phase response, stop band rejection, etc. from looking at a square wave response?

I know you know this, but at least for the case of sinc-function filters the corner frequency can be gleaned from the roots (zeros), and the phase response is of course trivial given the length. In theory...
 

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,723
Likes
6,016
Location
US East
I know you know this, but at least for the case of sinc-function filters the corner frequency can be gleaned from the roots (zeros), and the phase response is of course trivial given the length. In theory...
My point is how do you know for sure from looking at the waveform it is really a sinc function? May be the amplitudes are off or shaped by a window?
 

dc655321

Major Contributor
Joined
Mar 4, 2018
Messages
1,597
Likes
2,236
My point is how do you know for sure from looking at the waveform it is really a sinc function? May be the amplitudes are off or shaped by a window?

Thus, my cryptic, "In theory..."
As you say, can't know for certain. I'm fine with guessing for back-of-the-envelope estimations.
 
  • Like
Reactions: NTK

LTig

Master Contributor
Forum Donor
Joined
Feb 27, 2019
Messages
5,847
Likes
9,601
Location
Europe
Illegal in the sense that no ADC>DAC loop would contain those frequencies above the normal cut-off for the sample rate in use.
That's what I had thought as well until someone here showed not long ago that no digital signal is illegal[1]. Just feed the analog signal at the output of the DAC to an ADC and you will see this 'illegal' signal in the captured PCM data.

[1] Except for intersample overs which neither the DAC nor the ADC could handle.
 

LTig

Master Contributor
Forum Donor
Joined
Feb 27, 2019
Messages
5,847
Likes
9,601
Location
Europe
There's nothing "illegal" about the signals- that's a ridiculous assertion. At what arbitary point do you think a signal becomes against the law? A digital playback system is just that. Whatever signals you want to place in the data stream are perfectly valid and the D/A should reproduce them.

If you want to consider an entire chain from analogue capture to playback, clearly some signals cannot be captured, but we are talking playback systems here. If I can put it on a disc/file whatever- it is valid.
I agree except for intersample overs. Most DAC's are unable to reproduce them properly, and @ayane has shown that they can be much higher than +3dB.
 

restorer-john

Grand Contributor
Joined
Mar 1, 2018
Messages
12,743
Likes
39,006
Location
Gold Coast, Queensland, Australia
I agree except for intersample overs. Most DAC's are unable to reproduce them properly, and @ayane has shown that they can be much higher than +3dB.

Intersample overs are basically the result of faulty recording practices. Basically, clipped peaks in the digital domain. Hardly the job of a DAC to re-create what was chopped off in the first place.

But the problem doesn't really rear its head in 16/44 playback with R2R DACs. The filtering was analog with significant headroom by default from the supply rails for the IVs and active LPFs. This is a 100Hz Square wave (digitally generated) into a Sony CDP-101 (word's first CD player). 16/44 NOS.

1628298377549.png


Note, we have instananeous rise (<40uS) with no pre-ringing, ~25% overshoot headroom.
 

JohnYang1997

Master Contributor
Technical Expert
Audio Company
Joined
Dec 28, 2018
Messages
7,175
Likes
18,300
Location
China
They aren't "illegal". A CD can contain square waves (or clipped waves) and some digitally-generated music contains square and rectangular waves.
It is illegal in the sense of sampling. Yes a CD can contain those signal but it doesn't make it not illegal.
Such files will never happen after A to D conversion with proper filter. It exists because digital processing.
 

JohnYang1997

Master Contributor
Technical Expert
Audio Company
Joined
Dec 28, 2018
Messages
7,175
Likes
18,300
Location
China
That's what I had thought as well until someone here showed not long ago that no digital signal is illegal[1]. Just feed the analog signal at the output of the DAC to an ADC and you will see this 'illegal' signal in the captured PCM data.

[1] Except for intersample overs which neither the DAC nor the ADC could handle.
The gain in the A to D conversion must be low enough to not have clipping. And this will pretty much guarantee DAC not to clip. It's not the shape itself but the shape + amplitude.
 

LTig

Master Contributor
Forum Donor
Joined
Feb 27, 2019
Messages
5,847
Likes
9,601
Location
Europe
The gain in the A to D conversion must be low enough to not have clipping. And this will pretty much guarantee DAC not to clip. It's not the shape itself but the shape + amplitude.
Yep, and you need an analog level meter to control the peak level, not a digital display behind the ADC which cannot detect intersample overs (at least not without first resampling the PCM data to a higher sampling rate with some digital headroom).
 
Top Bottom