NOS Filter in ESS DACs

Discussion in 'Computer Audiophile: Software, Configs, Tools' started by soumya, Jun 5, 2022.

  1. soumya

    soumya Acquaintance

    Joined:
    Jun 24, 2018
    Likes Received:
    42
    Trophy Points:
    18
    Location:
    Mordor, Middle Earth
    One of the things I like about AKM DAC chips is the presence of a NOS-like filter. AKM calls it super-slow roll off filter. DAC implementations might give it different names.

    Anyways, Zero Order Hold (ZOH) is one feature I dearly miss in ESS DACs.
    While it's actually pretty easy to write a C++ code that reads PCM samples and copies them (n-1) times for an up-sampling ratio of n, I thought of making use of existing tools to accomplish the same.

    This can be easily accomplished using SoX up-sample and fir effects (filters). Refer http://sox.sourceforge.net/sox.html
    First, we need to zero stuff (insert n-1 0 value samples between every original sample). This is exactly what upsample effect in SoX does.
    And finally , we need to do either create a coefficients file or pass the coefficients directly to the FIR effect arguments.
    We need to have as many 1s as coefficients as the up-sampling ratio.

    So say the input Fs = 44.1 kHz. ESS mandates , unless the OSF stage is being bypassed, that the sampling rate out of the first stage interpolation (in to 2nd stage IIR stage) should be at least 352.8 / 384 kHz.
    So we need a minimum up-sampling ratio of 8 for a 44.1 kHz input sampling rate.
    Hence, we need eight 1s as coefficients.

    We can do either this (assuming a 44.1kHz input WAV PCM file)
    sox <input.wav> -r 352800 <output.wav> upsample 8 fir 1 1 1 1 1 1 1 1
    or this
    sox <input.wav> -r 352800 <output.wav> upsample 8 fir <coefficients.txt>
    where <coefficients.txt> is the coefficients file containing the eight 1s - one each line.

    Now some measurements. No, I am not going to spawn another SINAD chart :)

    Please see - since the coefficients are normalized (to 1), levels are 18 dB above 0 dBFS (20 log 8) where 8 is the up-sampling ratio. This helps compensating for 18 dB attenuation in audible band resulting from up-sample filter of SoX.
    If for any imaginable reason, we want to normalize to 0 dBFS, we can have all the 8 coefficients as 0.125 (i.e. 1/8) instead of 1. But doing will result in 18 dB attenuation!

    Frequency Response [20 Hz - 20kHz]
    [​IMG]
    We see typical NOS DAC like FR - that slow ramp down to about -3 dB at 20 kHz. And continues to do so till 1 x Fs Hz.

    Anti-aliasing
    [​IMG]
    And we also zero anti-aliasing as is the case with NOS DACs.

    Impulse Response
    [​IMG]
    And finally typical NOS impulse response. Please see I have deliberately padded 0s before and after to make the filter 4096 taps long just to make it look pretty :) But in reality that's not at all needed.

    Now, time to look at some wave-forms ...

    Let's generate 1kHz sine signal sampled at 44.1 kHz first.
    sox -V6 -S -n -r 44100 -c 2 -b 32 -e floating-point test.wav synth 30 sine 1000 norm 0
    Loading it in Audacity and zooming in , this is what we see
    [​IMG]

    Next up, we will zero stuff with seven 0 value samples between each original sample.
    sox test.wav -r 352800 test-upsample.wav upsample 8
    [​IMG]

    And finally we will apply FIR filter of 8 coefficients on the resultant up-sampled PCM.
    sox test-upsample.wav test-zoh.wav fir 1 1 1 1 1 1 1 1
    [​IMG]

    Now does this stair stepped wave-form look familiar to you? :)
     
    • Like Like x 4
    • Epic Epic x 2
    • List
  2. Woland

    Woland Friend

    Pyrate
    Joined:
    Jan 13, 2021
    Likes Received:
    1,322
    Trophy Points:
    93
    Location:
    a friendly land
    So this technique unlocks a NOS-like mode in ESS based DACs? You've shown it for a WAV file... is it possible to run it on a UPNP streamer with upsampling like one of the Raspberry Pi distributions?
     
  3. soumya

    soumya Acquaintance

    Joined:
    Jun 24, 2018
    Likes Received:
    42
    Trophy Points:
    18
    Location:
    Mordor, Middle Earth
    This can be applied to any oversampling DAC for so long the DAC has allows bypassing its internal interpolation filter beyond a certain input Fs.
    For most delta Sigma DAC chips this is 8 Fs - so 352.8/384 kHz.

    As for whether this can be used in any streaming solution - absolutely yes!
    In fact , that's how I'm using any FIR filter for that matter.
    The examples provided here are merely for people to understand the concept with physical files.
    But the idea can be expanded to stdin and stsout in a processing chain.

    So say we want to apply for Spotify Connect client. Use it in conjunction with librespot piping the decoded PCM in to sox and finally in to an alsa endpoint. All the while controlling playback from your phone.

    Likewise , for UPnP/DLNA, use gmediarenderer as a DLNA Renderer endpoint, pipe the decoded PCM in to sox and finally to alsa endpoint. I use BubbleUPnP but I guess any DLNA client will work.
     
  4. purr1n

    purr1n Desire for betterer is endless.

    Staff Member Pyrate BWC
    Joined:
    Sep 24, 2015
    Likes Received:
    89,962
    Trophy Points:
    113
    Location:
    Padre Island CC TX
    Sort of. Remember, delta-sigma DACs are just that, delta-sigma internally. The modulators don't run at nice multiples of multibit sampling rates. They run in the tens of megahertz region.

    Would be curious if we get some of the NOS sound. The rolloff and anti-aliasing (lack thereof) are there. ESS DACs stage like ass, so NOS stage could be a improvement. (Not talking accuracy here - putting on my interpretive DAC / gear hat on).
     
    Last edited: Jun 5, 2022
  5. Woland

    Woland Friend

    Pyrate
    Joined:
    Jan 13, 2021
    Likes Received:
    1,322
    Trophy Points:
    93
    Location:
    a friendly land
    If I can get it to work, I'll post some free music in original vs SoumyaNOS format. Anyone with a DAC that takes 352.8kHz PCM will be able to compare.

    My understanding is that the 'NOS sound' is mostly about the smoothing / filtering being done by the analog hardware after the DAC instead of the digital side before the DAC. SoumyaNOS may be an excellent way to test out your analog hardware before spending time and money with an actual NOS DAC.
     
  6. purr1n

    purr1n Desire for betterer is endless.

    Staff Member Pyrate BWC
    Joined:
    Sep 24, 2015
    Likes Received:
    89,962
    Trophy Points:
    113
    Location:
    Padre Island CC TX
    x4 "NOS" (copying same code word x4) oversampling (192 is max on the Modi 3E USB), but nevertheless...

    upload_2022-6-5_19-58-30.png
    upload_2022-6-5_19-58-33.png

    LOLZ
     
    • Epic Epic x 2
    • Like Like x 1
    • List
    Last edited: Jun 5, 2022
  7. purr1n

    purr1n Desire for betterer is endless.

    Staff Member Pyrate BWC
    Joined:
    Sep 24, 2015
    Likes Received:
    89,962
    Trophy Points:
    113
    Location:
    Padre Island CC TX
    x4 "NOS" (copying same code word x4) 192kHz sampling
    White Noise
    Modi 3E
    upload_2022-6-5_20-7-10.png
    NOS-like rolloff and a shit-ton of high-frequency noise - remember any analog filter is going to be way up because delta-sigma.

    18kHz 48kHz sampling
    Modi 3E
    upload_2022-6-5_20-8-46.png
    upload_2022-6-5_20-19-44.png

    x4 "NOS" (copying same code word x4) 192kHz sampling
    18kHz
    Modi 3E
    upload_2022-6-5_20-13-30.png
    upload_2022-6-5_20-19-10.png
    Alias city, umm, cough, I mean charming NOS-like harmonic and subharmonic tone density. :p
     
    Last edited: Jun 5, 2022
  8. Woland

    Woland Friend

    Pyrate
    Joined:
    Jan 13, 2021
    Likes Received:
    1,322
    Trophy Points:
    93
    Location:
    a friendly land
    That's measured at the DAC output right? Surely we've got to expect a NOS DAC is going to be producing ultrasonics to make a stepwise waveform? The question is what happens later in the chain... any chance of doing a comparison of raw and SoumyaNOS measured later in your chain?
     
    • Agreed, ditto, +1 Agreed, ditto, +1 x 1
    • List
  9. soumya

    soumya Acquaintance

    Joined:
    Jun 24, 2018
    Likes Received:
    42
    Trophy Points:
    18
    Location:
    Mordor, Middle Earth
    Thanks for trying out the settings @purr1n !

    Couple of things about ESS / AKM :

    While it's true like any other D-S DAC, the final Fs that goes to modulator operates in MHz region it is still always a multiple of original input Fs.
    It's usually 128/256 x depending on register settings.

    This is achieved in following stages
    a. 8x interpolation (which is cascaded for 44.1 ~ 96 kHz but single stage for 176.4/192 kHz).
    b. the remaining 16x/32x is an IIR filter for ESS and a ZoH for AKM.


    The interpolation stage for both ESS and AKM are very similar.
    Like mentioned above , for 44.1 ~ 96 kHz the FIR with the highest number of coefficients are used for 2x interpolation. There after a much gentler FIR filter with fewer taps is used to take the final Fs to 8x.
    Which means even for input Fs = 176.4 / 192 kHz we are not fully bypassing the interpolation stage of the DAC chip.

    In these stages, the ones which have the most severe implications in time domain are the interpolation stage and the modulator itself.
    Neither the IIR filter (which is analog in nature) nor the ZoH will adversely impact the signal in time domain.
    Which kind of explains why overriding the 8x interpolation in software brings biggest change to soundstage and micro-details.


    I don't have acces to an analyzer. But I can check the DAC output on my DSO when fed with 8 Fs sampling rates.
     
    Last edited: Jun 5, 2022
  10. purr1n

    purr1n Desire for betterer is endless.

    Staff Member Pyrate BWC
    Joined:
    Sep 24, 2015
    Likes Received:
    89,962
    Trophy Points:
    113
    Location:
    Padre Island CC TX
    There's a possibility that gear after the DAC would inherently perform anti-aliasing if it's bandwidth limited. Headphones certainly to some extent. Maybe transformers in tube amps, but this can vary as some audio transformers can have very high bandwidth, and even this can depend upon the load.

    I'll encode an audio track and report back.
     
  11. Vtory

    Vtory Audiophileâ„¢

    Pyrate MZR
    Joined:
    Sep 12, 2016
    Likes Received:
    10,842
    Trophy Points:
    113
    Location:
    East Coast
    I'm not very sure if what @soumya show support what he claims.

    Maybe I'm mistaken. But please see below.

    First, I believe what he wants is to bypass ess chip's oversample filter. But as far as I understood from the specification sheet, it's NOT automatically activated/deactivated upon input signals. It needs to be programmed in the chip.

    Quoting from ESS 9038 Pro datasheet: https://www.esstech.com/wp-content/uploads/2021/03/ES9038PRO-Datasheet-v3.7.pdf

    In Page 9
    upload_2022-6-6_15-25-58.png

    and Page 37
    upload_2022-6-6_15-27-32.png

    It needs low-level programming at least. Or the dac product should implement this in its sw. I've seen some Chinese products offer interface to toggle this on users' end, which I guess are redirected to bypass_osf.

    So the claim to feed manually FIRed signal seem incomplete and possibly misleading.

    Second, his graphs are not about how dac is manipulating.

    The waveform graphs seem what sox program with this specific fir configuration did, rather than if ESS kept it unchanged before IIR stage. In other words, it's all done in the computer -- nothing to do with dacs.


    The first three response graphs don't seem actual dac signal (either in digital stages or analog outs), either. As he said he did not have analyzers, I believe those graphs are unlikely to show how signals are processed in the dac. Posted graphs are possibly calculated and plotted fir outs via matlab or other sw. Indeed, my understanding is it's nearly impossible to monitor in-the-chip processes in ESS chip (guessing all d/s chips as well). What users can do is to measure analog outputs (post IIR+etc).

    Here are my general takeaways
    1) While we can't clearly verify, I am largely trusting ESS's claim that FIR part is bypassable.
    2) Nonetheless, very skeptical if doing so is beneficial unless users want to apply custom OS filters. Even if so, I'm betting it's far less effective than multibit dacs tho, given the nature of delta-sigma modulation.
    3) I do know I am not a fan of nos at all but .. strongly believe if anyone wants NOS, the best way is to buy nos dac or os-togglable multibit dac.
     
    Last edited: Jun 6, 2022
  12. soumya

    soumya Acquaintance

    Joined:
    Jun 24, 2018
    Likes Received:
    42
    Trophy Points:
    18
    Location:
    Mordor, Middle Earth
    ESS (and AKM) 8 Fs interpolation stage is applicable only for sampling rates up to 192 kHz ; so the interpolation bandwidth is capped at 1.536 MHz - regardless of whether the I2C register signal bypasses the OSF or not.

    Think I mentioned this in the Gustard X26 Pro thread but re-iterating here again - the OSF bypass register is used when typically a DAC implementation wants to override the built-in coefficients/filters of ESS. We can still pass lower than 8 Fs sampling rate at the expense of early roll-off.
    There is one other implication w.r.t. to enabling or disabling ASRC (aka Jitter Eliminator) but that's outside the scope of the discussion.

    Anyways, at DXD sampling rates and above the interpolation is no longer in effect. That said, one thing to bear in mind - the interpolation stage keeps a headroom of about 1-1.5 dB for inter-sample peaks. So when OSF ByPass is engaged, the output levels are bumped up by the said margin. Barring that there is not difference in the signal when fed 8 Fs with or without OSF Bypass in place.
    FYI - a somewhat contrived way of ascertaining if the ESS built-in filters are engaged or not:
    When we input Fs <= 192 kHz and change the filters in quick succession, we get to hear a faint click/pop sound. Because of the interpolator loading the coefficients.
    Try the same experiment with Fs >= 352.8 kHz and observe.


    It didn't occur to me that I should explicitly mention that the graphs are purely from the SoX output to be fed at 8 Fs sampling rates and not out of a DAC analog output. Though it can be inferred indirectly when I mentioned of capturing analog output in post #9.
     
  13. Vtory

    Vtory Audiophileâ„¢

    Pyrate MZR
    Joined:
    Sep 12, 2016
    Likes Received:
    10,842
    Trophy Points:
    113
    Location:
    East Coast
    Could you refer to specific location of the ESS documents for this? I want to be assured if OSF is done with exactly fixed ratios and conditioned by input signal frequency. Asking this because there's another possibility that input signal is always resampled to a certain frequency.

    This sounds like a very clever way to experiment. Thanks!

    UPDATE: Tested. But FIR O/S doesn't seem to be bypassed. Test results below.
    • 44khz no upsampling on the player + osf_bypass unengaged (my dac calls it "NOS-mode") --> Clicking sound as filters changed.
    • 44khz no upsampling on the player + osf_bypass engaged --> No clicking sound & Zero perceived change over filters as expected.
    • Same results when upsampled to 88.2khz.
    • Same results when upsampled to 352.8khz as well as 384khz (i.e., clicking sound when osf_bypass unused)
    So signal-dependent bypassing may not be the case for me. For the reference, I tested all these with the gustard X18.
     
    Last edited: Jun 6, 2022
  14. soumya

    soumya Acquaintance

    Joined:
    Jun 24, 2018
    Likes Received:
    42
    Trophy Points:
    18
    Location:
    Mordor, Middle Earth
    @Vtory
    So I checked with X-18 and X-16 today and concur with your findings.
    Oddly enough, the other ESS Sabre based DACs I tried don't make the faint sound beyond 192 kHz (Soncoz LA-QXD1, Oppo HA-2SE etc). If I have to hazard a guess - it's most likely these DACs use the builtin DPLL+ASRC of ESS but not sure.

    So in a nutshell, you are right about the interpolation filter being always engaged unless OSF Bypass register is set to true!

    So this page here, while dated and talking about 9018, still holds true for current crop of ESS chips as the MCLK is still 100 Mhz.
    https://hifiduino.wordpress.com/2011/10/18/why-is-80mhz-is-not-enough/

    If I have to summarize my findings it is this - ESS OSF bandwidth is 8x or 1.536 MHz which ever is lower. For sampling rates above 192 kHz the ratio is 4x (for 352.8/384 kHz) or 2x (for 705.6 / 768 kHz).

    I don't have an analyzer but with my DSO I was able to capture decent impulse responses.

    This is with X-18 with @ 768 kHz

    Apodizing Filter
    [​IMG]

    Linear Phase Slow Roll-off
    [​IMG]

    Min Phase Fast Roll Off
    [​IMG]

    Finally, NOS mode (OSF Bypass)
    [​IMG]


    I will capture the DAC output waveform with ZoH filter and post here shortly.
     
    • Like Like x 1
    • Epic Epic x 1
    • List

Share This Page