Sample rate conversion 
Sample rate conversion 
Apr 11 2011, 18:50
Post
#1


Group: Members Posts: 8 Joined: 18July 07 Member No.: 45403 
Hello everyone.
I have a question regarding sample rate conversion algorightms. I don't know how they work, but I guess you guys are more familiar with this Let's say I have a 48 kHz wave file that I want to use in something I have to mix with some 96 kHz material at certain places. This requires the 48 kHz file be resampled and in the end back to 48. So in short: does resampling 48 > 96 > 48 change the original or can the original be restored 100% ? I'm using Wavelab for this. 


Apr 12 2011, 20:09
Post
#2


Group: Members (Donating) Posts: 1985 Joined: 4January 04 From: Austin, TX Member No.: 10933 
If you are just mixing, then you ought to be able to get the same results (to within 144db or better) by resampling the 96k content down to 48k, and mixing at 48k. The reason is that mixing is a purely linear operation.
48k>96k, being a 2x oversample, is among the most numerically conservative resampling possibilities. If the resampler is correctly implemented, 50% of all the samples should be numerically exact, with zero quantization error. 


Apr 13 2011, 15:21
Post
#3


ReplayGain developer Group: Developer Posts: 5656 Joined: 5November 01 From: Yorkshire, UK Member No.: 409 
If the resampler is correctly implemented, 50% of all the samples should be numerically exact, with zero quantization error. That's an interesting use of the word "correctly"  a 2x resampler can easily be (and often is) perfect in terms of frequency and phase response, while giving 100% "new" samples.You can easily design it to do as you suggest, but that's not necessarily the way all are designed. Cheers, David. 


Apr 13 2011, 22:43
Post
#4


Group: Members (Donating) Posts: 1985 Joined: 4January 04 From: Austin, TX Member No.: 10933 
That's an interesting use of the word "correctly"  a 2x resampler can easily be (and often is) perfect in terms of frequency and phase response, while giving 100% "new" samples. You can easily design it to do as you suggest, but that's not necessarily the way all are designed. Feh. Yes, you are correct. Thanks for the catch. I think that if I restrict my statement to the domain of windowed sinc filters, it's accurate. But any filter possessing an asymmetric response around the 6db point at Fs/2 is categorically not in that domain. While asymmetric filters are 2x more complex to implement, obviously they exist, particularly in software implementations where the symmetric optimization may not get performed. (offhand, I can't recall any specific instance of such a filter, but I am quite sure they exist.) ... Right? This post has been edited by Axon: Apr 13 2011, 22:48 


Apr 14 2011, 00:03
Post
#5


Group: Super Moderator Posts: 3405 Joined: 26July 02 From: To: Member No.: 2796 
I think that if I restrict my statement to the domain of windowed sinc filters, it's accurate. But any filter possessing an asymmetric response around the 6db point at Fs/2 is categorically not in that domain. I have a question that's marginally offtopic, but this post triggered all my keyword detectors. Windowed sinc is symmetric. What would similar functions be in the asymmetric case? The symmetric, acausal nature of sinc has always bugged me, but I've never found a reference containing asymmetric, causal analogues that I could use in SRC contexts. 1. Attack the argument, not the arguer.
2. Assume good faith. 


Apr 14 2011, 03:26
Post
#6


Group: Members (Donating) Posts: 1985 Joined: 4January 04 From: Austin, TX Member No.: 10933 
I think that if I restrict my statement to the domain of windowed sinc filters, it's accurate. But any filter possessing an asymmetric response around the 6db point at Fs/2 is categorically not in that domain. I have a question that's marginally offtopic, but this post triggered all my keyword detectors. Windowed sinc is symmetric. What would similar functions be in the asymmetric case? The symmetric, acausal nature of sinc has always bugged me, but I've never found a reference containing asymmetric, causal analogues that I could use in SRC contexts.Yeah, you better split this mofo right now before the OP's head explodes. I was using the term "windowed sinc" previously with the implicit assumption that the sinc function is critically sampled, ie, with lowpass frequency F_{s}/2. If it's not that  more specifically, if it's both lower than, and relatively prime to, F_{s}/2  then you'll get your asymmetric response, and you'll also get every sample modified. That's the simplest example I can think of. Lemme do a bit of armchair mathematical derivation to outline what I'm riffing from. I'm going to wave my hands *really* widely here, so I apologize in advanced for abuses of notation, convention, or for that matter, logic. For starters, I'll write this assuming a normalized, ordinaryfrequency Fourier transform, but using the variable omega (w) instead of xi. I am also assuming F_{s}=1, and I write F_{s}/2 largely as a more easily identifiable representation of the frequency "1/2". The basic principle here is the interpolating filter, ie, one which can be used when interpolating between sampled data values: for interpolating kernel k(t) convolved with a discretetime signal with sampling period 1, k(0)=1 and k(N)=0 for nonzero integer N. The sinc function is the "simplest" analytic function satisfying this requirement. I base this statement from the following identity: (This is a nice time to ask: Can an admin please add MathJax support to the site? ) The inner term there, (1x^{2}/n^{2}), can be rewritten as (n^{2})(n+x)(nx). That (n^{2}) is just a constant which can be ignored, so what we're left with is a function which could be notionally defined as a polynomial with a zero at every nonzero integer. That's precisely what is necessary for an interpolating kernel. This implies, at least the way I see it currently, that any interpolating function can be written in the form k(t) = h(t) sinc(t), as long as h(0)=1, and h(t) is defined across the support of k(t). Furthermore, the windowed (timelimited) interpolation functions can be written h(t) = g(t/a) rect(t/a), where "a" controls the window width and g(t) is the basic window function evaluated over [1/2, 1/2]. So a Hannwindowed sinc kernel is going to be something like g(t) = (1+cos(pi t))/2. The statement k(t) = h(t) sinc(t) in the time domain is equivalent to K(w) = H(w) * rect(w) in the frequency domain. If we assert:
... then, around w=+1/2, we can approximate rect(w) ~~ 1  u(w1/2) (and similarly for w=1/2). From this  and I apologize again if I'm skipping way too many steps here  by looking at the bare convolution integrals, it's fairly easy to see that K(1/2)=(1/2) K(0). For a normalized filter response, ie K(0)=0db, then K(1/2)=6db. In summary, when performing integral upsampling with a lowpass filter, the kernel k(t) is interpolating (preserves the value of the original samples) if and only if: *either*



LoFi Version  Time is now: 13th October 2015  23:20 