Filter brewing for the Soekris R2R

Disabled Account
Joined 2005
Last edited:
The poor little DAC ladder is something that sees only 28 bits of digital data and transforms it to a analog signal. It can do nothing more but it does it next to perfect (especially at that level there is no handling of too big signals).

Infront the ladder we have the FPGA signal processing (with some savety headroom etc) which has to produce, as final output, these 28 bits. So if the signal, after processing, is too high the only and optimal thing that the FPGA can do is to clip it to the maximal 28 bit signal the ladder can handle.

So any clipping you can meassure at the analog output you can already see as signal with too high amplitue in the processed (filters, gain) digital data.

That at least is what I think of being the "trouth".

As far I understand your sox related post, you can simulate the upsampling - filter - gain - upsampling - filter process in sox, and sox complains about clipped data in the result.
So as long you get complains that way with sox, you will have clipping at the DAC (and none if not).
 
Disabled Account
Joined 2005
What I found was that Søren's FIR1 alone was enough to clip when using Sox, but Søren said that the DAM had enough headroom in the FPGA processing to avoid clipping.

I believe the optimal thing would be to maintain headroom through the conversion stage. Unless you listen exclusively to sine waves this is actually an issue, rather than something to shrug our shoulders and say "what can we do?".

I've discovered that Benchmark's DAC2 HGC addresses the issue by maintaining a 3.5dB headroom right through the conversion process. As I read it the signal passed to the convertor is attenuated by 3.5dB to prevent clipping occurring during conversion.

This is Benchmark's marketing spiel on the feature...

HIGH HEADROOM DSP - WITH 3.5 DB "EXCESS" DIGITAL HEADROOM

All of the digital processing in the DAC2 HGC is designed to handle signals as high as +3.5 dBFS. Most digital systems clip signals that exceed 0 dBFS. The 0 dBFS limitation seems reasonable, as 0 dBFS is the highest sinusoidal signal level that can be represented in a digital system. However, a detailed investigation of the mathematics of PCM digital systems will reveal that inter-sample peaks may reach levels slightly higher than +3 dBFS while individual samples never exceed 0 dBFS. These inter-sample overs are common in commercial releases, and are of no consequence in a PCM system until they reach an interpolation process. But, for a variety of reasons, virtually all audio D/A converters use an interpolation process. The interpolation process is absolutely necessary to achieve 24-bit state-of-the art conversion performance. Unfortunately, inter-sample overs cause clipping in most interpolators. This clipping produces distortion products that are non-harmonic and non-musical . We believe these broadband distortion products often add a harshness or false high-frequency sparkle to digital reproduction. The DAC2 HGC avoids these problems by maintaining at least 3.5 dB of headroom in the entire conversion system. We believe this added headroom is a groundbreaking improvement.

My suspicion is that FIR1 doesn't need the gain altered from theoretical, as Søren has accounted for clipping. Adding headroom by reducing the gain in FIR2 - which is the final step before the R2R ladder if our assumptions are correct - should be sufficient.
 
Last edited:
Disabled Account
Joined 2005
If doubling the amplitude = 6dB gain, the x8 multiplier should give 24dB gain.

So working on the basis that (multiplier/2)*6dB = gain:

multiplier = (24dB - Headroom dB)/3

To obtain 3.5dB headroom:
multiplier = (24-3.5)/3
= 6.833

So in theory using 6.833 as the multiplier for FIR2 should give enough headroom to avoid inter-sample clipping.
 
Last edited:
Disabled Account
Joined 2005
The above seems to work in practise also.

Using FIR1 with multiplier = x8 and FIR2 with multiplier = x6.833 and volume set to V+00 there is no clipping on the square wave inter-sample peaks. Increasing to V+01 results in clipping.

Add: I tested with FIR1 multiplier = 6.833 and FIR2 multiplier = 8 and this seems to have the same effect.
Add2: It also works if you split the attenuation between FIR1 and FIR2.
This seems to confirm that the filters are not clipping, and that adding "headroom" to the signal avoids clipping in the R2R ladder.

Signal Scope behaves far better at 2K btw. Zoomed out 1kHz wave form attached but doesn't add much to the discussion.

attachment.php
 

Attachments

  • 2KRect0dBFS.png
    2KRect0dBFS.png
    38.9 KB · Views: 1,635
  • 1KSW_0dBFS.png
    1KSW_0dBFS.png
    50.4 KB · Views: 680
Last edited:
Got beaten by the edit time out...

I thought I should check that the same clipping//not clipping behaviour occurs using unbuffered outs - it does.

Thanks again, Paul. This experiment is really educational. I love the fact that your curiousity, combined with your good equipment, drive you to dig out these answers.

Soren has allowed us to play with filters, probably for the first time in DIY, and your experiments show that filter design, jitter of course, and now clipping need to be under control for a good DAC design.
 
Disabled Account
Joined 2005
The sound of totalCRaP™

This is my latest totalCRaP™ filter.

The key features are:
- 8x OS
- Linear Phase
- Steep roll-off and healthy amount of pre/post ringing.

So something to offend everyone - except perhaps TNT and zfe ;)

The bonus feature here is:
- 3.5dB attenuation in FIR2 to provide headroom in the R2R. This will mainly benefit those not using the digital volume.

I've come across a post by Bruno Putzeys advising against use of NOS with the Hypex UcD modules as they have a 400kHz control loop, and the HF hash from NOS can interact leading to distortion in the amp. So NOS is off the menu for me as I was definitely hearing distortion even in the "sorted" NOS filters.

