DSPRelated.com
Forums

Resampling

Started by Inaki Val October 31, 2005
Bob Cain wrote:
> > Erik de Castro Lopo wrote: > > Inaki Val wrote: > >> Dear, > >> > >> I want to resample a real signal from for instance 1024 -> 1027 samples. > > > > Try Secret Rabbit Code: > > > > http://www.mega-nerd.com/SRC/ > > Does it really allow such precision?
Yes, one of the test cases I use in the test suite upsamples by a ratio of 1.00001.
> On occasion I'd have loved to be > able to stretch something containing tens of millions of samples by > precisely a few hundred or even a few tens of samples.
The rabbit should do that. If it doesn't I would consider it a bug. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "And this is one of the central problems with Islam. It's a religion with something for everyone. If you wake up one morning in a good mood you can find all sorts of stuff that are peaceable, loving, kind. On the other hand, if you wake up in a foul temper then there's plenty of hateful stuff to help you vent your spleen. In reality, if you believe the Quoran is the word of god then you have to take both on board. You can't pick and choose." -- http://garymonro.blogsome.com/2005/08/11/
in article CaednfepWu1GZfveRVn-rQ@web-ster.com, Tim Wescott at
tim@seemywebsite.com wrote on 11/01/2005 00:10:

> Goodness you're cranky this week.
yeah. i sorta like Halloween, but when you get kids, i sorta wish they would abolish it. i'd say Christmas, too, if it didn't sound so sacrilegious. Bah! Humbug!
> Look for polyphase conversion on the web, Secret Rabbit Code (I have > _no_ idea what this may have to do with Sample Rate Conversion) is a > good example.
Erik's SRC appears to be very good. i actually never built it but i looked at the salient parts of the source code. his is better than mine, but mine is a little simpler and they be based on the same exact principle. (and mine ain't public domain.) -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
in article 1130819608.181096.134760@g49g2000cwa.googlegroups.com,
cs_posting@hotmail.com at cs_posting@hotmail.com wrote on 10/31/2005 23:33:

> robert bristow-johnson wrote: >>>>> I want to resample a real signal from for instance 1024 -> 1027 samples. > >>> You don't have to compute all of them in the first place, but you do >>> have to compute smoothed intermediate samples at a wide variety of >>> possible points in between the input ones. >> >> why? >> >>> Do you have a way of computing only those that are needed? >> >> you only need to compute the samples that fall precisely on the output >> sample times. > > Yes, but the samples you need (at output frequency) will fall at a > range of times between (and rarely coincident with) an input sample.
fine. but that does not mean that if your SRC ratio is 1027/1024, that you need to upsample first by 1027. that is what i was responding to.
>> it might not be simpler for many simple SRC ratios, but a coefficient table >> that is large enough (how large?) coupled with some kind of interpolation >> (perhaps linear interpolation) is the simplest way for arbitrary or varying >> sample rate ratio. > > It's not so much that you can't use linear interpolation, as that you > need to low-pass filter the resampled signal to get rid of high > frequency error components (phase jitter, distortion, etc) above it's > nyquist limit. Easiest way to do that is digitally, at several times > out output sample rate, though it probably doesn't have to be the LCM > of sample rates. That filter can accomplish better than linear > interpolation for you too, if the FIR includes several input samples. > You do have to clock the filter quite a bit faster than the sample > rate, but most of the inputs except for those at input sample rate will > be zero.
and you don't need to MAC those samples. listen, cs_posting, this is a well-defined mathematical problem with a well-defined solution (or a few different well-defined solutions). i don't know what it is that you're trying to teach me, but my mind is open. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
robert bristow-johnson wrote:
> in article CaednfepWu1GZfveRVn-rQ@web-ster.com, Tim Wescott at > tim@seemywebsite.com wrote on 11/01/2005 00:10: > > >>Goodness you're cranky this week. > > > yeah. i sorta like Halloween, but when you get kids, i sorta wish they > would abolish it. i'd say Christmas, too, if it didn't sound so > sacrilegious. > > Bah! Humbug!
http://www.vice-recordings.com/halloween/ http://lawrenkmills.mu.nu/archives/126063.php Sample at http://www.vice-recordings.com/halloween/. You might like it. "This single features a star-studded ensemble (Beck, Sum 41, The Arcade Fire) known as the NORTH AMERICAN HALLOWEEN PREVENTION INITIATIVE. Both a trick and a treat, this song is a satire - as well as a charity-benefit song with all proceeds being donated to UNICEF." Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
robert bristow-johnson wrote:

> and you don't need to MAC those samples. listen, cs_posting, this is a > well-defined mathematical problem with a well-defined solution (or a few > different well-defined solutions). i don't know what it is that you're > trying to teach me, but my mind is open.
If you already know the answer, why do you keep asking questions? If you are asking questions in order to instruct, it seems you should either follow up with a contrasting answer, or continue asking questions until you get the answer you want. But continuing to ask qeustions and then asking why we are playing 20 questions is just silly.
cs_posting@hotmail.com wrote:
> robert bristow-johnson wrote: > > >>and you don't need to MAC those samples. listen, cs_posting, this is a >>well-defined mathematical problem with a well-defined solution (or a few >>different well-defined solutions). i don't know what it is that you're >>trying to teach me, but my mind is open. > > > If you already know the answer, why do you keep asking questions? > > If you are asking questions in order to instruct, it seems you should > either follow up with a contrasting answer, or continue asking > questions until you get the answer you want. But continuing to ask > qeustions and then asking why we are playing 20 questions is just > silly.
I've been following the thread, and I can't recall any questions to you from R.B-J. It's not yet clear whether you are confused, or a troll. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Erik de Castro Lopo wrote:
> Bob Cain wrote:
>> On occasion I'd have loved to be >> able to stretch something containing tens of millions of samples by >> precisely a few hundred or even a few tens of samples. > > The rabbit should do that. If it doesn't I would consider it a > bug.
Thanks, Eric. Do you know if anyone has made a rabbit based DX or VST plugin for Win that can be used in audio DAW's? Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein
in article Naidnfdv8aORJ_reRVn-qg@rcn.net, Jerry Avins at jya@ieee.org wrote
on 11/01/2005 13:55:

> cs_posting@hotmail.com wrote: >> robert bristow-johnson wrote: >> >> >>> and you don't need to MAC those samples. listen, cs_posting, this is a >>> well-defined mathematical problem with a well-defined solution (or a few >>> different well-defined solutions). i don't know what it is that you're >>> trying to teach me, but my mind is open. >> >> >> If you already know the answer, why do you keep asking questions? >> >> If you are asking questions in order to instruct, it seems you should >> either follow up with a contrasting answer, or continue asking >> questions until you get the answer you want. But continuing to ask >> qeustions and then asking why we are playing 20 questions is just >> silly. > > I've been following the thread, and I can't recall any questions to you > from R.B-J. It's not yet clear whether you are confused, or a troll.
there was definitely a rhetorical question (but i *did* also give an answer, so i am not so sure what he wants me to do differently): in article BF8C3D3F.BB8D%rbj@audioimagination.com, robert bristow-johnson at rbj@audioimagination.com wrote on 10/31/2005 21:39:
> in article 1130785305.942008.159020@g14g2000cwa.googlegroups.com, > cs_posting@hotmail.com at cs_posting@hotmail.com wrote on 10/31/2005 14:01: > >> robert bristow-johnson wrote: >>>> I want to resample a real signal from for instance 1024 -> 1027 samples. >>>> I prefer not to do it in the temporal domain, in order to avoid large >>>> upsampling and downsampling steps. >>> >>> where do these guys pick up these misconceptions? is there some textbook >>> somewhere that is saying that you first upsample by an integer factor of >>> 1027, then pick out 1 sample in every 1024 thus throwing away the other >>> 1023? does it not occur to people that, if all you're gonna do with the >>> other 1023 samples is throw them away, maybe you don't have to compute them >>> in the first place? >> >> You don't have to compute all of them in the first place, but you do >> have to compute smoothed intermediate samples at a wide variety of >> possible points in between the input ones. > > why? > >> Do you have a way of computing only those that are needed? > > you only need to compute the samples that fall precisely on the output > sample times.
.... -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Jerry Avins wrote:
> I've been following the thread, and I can't recall any questions to you > from R.B-J. It's not yet clear whether you are confused, or a troll.
Hmm, then what's this doing in the response to my message? robert bristow-johnson wrote:
> it might not be simpler for many simple SRC ratios, but a coefficient table > that is large enough (how large?)
No, it's not something I had a definite answer for, but it is a question still outstanding that I had been trying to bracket the answer range for, when robert started asking what the point of the exchange was.
in article 1130874479.270812.183870@z14g2000cwz.googlegroups.com,
cs_posting@hotmail.com at cs_posting@hotmail.com wrote on 11/01/2005 14:47:

> Jerry Avins wrote: >> I've been following the thread, and I can't recall any questions to you >> from R.B-J. It's not yet clear whether you are confused, or a troll. > > Hmm, then what's this doing in the response to my message? > > robert bristow-johnson wrote: > >> it might not be simpler for many simple SRC ratios, but a coefficient table >> that is large enough (how large?) > > No, it's not something I had a definite answer for, but it is a > question still outstanding that I had been trying to bracket the answer > range for, when robert started asking what the point of the exchange > was.
okay, that's a question i forgot i asked. if you're doing a simple synchronous with a rational SRC ratio: N/M will need N arrays of h[k] for an FIR reconstruction filter (for fractional delay of K-1 + n/N where K is number of taps or the length of the FIR and n is an integer 0 <= n < N). if you have a SRC that is not representable with as a fraction with low integers, then you will have to pick a large number (N=512 is good enough, 120 dB S/N if you follow that with linear interpolation, if no coefficient interpolation, then N=512,000 is what you might need). -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."