5.3.2.13089 Public Beta Spdif optimisation?

  • Per,


    What is the source of your thesis?


    I am afraid this it's not correct. A sine wave can be well played back as you say. Every short time signal, transient, even the shortest impuls can be seen as a sum of many long term sine waves at different frequencies (Fourier). Thus they can be perfectly reconstructed and played back as accurate, if all frequency components (that is the sine waves) are below half the sample rate.


    The video does not state the opposite.
    There is no doubt either in the comment posts.
    However, the video is somewhat missleading as it shows the digital signal in steps.
    But in reality digital signals are not stepped when they are converted to analog.


    Feel free to ask me any question about this whole sampling topic.

  • To be clear, Christoph, are you saying that there'd be no point in running DAW projects at 48kHz instead of 44.1kHz?


    As I said earlier, I've always run at 44.1 but lately have been second-guessing this decision.


    It would be great if I could stick with 44.1kHz and say, "Christoph said there's no reason to go higher!" 8o

  • To be clear, Christoph, are you saying that there'd be no point in running DAW projects at 48kHz instead of 44.1kHz?


    As I said earlier, I've always run at 44.1 but lately have been second-guessing this decision.


    It would be great if I could stick with 44.1kHz and say, "Christoph said there's no reason to go higher!" 8o

    apparently saying "Hans said there is no reason to go higher" isnt good enough for you....... :P

  • the beauty of the sinc function is that even with a restricted range it helps iron out some (but not all) of the magnitude issues at that upper end

    What is a typical upper end frequency threshold with regards to sinc function problems? 12 kHz? 14? 16? Or above?

  • Hi Christoph, thanks for responding. My source is simply an understanding of AA and the functions involved.


    My problem with what you're saying is that this is determinant on the reconstruction filter which is typically using sinc interpolation (as it's the inverse transform of the sinc filter) having sufficient samples to reconstruct the source correctly without artifacts. The fewer samples (window, or as you called it impulse), the less accurate this can be.


    Your DAC doesn't know anything other than it's got a set of samples and it needs to generate a waveform from them, it can't make any assumptions other than it's part of a continuous (infinite) stream. If there aren't enough samples of a frequency at volume then I don't see how you can avoid getting artifacts such as the incorrectly determined magnitude for a frequency because of the moire interference patterns you get at frequencies higher than 1/3 of the sampling rate.

  • What is a typical upper end frequency threshold with regards to sinc function problems? 12 kHz? 14? 16? Or above?

    Well the sinc function and sinc filter are limited in accuracy by the number of samples (their range). The more samples, the more accurate. It's a "how deep is a hole?" sort of question.


    The sinc filters big issue is that it doesn't handle changes very well. e.g



    It's a waveform of a frequency at a little under half the sampling frequency, so perfectly valid. The middle set of samples is in fact just zeroed out silence, yet the sinc filter is give you a waveform where none should be. Determining the window to use is part of the problem, ironically a shorter window in this case gives a more accurate result to the source, but it's an extreme case and larger or small window you still get exaggerated transient. It's going to be better to live with a little bit of fade out of high frequencies that are to be honest inaudible for most people anyway.


    I just disagree with the conceit that you have total accuracy in recreation of sound waves from a sample set for all values below the Nyquist value. No filtering or anti aliasing algorithm is that good. But I also think it doesn't matter except when it comes to artifacts from processing audio at a lower sampling rate.

  • @Per But surely that would only come in to play when processing, converting from digital to analogue, converting back from analogue to digital, reprocessing, converting from digital to analogue etc. The sinc filter and function is only used at A/D or D/A...?


    By the way, I don't think the pixel/moire pattern analogy holds, to be honest. All those different frequencies on top of one another still only creates one waveform, as your speaker only vibrates in or out, it can't do both at the same time, the same way there can only be one logical solution to the recreation of a waveform, depending on where the previous value was on the crest or trough.

  • Hy head hurts. This stuff's way beyond my pay grade. :/

    apparently saying "Hans said there is no reason to go higher" isnt good enough for you....... :P

    LOL So sorry, Hans! I must've missed your statement, which couldn't have been difficult 'cause this stuff causes my eyes to glaze over.


    Let it be official then:
    I hereby declare that I'll be working at 44.1kHz 'cause "Hans said there's no reason to go higher". :thumbup:


  • Interesting Question!


    Only a few of you might know what a Sinc filter is, but, as proud player of digital guitar amps, all of you know what an impuls responce is. It can reproduce the frequency responce of a guitar cabinet at perfect accuracy. A sinc filter can also be seen as an impulse responce. It is much shorter than a cabinet IR. And it has its peak in the middle rather than on the beginning, it is symmetric. As a consequence, it can avoid any phase distortion that analog filters have, by including a small overall latency that analog filters do not have.
    The latency is half the size of the Sinc filter responce.



    I have looked up our converter, a Cirrus Logic CS42435.
    Here is the data sheet:
    http://www.mouser.com/ds/2/76/CS42435_F5-1141450.pdf



    The following numbers are seen at 44.1 kHz system sample rate:


    It samples the input at 5.6 MHz (!) which is 128x oversampling, and does the further processing in the digital domain at this rate.


    The input passband goes from 1 Hz (-3 dB) up to 21600 Hz (-0.1 dB)
    The stopband starts at 25 kHz and attenuates to -70 dB.
    That means the slope of the Sinc filter goes from -0.1 dB to -70 dB in less than 3 semitones. This is performed without any phase distortion, for the sacrifice of 9 samples latency. Thus, the length of the Sinc impuls responce is about 18 points (or samples).


    The characteristics of the Converter output is similar.



    What I have noticed is that the cutoff of the sync filter is set to about the nyquist frequency, thus the stopband filter start well over the nyquist frequency, which is usually not allowed. Simple measurements could reveal whether this would cause aliasing problem at the input or not. I am sure those maker of AD/DA converters know their business well, as they do it on a daily basis :)



    If this converter is run at 48 or 96 kHz, the Sinc filters character stay the same. In other words, the designers of the converter did not see the need to relax the steepness of the filters for better audio performance due to the larger distance between the desired 20 kHz and the respective nyquist frequency. Thus there is no improvement when run at 48 kHz, except that the passband is increased by about 1.5 semitones only.


    There is a lot of 90's talk about the drawbacks of such steep anti-aliasing filters, such as degrading frequency responce and impulse fidelity. It seems to be known to just a few, that todays converters realise anti-aliasing filters by the digital Sinc filter, which allows arbitrary frequency accuracy and exact zero phase distortion. The sole limits are latency and chip space or calculation power (costs) on the converter chip.


    There is no need to go higher than 44.1 kHz.

  • Well, I can add the name, "Christoph" to my Hans statement above; can't ask for more than that!


    Thank you for the info, Christoph. The main reason I was considering 48kHz was because I thought the brick-wall filter would be moved upwards sufficiently to noticeably reduce artefacts, but it seems from what you're saying that these new-fangled zero-phase-distortion filters don't produce them anyway.


    I really appreciate this information, mate; thank you!

    That means the slope of the Sinc filter goes from -0.1 dB to -70 dB in less than 3 semitones. This is performed without any phase distortion, for the sacrifice of 9 samples latency.

    Even from my semi-ignorant point of view, that sounds ridiculously steep. Impressive!

  • This has been a very interesting thread. I read Lavry's white paper after Per brought up sinc filters, and while I don't profess to have an iron grip on the numbers and equations, I remember enough from pure and applied mathematics that I got the gist and feel like I learned something. Thank you all!

  • Sinc is the (ideal) time domain version of a square solid block from infinity to whatever frequency you want in the frequency domain. What's nice is that it's a really simple formula.


    If you're just passing audio directly from AD through to DA without any processing then it's (almost) perfect. The almost because it's an infinite series and the smaller the "impulse" the less precise it can be (because as Fourier tells us the square wave must be the sum of every single frequency in order to make it square, if you reduce that then you get a gradually less and less crisp and flat corner to your square). But lets just say it's accurate for a given value of accurate.


    The issue is when you process. If 44.1k is all you need then why did the Kemper have audible aliasing artifacts at one point?


    Because it introduced frequencies equal to or above the Nyquist frequency. Many plugins do this, things that distort the waveform have a tendency to do this, that includes things like compressors, and even some modulation effects can conceivably cause these artifacts.


    The solution of course is to low pass that signal, ditch those nasty higher frequencies that could result in the samples being interpreted as having frequencies below Nyquist that weren't intended. But now you have a problem. Because of course those samples can be interpreted as frequencies below the Nyquist frequency, so theyr'e already low-passed, but contain errant data!


    The solution is to do your processing at a higher frequency. You up-sample, which means you convert to a much higher sample rate utilizing a sinc filter to get the correct interpolated samples. Then you apply your plugin effect to that signal, apply your sinc function to filter out everything above Nyquist, and then simply take every n'th sample as the final output.


    Problem solved. The only issue? Humans.


    Not all plugins do this up-sampling, nor apply it correctly even if they do. That means that the only way to force everything happening in a complex DAW environment to give you aliasing artifact free content without enforcing a strict "no plugins or DAW's that don't upsample for their effects" rule is to literally work with projects at higher sampling rates and then export to 44.1k (as the export will low-pass the output as you'd expect).


    So that's why it's perfectly legitimate to run at higher sampling rates and there is a need to do so from a technical standpoint.


    From a practical standpoint the reasons you need to go higher than 44.1k are because your job or pipeline require it, perhaps due to file format, perhaps due to some obscure old bandwidth and data setup on some weird piece of TV kit, but in the end because you have to adhere to a standard and because all your raw assets are at that rate already, then that's what you're going to work with because you don't want a miserable life and you rather like having a job, and the technical standpoint is completely moot because you may have others that supercede it more directly related to equipment and pipeline standards that you have no control over.


    It's important to be flexible on this stuff, because while the science may say one thing, reality can throw you curve balls.


  • This swinging resonance happens in both the digital and analog world, when you perform steep lowpass filtering. It is called the Gibbs Effect. It is perfectly described and demonstrated in the long video on this thread.


    In fact, it is not an audible resonance, as can be seen in the frequency responce. It is not a deal breaker for reconstructing any digital signal.
    Actually it has nothing to do with reconstructing, just with filtering.
    It only looks weird but does not have a sound.


    To avoid it, the steepness of the filter needs to be reduced. Doing this will compromize the frequency responce. But it is pleasing for the eyes :) ,


    Per, you are making up your own theory that is in contradiction to what digital audio experts experience every day. Do you think the guy in the video is missing something or spreading fake news?


  • Do you know of specific plugins doing it badly?
    We should call them for a simple software update that does it better, rather than forcing you to run your whole project on double sampling rate and sacrifice half of your computer, just for the purpose to circumvent their local shortcommings.

  • Do you know of specific plugins doing it badly?
    We should call them for a simple software update that does it better, rather than forcing you to run your whole project on double sampling rate and sacrifice half of your computer, just for the purpose to circumvent their local shortcommings.

    Well, almost the whole or Reason for a start, which is the DAW I mainly use, which should be more than enough. Then nearly every single compressor and/or distortion VST I've ever used apart from the UAD ones (which unfortunately outside of not having aliasing artifacts sound like shite). The filters built into Audition (though I wouldn't expect any better from Adobe)...


    Oh and they are all aware.


    This irony Is that the issue could be resolved at the DAW end of things by the DAWs themselves doing the unthinkable sampling prior to inserts, which would be a lot more efficient but that also doesnt happen AFAIK in any DAW.


    As for losing half of the computer, well those plugins that do upsample already are well, going to use more processing power because they're processing a higher sample rate, so you're not going to see any change there apart from they don't have to do their own upsampling and filtering if you raise the overall rate so those ones actually use less processing power and memory, disk usage of course goes up and that's the bigger issue. But honestly most non synth heavy projects that I do aren't that heavy to begin with. They could easily be doubled without affecting system performance. Although for me since Reason introduced VST support it's performance has degraded sharply, so I find myself more in the world of S1.

  • Wow, this is a hillarious situation.
    So you were able to prove their shortcomings by audibly increasing the quality using higher sampling rates?


    I have forgot to mention one important thing:
    Plug-ins that produce aliasing due to nonlinearities or distortion algorithms cannot be fixed by using double sampling rate in your DAW!


    Avoiding aliasing by a satisfying amount usually requires quadrupling the sample frequency, often even more.
    And it requires lowpass filtering the incoming signal prior to the distortion.
    The latter condition is usually not given, especially if there is more than one non-linear plug-in in series.
    As a consequence, trying to fix low quality plug-ins by doubling or quadrupling the samplerate will only have mediocre results, while sacrifising most of your computer power.
    The plug-ins have to be right instead.

  • Yes I'm able to prove their shortcomings, as we're many other people posting on their various forums out there for years, they devs have not fixed a damn thing. It's not news. For example https://melodiefabriek.com/blo…s-reason-aliasing-or-not/ still all true today.


    There is also the possibility of the DAW doing it right too, which would be far more efficient.


    Why do you say you need such high sample rates? With AD conversion it's required to overcome artifacting caused by the NRZ circuit. But how does this apply to already existing samples? We can carry on this conversation in private if you prefer.