I still don´t get how any sample can be exactly the same when a lowpass is applied to it in the output!? I hope i only need a small hint
Is there any sample intact? And how to tell?
Because (by definition) the lowpass doesn't affect frequencies below its cutoff frequency;
Whilst half-band filters may leave samples unaffected, other FIRs may too—sox's filter is not half-band (a half-band upsampling filter always has some imaging remaining).
Using the 'code' I provided above; it uses a little trick to throw away the interpolated samples from the 96k file thus rendering it back to a 48k file (without filtering, but that's okay in this instance), which is then file-compared to the original. The files are identical barring a few samples at the beginning and end (which are the result of filtering discontinuties).
Quote from: bandpass on 14 April, 2011, 05:16:53 PMBecause (by definition) the lowpass doesn't affect frequencies below its cutoff frequency;It does! — by definition of the cutoff frequency (-3 dB point).
Quote from: bandpass on 14 April, 2011, 05:16:53 PMWhilst half-band filters may leave samples unaffected, other FIRs may too—sox's filter is not half-band (a half-band upsampling filter always has some imaging remaining).For other filters it's highly unlikely that they will preserve the original samples (which is not a flaw).However SoX may well be the half-band filter (unless ordered a shifted cutoff frequency).
So this is more by accident here because we have a 440Hz tone that has no content near the lowpass.
On normal music i suppose sox does have to apply it to almost every sample. Will this be the same in this special case when we use a uneven resample to lets say 88.2? I doubt. So all these claims about a resampler is more precise in upsampling by even numbers has some evidence.
Edit: Lol, just read Mr. Lukins answer... So how does it come your trick to throw away the interpolated samples show the original samples!? Does sox use Half-Band. From the frequency plot i doubt this.
sox -b 16 -n 1.wav synth 10 sin 0:12ksox -D 1.wav 2.wav rate 88.2ksox -c 80 -r 600 1.wav 1a.wav remix 1sox -c 147 -r 600 2.wav 2a.wav remix 1cmp -l 1a.wav 2a.wav
1. Is sox a resampler that upsamples with leaving samples intact when upsampling from 48k to 96k
2. If it isn´t, is there one you are aware of.
3. Is the reasoning that all apply a lowpass on upsampling and so change EVERY single sample correct?
4. Does it play a role at all then to upsample with an even or uneven number?
I've just verified that SoX never preserves the values of original samples because its bandwidth (-b) parameter cannot be set to 100%, it's limited between 74 and 99.7%.
sox -b 16 -n 1.wav synth noise gain -4 sinc -22k fade h .01 1 .01
sox -D 1.wav 2.wav rate 96k
sox 1.wav -t dat 1.txtsox 2.wav -t dat 2.txt
This is only due to the fact that you used the sinc filter during signal generation.
Quote from: Wombat on 14 April, 2011, 05:49:00 PM1. Is sox a resampler that upsamples with leaving samples intact when upsampling from 48k to 96kDepending on 3 things: the input signal bandwidth, the selected filter characteristics, and the selected bit-depth, sometimes yes, sometimes no.
Real music is not like that and its sample values will change.