Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 7 FirstFirst 1234 ... LastLast
Results 11 to 20 of 66
  1. #11
    Senior Member
    Join Date
    Jun 2006
    Posts
    1,690
    Quote Originally Posted by pippin View Post
    But then you've got all these high frequencies still in there on the analog side. Isn't the biggest problem with the high frequencies that power amps (especially ones filtering through intermediate frequencies like "Class D" amps) tend to create artifacts if you have signal in multiples of the audible range?



    What kind of filters do they use? I do know that kind of stuff for analog filters where both the reason for their use and the negative impact are quite obvious.

    But then... like for the windowed sinc filter you mentioned even digital filters are not perfectly discrete if you need finite impulse response and linear phase so it makes sense that they will also flatten the frequencies within your filter/below your cutoff frequency.
    But isn't that the same for your interpolation filter in sox? Of course, the interpolation filter doesn't window so it keeps all the harmonics in there (and creates some arbitrary new ones) but why is that better than leaving the simple harmonics of the 44.1 kHz samples in?
    What kind of filters does sox use?
    Hi Pippin,
    very good questions BTW. It turns out that with high bit depth (24) and high sample rates relative to the bandwidth of the signal the aliases are very low in amplitude. If this was not true a digtal filter would not work for this purpose at all. The amplitude of the alias is determined by the "height" of the "stair step" in the signal. At 16/44.1 those stair steps can get pretty high. Very easy to see in a scope from a NOS DAC. The filter adds steps in between the originals steps, because of the increased samples and the increased bit depth the height of the steps is much less, thus producing much lower amplitude aliases. Another way to think of it is because the bandwidth of the signal has not changed, the maximum amount of change for a given sample is also less, thus the maximum possible height for a stair step is also decreased.

    The reason to do the digital filtering at all is that for 16/44.1 the stair steps are large, thus producing high amplitude aliases, and those aliases are close to the audio band. There are two methods by which an alias can cause an image in the audio band: intermodulate with signal, or intermodulate with another alias. It turns out that the aliases produced by a given signal are lower in amplitude than the original signal, thus on average the intermodulation of aliases with signals is going to produce higher amplitude images in the audio band that alises intermodulating with other aliases. For example a 25KHz alias intermodulating with a 15KHz signal (thus producing a 10KHz image) will be greater in amplitude than the same 25KHz alias intermodulating with a 35KHz alias. They both exist, but the intermodulation with the signal will usually produce a higher amplitude image.

    Now let's look at what happens with the signal upsampled to 176.4, the aliases start at 88.2. So lets look at what happens to a 90KHz alias. First that alias is going to be much lower amplitude in the first place (see the above) and the lowest frequency image it can produce from intermodulating with signal is 70KHz, way above the audio band. Now you certainly can get images in the audio band from aliases intermodulating with other aliases, BUT because the aliases are so much lower in amplitude, the image between two is going to be very low in amplitude.

    The net result is that the images in the audio band are drastically reduced (not completely eliminated) by the upsampling and filtering. A high sample rate high bit depth original recording already has these advantages built in.

    Now the fun part is to do this filtering in such a way that it preserves the flavor of the original recording.

    John S.

  2. #12
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,656
    Please excuse my ignorance on DAC design and related digital filtering. While I do believe I understand the signal theory part and the way the DACs fundamentally work I don't know a lot about how digital filters in these things are actually implemented.

    Quote Originally Posted by JohnSwenson View Post
    The amplitude of the alias is determined by the "height" of the "stair step" in the signal.
    Which "stair step"????
    In the filter function?
    I mean... there are no "stair steps" in the sampled signal itself (unless you create artificial samples for oversampling which, of course, are not "stair steps" but simply potentially wrong samples creating harmonics....)

    I know... all those hifi mags and high-end manufacturers always show this stair-step graph over the sine wave but you and me know that's nonsense and that sine wave in that example can actually be perfectly reproduced from only two samples...

    Now, here's what I don't get:
    The filter adds steps in between the originals steps, because of the increased samples and the increased bit depth the height of the steps is much less, thus producing much lower amplitude aliases.
    But to do that, it needs to know _how_ to interpolate to get a "better" interpolation value.
    I mean.... in that nonsensical sine wave image from the hifi mags things look easy, but in real life the wavform looks something like this
    https://soundcloud.com/barbnerdy/let...cing-june-2013

    So if your first sample has a value of, say, "50", and the second one has a value of, say, "100", you have no way to say that "75" is a good interpolation value. The "correct" value might as well be "4096" or "0", unless you do a full spectral analysis over the resulting signal you just can't know whether "75" is any better than just duplicating "50" so a linear or logarithmic or whatever arithmetic interpolation will with all likelihood just as bad and the chances for it improving your signal are exactly the same as the chances for worsening it.
    On average, you just add the same amount of noise as with simple duplication.

    Unless, of course, your interpolation filter _does_ some sort of spectral analysis but then that's quite a task which is why I asked what exactly sox is doing to interpolate...

    The reason to do the digital filtering at all is that for 16/44.1 the stair steps are large
    But only due to oversampling, right?. I still don't get how that affects NOS DACs.

    I thought NOS DACs will have all the wrong excess signal beyond your cutoff frequency still in there and you need to use analog filters to get rid of it or rely on intermodulation filters in your power amp?

    Now let's look at what happens with the signal upsampled to 176.4, the aliases start at 88.2.
    Ah... OK, so the idea here is that instead of having an alias above your cutoff frequency you just get white or pink noise which can't intermodulate with your actual signal?

    The part I still don't understand is how the interpolation actually reduces the aliasing. Because if it doesn't, wouldn't you just get the same amount of aliasing in your upsampled signal as you would have in any oversampled signal?

    How does the interpolation filter do something else than the low-pass you would usually use for anti-aliasing and still be effective?

    Or does it just add more noise so that...
    Now the fun part is to do this filtering in such a way that it preserves the flavor of the original recording.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  3. #13
    Senior Member
    Join Date
    Mar 2007
    Location
    UK
    Posts
    1,302
    John, I agree with Pippin that it's best to avoid the term "stair steps" for digital audio as this is misleading. Each sample pertains to an instant ... between those instants is an analogue waveform that we are sampling or attempting to re-create.
    Darren
    Last edited by darrenyeats; 2013-07-08 at 03:52.
    Check it, add to it! http://www.dr.loudness-war.info/

    SB Touch

  4. #14
    Quote Originally Posted by darrenyeats View Post
    John, I agree with Pippin that it's best to avoid the term "stair steps" for digital audio as this is misleading. Each sample pertains to an instant ... between those instants is an analogue waveform that we are sampling or attempting to re-create.
    Darren
    But what are the "steps" undertaken in re-creating the waveform? Clue: it's not called a smoothing filter for nothing!

  5. #15
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,656
    Quote Originally Posted by flimflam View Post
    But what are the "steps" undertaken in re-creating the waveform? Clue: it's not called a smoothing filter for nothing!
    Yea. But that was my point. Unless you know exactly what your waveform is you are just as likely to AMPLIFY your noise than to SMOOTH your signal. To really be able to "smooth" you'd have to analyse the whole signal spectrum and you'd have to do that over some time - ideally the whole file(to know the dynamic range). But sox doesn't do that it just looks at a few samples. For the same reason DACs don't do it: it would introduce too much delay and require too much buffering and processing power.

    I mean... I can call everything a "smoothing" filter, I can also call lead "grey gold". What it actually does is another story, though.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  6. #16
    Senior Member
    Join Date
    Mar 2007
    Location
    UK
    Posts
    1,302
    Quote Originally Posted by flimflam View Post
    But what are the "steps" undertaken in re-creating the waveform? Clue: it's not called a smoothing filter for nothing!
    The samples define ALL of a complete and continuous analogue waveform of any complexity, as long as that waveform was band limited before it was sampled. You imply the smoothing is done using a best guess algorithm but there is no guesswork, only one analogue re-creation is a valid solution. In fact this equivalence is the essence of the sampling theorem.

    E.g. an original 20kHz sine wave will turn into around just two samples per cycle (!) yet the re-created wave will look just like the input (not the potential mess one might expect from a "smoothing algorithm"). The same goes for any waveform e.g. music no matter how complex, it can re-created as it was, whole. To repeat, though, this is true only for appropriately band limited waveforms.
    Darren



    Sent from my HTC Sensation Z710e using Tapatalk 4 Beta
    Last edited by darrenyeats; 2013-07-08 at 16:09.
    Check it, add to it! http://www.dr.loudness-war.info/

    SB Touch

  7. #17
    Quote Originally Posted by pippin View Post
    Yea. But that was my point. Unless you know exactly what your waveform is you are just as likely to AMPLIFY your noise than to SMOOTH your signal. To really be able to "smooth" you'd have to analyse the whole signal spectrum and you'd have to do that over some time - ideally the whole file(to know the dynamic range). But sox doesn't do that it just looks at a few samples. For the same reason DACs don't do it: it would introduce too much delay and require too much buffering and processing power.

    I mean... I can call everything a "smoothing" filter, I can also call lead "grey gold". What it actually does is another story, though.
    Hi Pippin

    You were asking about the algorithm used in digital interpolation filters for up/oversampling.

    I was talking about something else, the smoothing filter (aka reconstruction, anti-imaging filter). This was in relation to your and Darren's objection to the term stair steps. In practice, a DAC does not attempt to recreate voltage impulses, instead it uses a zero-order hold process - i.e. it does in fact output stair stepped voltages. The end results is much the same, with quantisation error and infinite Nyquist images, but with a deterministic roll-off. The smoothing filter is then the low-pass filter 'at' Nyquist - which if (and all stages of sampling) ideal, would perfectly recreate the sampled function.

  8. #18
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,656
    OK, but that's not "smoothing", that's just low-pass filtering, which ideally removes ALL effects of the "stair-steps".

    However, here we are not talking about analog processing BEHIND the DAC, we talk about digital processing BEFORE the DAC.
    And here "smoothing" is not simple and any kind of arithmetic "interpolation" doesn't necessarily have to create a "better" reproduction but instead - just as likely - can create a worse one.

    Look at these images (note: this is all simplified for illustration purposes, in reality we have an infinite waveform length and MUCH more complex waveforms; and it's not the waveform itself that matters but it's fourier transformation):
    Name:  waveform1.jpg