Please enjoy the sound of totalCRaP™...
 

Attachments

  • CurrentFilt1.png
    CurrentFilt1.png
    36 KB · Views: 536
  • CurrentFilt2.png
    CurrentFilt2.png
    24.3 KB · Views: 520
  • 1021filt_35HR_LP.skr.zip
    6.4 KB · Views: 139
  • 1021filt.txt
    60.1 KB · Views: 180
Last edited:
This is my latest totalCRaP™ filter.

The key features are:
- 8x OS
- Linear Phase
- Steep roll-off and healthy amount of pre/post ringing.

So something to offend everyone - except perhaps TNT and zfe

The bonus feature here is:
- 3.5dB attenuation in FIR2 to provide headroom in the R2R. This will mainly benefit those not using the digital volume.

I've come across a post by Bruno Putzeys advising against use of NOS with the Hypex UcD modules as they have a 400kHz control loop, and the HF hash from NOS can interact leading to distortion in the amp. So NOS is off the menu for me as I was definitely hearing distortion even in the "sorted" NOS filters.

Please enjoy the sound of totalCRaP™...



That depends.... Try expressing very small numbers in fixed point format, like some of the FIR coefficients....

But there are two things here:

1) The format that rePhase outputs, should be floating point with many digits as it don't know the actual hardware....

2) The format the actual hardware use, in case of the dam1021 it's 2.30 fixed point format for the FIR filters and 3.29 fixed point format for IIR filters. FPGA's are not good at floating point....

The mkrom utility read and process the input .txt parameter files as 64 bit floats, including the multiplier, then convert to the 2.30/3.29 fixed formats in the final step, which are pretty good, t.ex. the SigmaDSP chips use fixed 4.24 format for coefficients....


So any filter coefficients that for which coefficients x multiplier is smaller ~10^9 will be treated as zero by the DAM. There are a lot of such coefficients in your filter.

That does not mean that it is a bad filter, it is just equivalent to a shorter filter and the graphs of that will not exactly look as that what you get out of your design tools.

I have to admit I have not listend to it, as all my well known 16/44 material is in form of "silver disks" which I have not with me.
 
This is my latest totalCRaP™ filter.


Please enjoy the sound of totalCRaP™...

OK, I gave it a try. Well thanks, but this one is really not for me... After some songs I had to go back to the NOS one.
With your CRaP, I had to lower the volume a lot (but from what you wrote I understood that it should have been the exact opposite)
And, female voices are really forward, contrary to the NOS filter.
But please, keep up with the good work!!

For info the DAM is connected to a Mark Levinson not a hypex and no cans here.
Ciao
 
Disabled Account
Joined 2005
OK, I gave it a try. Well thanks, but this one is really not for me... After some songs I had to go back to the NOS one.
With your CRaP, I had to lower the volume a lot (but from what you wrote I understood that it should have been the exact opposite)
And, female voices are really forward, contrary to the NOS filter.
But please, keep up with the good work!!

For info the DAM is connected to a Mark Levinson not a hypex and no cans here.
Ciao

The "correct" NOS is rolled off in the HF.

The two images attached are of the NOS filter co-efficents applied to gaussian white noise file. Because the white noise has a flat spectrum this allows you to determine the response of the filter. Treat -40dB as 0dB. The NoS filter is -1dB at 14kHz, and -3dB at 20kHz. As Eldam and others pointed out the totalDAC uses a FIR filter to correct for this roll-off so isn't a 100% pure NOS DAC.

In contrast the first totalCRaP filter is pretty well flat out to 19kHz, so will have more HF energy above 12-13kHz. So it's not really forward, just not rolled off.

The 3.5dB headroom will potentially reduce harshness with near full-scale signals if you are using an OS filter, and fixed 0dB output.
 

Attachments

  • NOS_1s.png
    NOS_1s.png
    91.2 KB · Views: 499
  • NOS_1s_zoom.png
    NOS_1s_zoom.png
    102.6 KB · Views: 493
In contrast the first totalCRaP filter is pretty well flat out to 19kHz, so will have more HF energy above 12-13kHz. So it's not really forward, just not rolled off.

The 3.5dB headroom will potentially reduce harshness with near full-scale signals if you are using an OS filter, and fixed 0dB output.

Well, now that you are explaining it this way, perhaps I'm realizing that I've done a fundamental mistake. Indeed I also process the musical message through DIRAC. Therefore if I listen to a new filter that alter the response in the various frequencies, I should also consider redoing all measurements... The fact that I use Dirac is maybe the reason why my listening experience Is completely different then the general opinion here.... Fascinating...
 
Last edited:
Well, now that you are explaining it this way, perhaps I'm realizing that I've done a fundamental mistake. Indeed I also process the musical message through DIRAC. Therefore if I listen to a new filter that alter the response in the various frequencies, I should also consider redoing all measurements... The fact that I use Dirac is maybe the reason why my listening experience Is completely different then the general opinion here.... Fascinating...

The differences in sound between 2 filters should be the same with or without Dirac. Why don't you bypass the Dirac processing and compare the sound of both filters again?
 
The differences in sound between 2 filters should be the same with or without Dirac. Why don't you bypass the Dirac processing and compare the sound of both filters again?

Indeed I should, the weekend is not so far away... And BTW, I will soon have a Tortuga passive preamplifier. It will be interesting to see how much the digital volume Is compromising the sound quality.