# Sampling rate conversion

Started by February 10, 2009
Hi All

I have a carrier modulated signal which is sampled at 48KHz and 12
samples/symbol.

Now, I want to resample this signal, so that the new signal has sampling
rate of 47968 Hz.

Is there any possible way of doing it.?

I totally new to this multirate dsp topic.

Thanks.

Chintan

On Feb 10, 2:50&#2013266080;pm, "cpshah99" <cpsha...@rediffmail.com> wrote:
> Hi All > > I have a carrier modulated signal which is sampled at 48KHz and 12 > samples/symbol. > > Now, I want to resample this signal, so that the new signal has sampling > rate of 47968 Hz. > > Is there any possible way of doing it.? > > I totally new to this multirate dsp topic. > > Your opinion matters a lot. > > Thanks. > > Chintan
This is possible. You can use a concatenation of fixed interpolation and fixed decimation, or you can use a cubic Farrow structure. What platfom is it? What is the carrier frequency? John
On Feb 10, 2:50&#2013266080;pm, "cpshah99" <cpsha...@rediffmail.com> wrote:
> Hi All > > I have a carrier modulated signal which is sampled at 48KHz and 12 > samples/symbol. > > Now, I want to resample this signal, so that the new signal has sampling > rate of 47968 Hz. > > Is there any possible way of doing it.? > > I totally new to this multirate dsp topic.
how familiar are you to the Nyquist/Shannon sampling (and reconstruction) theorem? consider what that says to how to reconstruct your uniformly sampled signal back to a continuous-time signal. then sample that at your new sample rate. now imagine doing this math hypothetically rather than in reality with an ideal D/A, ideal anti-imaging filter, and ideal A/D. just do the math of what those devices would do directly.
> Your opinion matters a lot.
even though it's 3 months after the election, i keep getting spam from barackobama.com that says the same thing. somehow i doubt that the prez is reading my opinions. r b-j
robert bristow-johnson wrote:
> On Feb 10, 2:50 pm, "cpshah99" <cpsha...@rediffmail.com> wrote: >> Hi All >> >> I have a carrier modulated signal which is sampled at 48KHz and 12 >> samples/symbol. >> >> Now, I want to resample this signal, so that the new signal has sampling >> rate of 47968 Hz. >> >> Is there any possible way of doing it.? >> >> I totally new to this multirate dsp topic. > > how familiar are you to the Nyquist/Shannon sampling (and > reconstruction) theorem? consider what that says to how to > reconstruct your uniformly sampled signal back to a continuous-time > signal. then sample that at your new sample rate. now imagine doing > this math hypothetically rather than in reality with an ideal D/A, > ideal anti-imaging filter, and ideal A/D. just do the math of what > those devices would do directly. > > >> Your opinion matters a lot. > > even though it's 3 months after the election, i keep getting spam from > barackobama.com that says the same thing. somehow i doubt that the > prez is reading my opinions.
Most unlikely, but I'll hazard the guess that someone on his staff tracking the responses. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
Hi

thanks a lot for ur reply.

I have done something using linear interpolation but then I should get
some kind of compression of the signal, but I am not getting that.

Now, my o/p sampling rate is 47968 Hz. so what i did was generate the
signal at 96 KHz and do linear interpolation. but then there is no
compression. The carrier is 12kHz.

>even though it's 3 months after the election, i keep getting spam from >barackobama.com that says the same thing. somehow i doubt that the >prez is reading my opinions. > >r b-j >
He might be reading ur opinions, but may be he is not trying to implement them. Thanks again Chintan
On Feb 10, 4:08&#2013266080;pm, Jerry Avins <j...@ieee.org> wrote:
> robert bristow-johnson wrote: > > On Feb 10, 2:50 pm, "cpshah99" <cpsha...@rediffmail.com> wrote: > >> Hi All > > >> I have a carrier modulated signal which is sampled at 48KHz and 12 > >> samples/symbol. > > >> Now, I want to resample this signal, so that the new signal has sampling > >> rate of 47968 Hz. > > >> Is there any possible way of doing it.? > > >> I totally new to this multirate dsp topic. > > > how familiar are you to the Nyquist/Shannon sampling (and > > reconstruction) theorem? &#2013266080;consider what that says to how to > > reconstruct your uniformly sampled signal back to a continuous-time > > signal. &#2013266080;then sample that at your new sample rate. &#2013266080;now imagine doing > > this math hypothetically rather than in reality with an ideal D/A, > > ideal anti-imaging filter, and ideal A/D. &#2013266080;just do the math of what > > those devices would do directly. > > >> Your opinion matters a lot. > > > even though it's 3 months after the election, i keep getting spam from > > barackobama.com that says the same thing. &#2013266080; somehow i doubt that the > > prez is reading my opinions. > > Most unlikely, but I'll hazard the guess that someone on his staff > tracking the responses. >
The same guy that mixes the kool-aid.
On Feb 10, 4:16&#2013266080;pm, "cpshah99" <cpsha...@rediffmail.com> wrote:
> > I have done something using linear interpolation
essentially, the only difference between this and what i am alluding to is that your reconstruction filter has an impulse response of { 1/T*(1 - |t|/T) for |t| <= T h(t) = { { 0 otherwise T*Fs = 1 it's a triangular pulse for the impulse response. in the more ideal resampling case, the impulse response would look something like h(t) = 1/T * sinc(t/T) * w(t) where w(t) is some decent window function. now there are better, more optimal h(t) (like something you get from running that remez() or firls () function in MATLAB), but it will *look* like the h(t) above. and you can use the windowed sinc() as a place to start.
> but then I should get > some kind of compression of the signal, but I am not getting that.
well, if you're resampling with a relative sampling period of 48000/47968, you should get greater spacing (in absolute time) between samples, and for the same period of time, fewer samples. you're not getting that?
> Now, my o/p sampling rate is 47968 Hz. so what i did was generate the > signal at 96 KHz and do linear interpolation. but then there is no > compression. The carrier is 12kHz.
i dunno about this carrier. i presume it's something that you're trying to extract out of the signal or, i dunno, something else. but, AFAIC, it is immaterial to the issue of converting from Fs = 48000 Hz to Fs = 47968 Hz. r b-j
On Feb 10, 5:04&#2013266080;pm, robert bristow-johnson <r...@audioimagination.com>
wrote:
> On Feb 10, 4:16&#2013266080;pm, "cpshah99" <cpsha...@rediffmail.com> wrote: > > > > > I have done something using linear interpolation > > essentially, the only difference between this and what i am alluding > to is that your reconstruction filter has an impulse response of > > &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;{ 1/T*(1 - |t|/T) &#2013266080; &#2013266080; for |t| <= T > &#2013266080; &#2013266080; h(t) = { > &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;{ 0 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; otherwise > > &#2013266080; &#2013266080; T*Fs = 1 > > it's a triangular pulse for the impulse response. &#2013266080;in the more ideal > resampling case, the impulse response would look something like > > &#2013266080; &#2013266080; h(t) &#2013266080;= &#2013266080;1/T * sinc(t/T) * w(t) > > where w(t) is some decent window function. &#2013266080;now there are better, more > optimal h(t) (like something you get from running that remez() or firls > () function in MATLAB), but it will *look* like the h(t) above. &#2013266080;and > you can use the windowed sinc() as a place to start. > > > but then I should get > > some kind of compression of the signal, but I am not getting that. > > well, if you're resampling with a relative sampling period of > 48000/47968, you should get greater spacing (in absolute time) between > samples, and for the same period of time, fewer samples. &#2013266080;you're not > getting that? > > > Now, my o/p sampling rate is 47968 Hz. so what i did was generate the > > signal at 96 KHz and do linear interpolation. but then there is no > > compression. The carrier is 12kHz. > > i dunno about this carrier. &#2013266080;i presume it's something that you're > trying to extract out of the signal or, i dunno, something else. &#2013266080;but, > AFAIC, it is immaterial to the issue of converting from Fs = 48000 Hz > to Fs = 47968 Hz. > > r b-j
If the carrier is 12 kHz and there are 12 samples per symbol, you have some excess bandwidth when Fs=48 kHz, making the job of the resampler easier since it doesn't see any energy near Fs/2. Were that not the case, I was going to suggest a fixed interp by 2 prior to a fractional decimator. John John
Hello All

Finally solved the problem. I was making mistake in using the o/p sampling
rate...

Lets say I want to resample the data so that new sampling rate is

Ts_new=(1+I)Ts_old, where I is any non integer value, eg. I=1.0001.

Now, in order to achieve this, generate signal at very high rate and then
linear interpolate to get new rate.

Now it is working fine, if the I>1 then it compresses the signal and if
I<1 then expands the signal.

Thanks again.

cpshah99 wrote:
> Now, in order to achieve this, generate signal at very high rate and then > linear interpolate to get new rate.
You originally said that you had a 48 kHz signal, so by "generate", I'm not sure if you mean upsampling that to a higher rate (integer ratio sinc interpolation perhaps), then interpolating your lower-rate point linearly, or whether you were in a situation where you could simply recreate the signal at a higher rate (multiple of 48k), then do the reduction. If it's the former, I just wanted to point out that there's no reason you can't go directly from 48 kHz to your target of 47968 Hz. I mention it because I think many people don't realize it. The text books all discuss doing conversion by integer ration upsampling and downsampling, but there's no reason you can't pick an arbitrary in-between point to interpolate for each output sample. The main reason to do it by integer ratios is that you can build a sampled windowed-sinc table (for instance--since a lot of people know this approach--but applicable to any FIR lpf approach) with the proper characteristics and manage it all by table lookup. That is, the spacing between two input samples is identical as you move from input sample to the next (e.g, 0.25, 0.50, 0.75, 1.0 for 4x upsampling). The most obvious way to do arbitrary (fractional) ratios directly is to calculate the required sample of the sinc for each new arbitrary point, but of course this has historically been a big computational hit (which is why we use those integer-ratio tables to begin with). Slightly less obvious is to--instead of building the "just right" sinc table--build a bigger oversampled one. Since the windowed sinc is smooth, you can linearly interpolate the oversampled table to get the arbitrary point on the (sinc) function that you need in order to calculate the next arbitrary point in your output, with high precision. Credit to Julius O Smith on that idea years ago... let's see... I think it's here, don't have time to read: http://ccrma-www.stanford.edu/~jos/resample/ Finally, if anyone wants to read a general discussion about sample rate conversion, here's mine: http://www.earlevel.com/Digital%20Audio/RateConversion.html I believe the view I present there has the advantage of making some of the confusing issues of sample rate conversion more obvious than some explanations.