Views: 1014
Size:  3.9 KB
    Here, for a low sampling frequency, e.g. 44.1 kHz, there are two samples A and B which - just looking at these two samples, might result in a waveform as the one shown.
    Now if you go to a higher sampling frequency, the usual process of oversampling would just duplicate the samples A and B resulting in A' and B'. A resulting waveform then might be as shown in the second image which looks much worse.
    So one might be tempted do calculate some "intermediate" values A" and B" and hope that the result might more closely match.

    Now here's the problem: unless you've looked at the whole signal (which you can't do due to time and processing requirements), you don't know whether the first waveform given above is correct, it could just as well be one like this:

    Name:  waveform2.jpg
Views: 1016
Size:  4.2 KB

    What you see here is that now your "intermediate" steps A" and B" are a much worse match for the original waveform than A' and B' - you get more noise.

    Now, what might come as a surprise is that all of this does NOT matter at all as long as in the end you filter at your cutoff frequency again. The reason for this is that all the noise and distortion added above actually happens in higher frequency ranges, it's only in harmonics to the original waveform. Since these higher frequencies are inaudible (as in: definitely, completely, undisputedly inaudible; not even a bat will hear them), you can filter them and the result of this is, again, the perfect copy of the first waveform. For BOTH of the right-hand side curves. Actually this would still hold if you throw in random samples in place of A', A", B' and B".

    This is what you do with oversampling. The reason for this is that the filters you use to do this are not perfect. They will either distort your audible signal or not perfectly filter out the higher frequencies but they get better the higher the sampling frequencies you use are. So you accept the added noise due to oversampling because the end result will still be less distorted due to simpler and better filters.

    Now what John is talking about is something else. The problem with these images above is that while the anaolg low-pass filter behind the DAC can perfectly reproduce the signal, the same unfortunately is NOT true of the DAC itself. The DAC itself is a filter, too, and depending on the waveforms above those higher frequencies CAN actually have an impact on the way the DAC reproduces you AUDIBLE signal (imaging).
    To avoid this, you usually try to filter your signal even BEFORE it reaches the DAC to avoid having your artifacts distort your signal.
    These are the filters John and I are talking about. And the question it all boils down to is: what makes the filter in sox better than the ones in the DAC? Sox is a very simple interpolation software so if it can do better: why don't the DAC makers just do the same thing?
    Last edited by pippin; 2013-07-08 at 16:53.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  9. #19
    Quote Originally Posted by pippin View Post
    OK, but that's not "smoothing", that's just low-pass filtering
    Same thing! Smoothing filter is a specific and recognised term for this filter - whether you like it or not :-) ! The term is used by many, Analog Devices refer to it by this name a lot. That the stair steps are smoothed seems obvious, the term does not mean to imply anything else.

    Quote Originally Posted by pippin View Post
    However, here we are not talking about analog processing BEHIND the DAC, we talk about digital processing BEFORE the DAC.
    The latter is all about the former though, of course! It is the raison d'etre, as you say yourself, behind oversampling. John was explaining this in relation to stair steps of the ZOH but you did not seem to understand and asked what stair steps, I was trying to explain, that's all.

    Quote Originally Posted by pippin View Post
    These are the filters John and I are talking about. And the question it all boils down to is: what makes the filter in sox better than the ones in the DAC?
    I agree 100% with you. I would avoid external resampling, and deliver bit-perfect to the DAC, preferring to let the extremely capable designers at Analog, Cirrus Logic, TI, Wolfson etc do their job. If a DAC/ADC loop cannot be distinguished from the original, it says a lot I think. That's my opinion, it's not a very positive contribution to the thread and its undoubtedly hard work, so I didn't say it loud before.

  10. #20
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,656
    Quote Originally Posted by flimflam View Post
    Same thing! Smoothing filter is a specific and recognised term for this filter - whether you like it or not :-) ! The term is used by many, Analog Devices refer to it by this name a lot. That the stair steps are smoothed seems obvious, the term does not mean to imply anything else.
    OK, may be. I learned all my signal theory in German so terminology might not be my strong point here.

    But it's still something different from the interpolation filter we were talking about above.
    The latter is all about the former though, of course! It is the raison d'etre, as you say yourself, behind oversampling. John was explaining this in relation to stair steps of the ZOH but you did not seem to understand and asked what stair steps, I was trying to explain, that's all.
    Um. Sorry. Again, I fail to see it.
    Again: Why does interpolation filtering on the digital side improve the analog filtering and how is the interpolation even correlated to your desired filter response.

    I can find a lot of prosa about this on the internet, mainly by makers of such filters, but I haven't found a single explanation that makes sense. All I find is stuff like this:
    http://www.ni.com/white-paper/5515/en/
    Which - sorry - is nonsense (the digital interpolation part. The analog and imaging explanations are OK). I mean: it's not if your goal is to reproduce ideal sine waves generated by a signal generator as shown in the example, fine. But to do that you'd not have to take such an effort, perfectly reproducing sine waves from a few samples is the easiest thing you could ever do in signal processing.

    For a real world signal like music I fail to see how an interpolation filter will be effective and valid because - unlike in these sine wave examples - you do NOT know the exact waveform. The only reason the "interpolation filter" in that example is effective is because whoever drew that diagram did EXACTLY know the parameters of the sine wave PLUS, these parameters didn't change at all over the duration of the signal. Under these circumstances it's of course easy to fill in the added samples with perfectly fitting interpolations hence not creating any harmonics. However, that's NOT what you have in real life, ESPECIALLY not with a software like sox that can only look at a few samples at a time (you COULD theoretically do this right when you did an analysis of the whole audio file but we are talking about a LOT of digital signal processing here).

    I mean: I can be wrong here and there is some magic sox pulls off that does this right and I just didn't understand it. That's why I'm asking: I'm trying to understand this.

    I agree 100% with you. I would avoid external resampling, and deliver bit-perfect to the DAC, preferring to let the extremely capable designers at Analog, Cirrus Logic, TI, Wolfson etc do their job. If a DAC/ADC loop cannot be distinguished from the original, it says a lot I think. That's my opinion, it's not a very positive contribution to the thread and its undoubtedly hard work, so I didn't say it loud before.
    Now... THAT's a statement I understand
    Last edited by pippin; 2013-07-08 at 18:24.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •