HydrogenAudio

Hydrogenaudio Forum => Scientific Discussion => Topic started by: MannyCalavera on 2011-04-11 18:50:09

Title: Sample rate conversion
Post by: MannyCalavera on 2011-04-11 18:50:09
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.
Title: Sample rate conversion
Post by: saratoga on 2011-04-11 18:58:15
So in short: does resampling 48 --> 96 --> 48 change the original or can the original
be restored 100% ?


Theres going to be some rounding error.  Its probably better to just do everything at 48k.  That said, with a very good resampler, there will be no meaningful difference.  I have no idea if wavelab is any good, although this page suggests that at least one of the wavlab 6 resamplers is pretty good:

http://src.infinitewave.ca/ (http://src.infinitewave.ca/)
Title: Sample rate conversion
Post by: Arnold B. Krueger on 2011-04-12 14:29:58
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.


Can't you just stash a copy of the 48k origional some place out of the way?
Title: Sample rate conversion
Post by: Axon on 2011-04-12 20:09:57
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.
Title: Sample rate conversion
Post by: 2Bdecided on 2011-04-13 15:21:27
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.
Title: Sample rate conversion
Post by: Wombat on 2011-04-13 16:05:23
You can easily design it to do as you suggest, but that's not necessarily the way all are designed.


Afaik all resamplers apply another lowpass on upsampling, be it 2x or some strange number from 44.1 to 96kHz. So when this lowpass is applied all relation to a pattern in the source is gone. Otherwise we´ll have an aliased, mirror above the sources max frequency. Isn´t it? And if not, what software does that creation of added 0s correctly?
Title: Sample rate conversion
Post by: bandpass on 2011-04-13 20:25:25
Given 10 seconds of 440Hz tone and upsampling from 48k to 96k, sox preserves the input samples in the output for all but the first and last 40-or-so samples. Of course, the test becomes more 'difficult' if the bit-depth or the tone frequency is increased.

Code: [Select]
sox -b 16 -n 1.wav synth 10
sox -D 1.wav 2.wav rate 96k
sox -c 2 -r 48k 2.wav 3.wav remix 1
cmp -l 1.wav 3.wav | wc -l

Title: Sample rate conversion
Post by: Wombat on 2011-04-13 20:47:21
Given 10 seconds of 440Hz tone and upsampling from 48k to 96k, sox preserves the input samples in the output for all but the first and last 40-or-so samples. Of course, the test becomes more 'difficult' if the bit-depth or the tone frequency is increased.

Code: [Select]
sox -b 16 -n 1.wav synth 10
sox -D 1.wav 2.wav rate 96k
sox -c 2 -r 48k 2.wav 3.wav remix 1
cmp -l 1.wav 3.wav | wc -l


This must be lowpassed already even if i don´t know what -D does. You may have a look what sox does without lowpass.
http://www.hydrogenaudio.org/forums/index....st&p=675545 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=67376&view=findpost&p=675545)

The resulting 2.wav looks lowpassed at 22-25kHz. Isn´t it?
(http://img685.imageshack.us/img685/45/43201522.gif) (http://img685.imageshack.us/i/43201522.gif/)

Title: Sample rate conversion
Post by: bandpass on 2011-04-13 21:19:59
Quote
This must be lowpassed already even if i don´t know what -D does.
-D is to disable dithering (which would otherwise mess up the test).  The only filter involved is that of the resampler (in the second line), applied after zero stuffing, a lowpass at just below the original nyquist (i.e. the standard method).

Quote
You may have a look what sox does without lowpass.

In fact, that shows a different resampler; with sox the resampling filter is not optional.
Title: Sample rate conversion
Post by: Axon on 2011-04-13 22:43:55
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?
Title: Sample rate conversion
Post by: ExUser on 2011-04-14 00:03:16
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 off-topic, 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.
Title: Sample rate conversion
Post by: Wombat on 2011-04-14 00:44:12
I admit i have no clue about some things you talk but to summarize my findings i still don´t see anyone convincing me there is upsampling without lowpassing, so changing EVERY single musical bit in the process.

On http://en.wikipedia.org/wiki/Upsampling (http://en.wikipedia.org/wiki/Upsampling) they talk about the 2 ways of implementing
1. Add zeros between each sample -> to my understanding all resamplers do
2. Filter with a low-pass filter which, theoretically, should be the sinc filter -> that no resampler does because, also from Wikipedia:

"The second step calls for the use of a perfect low-pass filter, which is not implementable"
Title: Sample rate conversion
Post by: ExUser on 2011-04-14 00:52:47
I admit i have no clue about some things you talk but to summarize my findings i still don´t see anyone convincing me there is upsampling without lowpassing, so changing EVERY single musical bit in the process.
Sample-and-hold, ie. "nearest neighbour", ie. out[2*x]=in
Title: Sample rate conversion
Post by: Wombat on 2011-04-14 00:58:05
Sample-and-hold, ie. "nearest neighbour", ie. out[2*x]=in
  • ;out[2*x+1]=in
  • is trivial upsampling without lowpassing, though it's gonna generate a lot of high-frequency aliasing. Solution? Low-pass the aliasing out.

Exactly, that aliasing i mentioend in post 6 above. We are running in circles
Title: Sample rate conversion
Post by: saratoga on 2011-04-14 01:03:10
I admit i have no clue about some things you talk but to summarize my findings i still don´t see anyone convincing me there is upsampling without lowpassing, so changing EVERY single musical bit in the process.

On http://en.wikipedia.org/wiki/Upsampling (http://en.wikipedia.org/wiki/Upsampling) they talk about the 2 ways of implementing
1. Add zeros between each sample -> to my understanding all resamplers do
2. Filter with a low-pass filter which, theoretically, should be the sinc filter -> that no resampler does because, also from Wikipedia:

"The second step calls for the use of a perfect low-pass filter, which is not implementable"


Although you can never make a perfect sinc filter, its possible to build ones very very close to perfect, such that any difference is below quantization noise except for a tiny region right around the Nyquist limit, which of course won't include audio anyway because of the anti-alias filter on the original recording ADC.
Title: Sample rate conversion
Post by: ExUser on 2011-04-14 01:03:28
Exactly, that aliasing i mentioend in post 6 above. We are running in circles
Then what you're looking for is sinc interpolation.

Edit: saratoga beat me, and was more informative to boot.
Title: Sample rate conversion
Post by: Wombat on 2011-04-14 01:11:03
Although you can never make a perfect sinc filter, its possible to build ones very very close to perfect, such that any difference is below quantization noise except for a tiny region right around the Nyquist limit, which of course won't include audio anyway because of the anti-alias filter on the original recording ADC.


I am pretty sure we can get close but from reading some earlier posts in this thread it is suggested that 2x upsampling will leave the source material intact which it is not. One can argue about such ultra-close filters have huge amounts of pre-ringing btw.
It is not a lossless operation.
I see it in the context of some audiophile claims about upsampling 2x from 44.1 to 88.2 for example sounds better as to 96kHz cause of only applying zeros on every second bit, but it isn´t.
Title: Sample rate conversion
Post by: saratoga on 2011-04-14 01:17:14
Although you can never make a perfect sinc filter, its possible to build ones very very close to perfect, such that any difference is below quantization noise except for a tiny region right around the Nyquist limit, which of course won't include audio anyway because of the anti-alias filter on the original recording ADC.


I am pretty sure we can get close but from reading some earlier posts in this thread it is suggested that 2x upsampling will leave the source material intact which it is not.


Obviously if the filter does not have unity transmittance at every frequency, then at least some samples cannot be the same . . .
Title: Sample rate conversion
Post by: Axon on 2011-04-14 03:26:45
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 off-topic, 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 Fs/2. If it's not that -- more specifically, if it's both lower than, and relatively prime to, Fs/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, ordinary-frequency Fourier transform, but using the variable omega (w) instead of xi. I am also assuming Fs=1, and I write Fs/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 discrete-time 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 (https://secure.wikimedia.org/wikipedia/en/wiki/Sinc):

  )

The inner term there, (1-x2/n2), can be rewritten as (n-2)(n+x)(n-x). 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 (time-limited) 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 Hann-windowed 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(w-1/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*
*or* the Fourier transform of the kernel can be written K(w) = H(w) * rect(w), for H(w) even; more specifically,
Title: Sample rate conversion
Post by: bandpass on 2011-04-14 07:30:36
Obviously if the filter does not have unity transmittance at every frequency, then at least some samples cannot be the same . . .

Indeed, with 2× resampling, if the input signal frequency stays below the filter transition, half of the output samples (weird/asymmetric filters notwithstanding) will be the same as the input samples (as observed at the chosen bit depth).  With sox, 16-bit, 48kHz ->96kHz, the odd-numbered output samples are bit-exact up to 22kHz; at 23kHz, the roll-off kicks in and the samples are no longer the same.  At 24-bit, it's bit-exact to 16k; at 17k, attenuation of 0.0001dB is evident in the output.
Title: Sample rate conversion
Post by: Axon on 2011-04-14 19:38:28
Obviously if the filter does not have unity transmittance at every frequency, then at least some samples cannot be the same . . .

Indeed, with 2× resampling, if the input signal frequency stays below the filter transition, half of the output samples (weird/asymmetric filters notwithstanding) will be the same as the input samples (as observed at the chosen bit depth).  With sox, 16-bit, 48kHz ->96kHz, the odd-numbered output samples are bit-exact up to 22kHz; at 23kHz, the roll-off kicks in and the samples are no longer the same.  At 24-bit, it's bit-exact to 16k; at 17k, attenuation of 0.0001dB is evident in the output.

Strictly speaking, it is not very meaningful to describe the flatness of a frequency response as "bit-exact".
Title: Sample rate conversion
Post by: bandpass on 2011-04-14 20:24:23
Strictly speaking, it is not very meaningful to describe the flatness of a frequency response as "bit-exact".

Just as well that's not what we're describing then! We're describing when, after 2× band-limited interpolation, alternate output samples are exactly the same as the input samples. Practical examples were given of when this indeed the case and also when it's not.
Title: Sample rate conversion
Post by: Wombat on 2011-04-14 20:46:00
after 2× band-limited interpolation, alternate output samples are exactly the same as the input samples.

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

Edit: Added pic of source 48k and upsampled. How can any sample be intact?

(http://img215.imageshack.us/img215/4609/up2a.gif) (http://img215.imageshack.us/i/up2a.gif/)

Title: Sample rate conversion
Post by: Alexey Lukin on 2011-04-14 21:35:12
48 -> 96 kHz conversion may leave signal samples intact, but also may change them.
The condition for leaving samples intact is the use of a half-band low-pass filter, i.e. the filter of the form x1 0 x2 0 x3 0 .... 0 xn. Half-band filters can be designed with a windowed sinc method to easily achieve the required frequency response. However many SRC algorithms are using other designs (not half-band).
Title: Sample rate conversion
Post by: Wombat on 2011-04-14 21:49:46
48 -> 96 kHz conversion may leave signal samples intact, but also may change them.
The condition for leaving samples intact is the use of a half-band low-pass filter, i.e. the filter of the form x1 0 x2 0 x3 0 .... 0 xn. Half-band filters can be designed with a windowed sinc method to easily achieve the required frequency response. However many SRC algorithms are using other designs (not half-band).

Half-Band filters, ok... May you give me the answer to the sample above and how sox does here. Is there any sample intact? And how to tell?
Title: Sample rate conversion
Post by: bandpass on 2011-04-14 22:16:53
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

Because (by definition) the lowpass doesn't affect frequencies below its cutoff frequency; if all the frequencies in the input signal are below the cutoff frequency, and the filter is implemented in a 'perfect' way, then the signal is unaffected.  E.g. an input signal comprising a sine wave swept from 0-22kHz has no frequency component at or above the cutoff (~23kHz), so is unaffected.

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).

Quote
Is there any sample intact? And how to tell?


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).
Title: Sample rate conversion
Post by: Alexey Lukin on 2011-04-14 22:26:52
Because (by definition) the lowpass doesn't affect frequencies below its cutoff frequency;

It does! — by definition of the cutoff frequency (-3 dB point).

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).

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).
Title: Sample rate conversion
Post by: Wombat on 2011-04-14 22:27:15
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).

Interesting. 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.
Title: Sample rate conversion
Post by: Wombat on 2011-04-14 22:49:00
I am getting slowly mad in here or lowpass myself

So many real experts and no simple words for an average human being like me.
May we take a snapshot and can someone please answer me 4 questions?

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?

To my understanding atm it is No-No-Yes-No
Title: Sample rate conversion
Post by: bandpass on 2011-04-15 07:18:56
Because (by definition) the lowpass doesn't affect frequencies below its cutoff frequency;

It does! — by definition of the cutoff frequency (-3 dB point).

Yes, but not by much  (And of course, with sinc filters, it's usual to use the -6dB point but I was trying to simplify for Wombat's benefit)

Quote
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).

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).

In fact, I  checked 3 resamplers: sox, ssrc, & sndfile-resample. Allowing for the fact the ssrc prepends a couple of spurious samples and sndfile-resample truncates by one sample, all 3 did pretty well on the test: alternate output samples were the same as the input samples (tested at bit-depth 16, input: a 440Hz tone).

According to its design, SoX does not use a half-band filter. Checks on its output (including those at http://src.infinitewave.ca) (http://src.infinitewave.ca)) confirm this as they show no imaging (a characteristic of half-band filters).

So this is more by accident here because we have a 440Hz tone that has no content near the lowpass.

No accident, it was part of the test design.  The test also included tones up to 22kHz and a sweep from 0 to 22kHz—these all passed. A tone of 23kHz did not pass but no real surprises here. (These other tests were performed only on SoX)

Quote
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.

The filter is always applied to every sample regardless of the input signal content and sampling rate.  However, if resampling to 88.2, there are very few samples in the output that one might expect (or, in general, care) not to have changed (and I haven't tested this case).

With 'normal' music, it is likely that the test would not pass. One situation where it might would be if the music had started life at 96k, and been downsampled to 48k using a filter with a lower cutoff used when subsequently upsampling.
Quote
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.

Hopefully covered above and previously.
Title: Sample rate conversion
Post by: bandpass on 2011-04-15 10:39:33
Okay, curiousity got the better of me: in the 48k --> 88.2k example below, every 80th sample of the input matches every 147th sample of the output.

Code: [Select]
sox -b 16 -n 1.wav synth 10 sin 0:12k
sox -D 1.wav 2.wav rate 88.2k
sox -c 80 -r 600 1.wav 1a.wav remix 1
sox -c 147 -r 600 2.wav 2a.wav remix 1
cmp -l 1a.wav 2a.wav


1. Is sox a resampler that upsamples with leaving samples intact when upsampling from 48k to 96k
Depending on 3 things: the input signal bandwidth, the selected filter characteristics, and the selected bit-depth, sometimes yes, sometimes no.

Not checked, but I suspect that if you select -q (cubic interpolation) then the answer is always yes (but the interpolated samples will be much noisier than with band-limited interpolation).

Quote
2. If it isn´t, is there one you are aware of.
See previous post for a brief mention of some other resamplers.

Quote
3. Is the reasoning that all apply a lowpass on upsampling and so change EVERY single sample correct?
No, every sample is processed by the filter but not necessarily changed by it.

Quote
4. Does it play a role at all then to upsample with an even or uneven number?
Not especially, as demonstrated by the 88.2 example above.

Just to bring things back into perspective a little, whilst output samples being the same as input samples might indicate that a certain care has been taken in the implementation, the converse is not necessarily true, and that resampler performance for a given application is generally measured in other terms, see e.g. the graphs and discussion at http://src.infinitewave.ca (http://src.infinitewave.ca)
Title: Sample rate conversion
Post by: Wombat on 2011-04-15 16:24:20
Many thanks bandpass for your efforts. Very interesting explanations and simple held for me to understand
Lets hope all your assumptions are true but to me it all makes perfect sense!
Title: Sample rate conversion
Post by: Alexey Lukin on 2011-04-15 17:10:25
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%.
Title: Sample rate conversion
Post by: Wombat on 2011-04-15 18:11:27
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%.


Now what!? That is what i say from the beginning and bandpass always tells me that with a sample that has no HF content near the cutooff there are untouched samples in the output.
Title: Sample rate conversion
Post by: bandpass on 2011-04-15 22:17:08
All I have told you is what I have observed through simple experimentation, and since the experiments involved nothing more than running sox a few times and a file comparison program, you can repeat them and draw your own conclusions.

One final experiment.

Create an input signal:
Code: [Select]
sox -b 16 -n 1.wav synth noise gain -4 sinc -22k fade h .01 1 .01

(which looks like this:)
(http://i51.tinypic.com/21lpbmx.png)

Upsample:
Code: [Select]
sox -D 1.wav 2.wav rate 96k

Dump the input and output files to text:
Code: [Select]
sox 1.wav -t dat 1.txt
sox 2.wav -t dat 2.txt

and check them in a text editor, or, use a graphical diff program:
(http://i53.tinypic.com/2dubbqe.png)
(1st column is time, 2nd column is sample value)

For good measure, here are the freq. responses of the filter used in the input signal generation (blue, obtained via sox's --plot option) and the resampling filter (red, obtained via resampling an impulse) which, as can be seen, is not a half-band response:
(http://i56.tinypic.com/zjytko.png)
Title: Sample rate conversion
Post by: Alexey Lukin on 2011-04-16 06:27:39
This is only due to the fact that you used the sinc filter during signal generation. Real music is not like that and its sample values will change.
Title: Sample rate conversion
Post by: bandpass on 2011-04-16 08:41:44
This is only due to the fact that you used the sinc filter during signal generation.

Not only that—at the risk of repeating myself:
1. Is sox a resampler that upsamples with leaving samples intact when upsampling from 48k to 96k

Depending on 3 things: the input signal bandwidth, the selected filter characteristics, and the selected bit-depth, sometimes yes, sometimes no.

Quote
Real music is not like that and its sample values will change.

Not necessarily so. It's not a question of whether the music is real or not, it's whether the recording/mastering/etc. has left any headroom in the frequency domain. For example, MP3 usually lowpasses at 16k and some commercially produced music CDs can also be seen to roll-off well before the nyquist.
Title: Sample rate conversion
Post by: Alexey Lukin on 2011-04-16 08:45:27
Agreed.