Reply by Jon Harris February 2, 20042004-02-02
"Theory and VLSI Architectures for Asynchronous Sample-Rate Converters",
Robert Adams & Tom Kwan, JAES, Vol 41, No 7/8, 1993 July/August

Highly recommended reading.

Their original filter table was 64 taps by 2^16 phases, but they found they
only needed to store one out of every 128 points and then do linear
interpolation on the reduced coefs.

"Ian Buckner" <Ian_Buckner@agilent.com> wrote in message
news:1075718271.395102@cswreg.cos.agilent.com...
> > "Erik de Castro Lopo" <nospam@mega-nerd.com> wrote in message > news:401B22AE.122D884F@mega-nerd.com... > > Robert Sefton wrote: > > > > > > Anyone familiar with the Analog Devices AD1895/1896 audio sample > rate > > > converters? These little dudes are amazing, even more so when they > first > > > came out in the early '90s. You give them an input sample clock > and an > > > output sample clock and they convert up to 24-bit audio data. I'd > be > > > curious to learn the details of how they work The data sheet says > > > something about "a 64-tap FIR filter with 2^20 polyphases". > > > > I remember seeing the data sheets when they first came out but > > never investigated them properly. > > > > My guess is that they just use a hardware implementation of the > > Julius O. Smith technique. > > > > Erik > > There was a paper describing the inner workings in the JAES, > unfortunately I don't recall the date. I'll maybe have a look tonight. > > Regards > Ian > >
Reply by Ian Buckner February 2, 20042004-02-02
"Erik de Castro Lopo" <nospam@mega-nerd.com> wrote in message
news:401B22AE.122D884F@mega-nerd.com...
> Robert Sefton wrote: > > > > Anyone familiar with the Analog Devices AD1895/1896 audio sample
rate
> > converters? These little dudes are amazing, even more so when they
first
> > came out in the early '90s. You give them an input sample clock
and an
> > output sample clock and they convert up to 24-bit audio data. I'd
be
> > curious to learn the details of how they work The data sheet says > > something about "a 64-tap FIR filter with 2^20 polyphases". > > I remember seeing the data sheets when they first came out but > never investigated them properly. > > My guess is that they just use a hardware implementation of the > Julius O. Smith technique. > > Erik
There was a paper describing the inner workings in the JAES, unfortunately I don't recall the date. I'll maybe have a look tonight. Regards Ian
Reply by Rick S. January 31, 20042004-01-31
> >Anyway, this should answer your question about where to filter and yes, the >filter passband ends below 22.05 and the stopband needs to start the same >fraction above 22.05. One has to assume that there's some guard band in the >data prior to sampling. So, it could be passband to 20.00 and stopband from >24.1 for the transition. You have to get rid of the spectral repetitions >centered around 44.1 and 88.2 and 132.3 and you have to keep the ones at >zero and 176.4. The one centered at 44.1 starts at 24.1 in this example. >
OK, I think I follow you here - mostly. So we aren't talking about just a low pass filter after all since the oversampled spectra must be preserved for input into the next filter stage, right? I think this was the key thing that I was overlooking. Wouldn't I need a low pass filter for the 0 - 20kHz data followed by a bandpass filter centered around 176kHz in order to feed the data into stage 2? Similarly, I guess that a single band reject filter could be used as well. -RS
Reply by Ronald H. Nicholson Jr. January 31, 20042004-01-31
In article <bvenfm$r304m$1@ID-210375.news.uni-berlin.de>,
Jon Harris <goldentully@hotmail.com> wrote:
>Polyphase is just an implementation of bandlimited interpolation.
Just an implementation trick which may or may not be needed. I just tried using the compiler supplied math lib to directly calculate in double precision every tap of a Hann windowed Sinc for every output sample, and found out that a my sub 1 GHz Mac can keep up with generating 64 tap coefficients for one channel of real time audio. No phase tables or approximation by interpolation needed. One of the new G5's could do this for stereo in real time for any floating point resampling ratio. For 16-bit audio data one could probably use an even smaller faster lower precision sin() and cos() library. With a small custom trig library, this could easily be a far more cache friendly implementation than using large phase tables or multiple passes. So for non-real time resampling on a PC, I may just junk multipass and phase table methods and go to direct calculation of every FIR tap for every output point. Not power efficient, but much more transparent and easier to tweak and debug. IMHO. YMMV. -- Ron Nicholson rhn AT nicholson DOT com http://www.nicholson.com/rhn/ #include <canonical.disclaimer> // only my own opinions, etc.
Reply by Fred Marshall January 31, 20042004-01-31
"Rick S." <disregard@disregard.com> wrote in message
news:uczSb.12533$TO4.10884@newssvr23.news.prodigy.com...
> From scouring this group, I see that someone else is attempting the same
thing
> that I'm trying to accomplish - multistage interpolation of an audio
signal.
> Just getting my feet wet with this topic, I'd like to ask you guys a few > general qustions. > > Taking a bandlimited audio signal sampled at 44.1kHz and interpolating by
160
> broken into multiple stages (4x, 5x, and 8x respectively), my question is
do I
> have to apply a filter each stage? I assume I do since interpolation
usually
> implies zero stuffing followed by a filter (often combined so as not to
have
> to multiply filter coeffs by zero valued data) > > Here is my understanding, please correct me if I'm wrong: > > > In the first stage I interpolate by 4x, I would have 44.1 x 4 = 176.4kHz.
So
> do I set my filter passband for 22.05Hz, and stopband at 88.2kHz (1/2 of > 176.4kHz)?
There are some pretty cool pictures of spectra in some of the books. I think the DSP Handbook by Mitra and Kaiser has them. There's the suggestion that different filter transition specifications are OK with a multistage approach and the explanation is given. Now, another way to interpolate is to fft/multiply/ifft. If the records are even slightly long, this is often much faster believe it or not. If you are zero-stuffing to increase the sample rate, then you can skip this step entirely. You only need to replicate the original spectrum for as many times is necessary: e.g. if the interpolation is 4x and the number of stuffed zeros would have been 3 per sample, then you only need to replicate the original spectrum 4 times. Then you filter out everything between fs/2 and 7fs/2 where fs is the original sample rate. The inverse transform has a sample rate that is 4fs. Don't forget to scale properly. If you do it this way, I see no improvement considering multiple stages. And, even if you don't do it this way, you can still see readily where the filter bands need to be - that's independent of the approach. Anyway, this should answer your question about where to filter and yes, the filter passband ends below 22.05 and the stopband needs to start the same fraction above 22.05. One has to assume that there's some guard band in the data prior to sampling. So, it could be passband to 20.00 and stopband from 24.1 for the transition. You have to get rid of the spectral repetitions centered around 44.1 and 88.2 and 132.3 and you have to keep the ones at zero and 176.4. The one centered at 44.1 starts at 24.1 in this example. If you assume a very good filter, then you might imagine that simply zero-extending the original spectrum between 22.1 and (176.4-22.1)=154.3 is all you need to do. No replication, no filtering, just extending the center of the spectrum by ~3N zero samples. The technique is found in dspguru. Some will argue that it introduces temporal artifacts and that's true to one degree or another. I have done a hybrid approach: 2x the spectrum and minimax halfband filter by multiplying - no temporal problems here. 2x the spectrum again and multiply with a halfband filter with at least a double zero at 2fs - again no temporal problems. Now the spectrum is quite flat at 2fs and extending the spectrum by adding zeros in the center doesn't cause an abrupt change - thus generating fewer temporal anomalies than might be had by simply stuffing zeros without filtering first. Also note: There's no guarantee that a record of samples will start out bandlimited as they should be. It could be conservative to apply a lowpass filter before anything else to make sure the spectrum is "zero" at fs/2 to begin with. Consider what happens if the spectrum is simply set to zero at fs/2 only. It's the same as subtracting a sinusoid at fs/2 from the temporal record. So, that may not be the "lowpass filter" that you want for this pupose. Multiplying by a reasonable lowpass filter response would be better. Fred
Reply by Erik de Castro Lopo January 30, 20042004-01-30
Robert Sefton wrote:
> > Anyone familiar with the Analog Devices AD1895/1896 audio sample rate > converters? These little dudes are amazing, even more so when they first > came out in the early '90s. You give them an input sample clock and an > output sample clock and they convert up to 24-bit audio data. I'd be > curious to learn the details of how they work The data sheet says > something about "a 64-tap FIR filter with 2^20 polyphases".
I remember seeing the data sheets when they first came out but never investigated them properly. My guess is that they just use a hardware implementation of the Julius O. Smith technique. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "We can build a better product than Linux" -- Microsoft Corp.'s Windows operating-system chief, Jim Allchin. One has to wonder why, with their huge resources, they haven't.
Reply by Robert Sefton January 30, 20042004-01-30
"Jon Harris" <goldentully@hotmail.com> wrote in message
news:bvetpo$rur45$1@ID-210375.news.uni-berlin.de...
> > Cool. >
Anyone familiar with the Analog Devices AD1895/1896 audio sample rate converters? These little dudes are amazing, even more so when they first came out in the early '90s. You give them an input sample clock and an output sample clock and they convert up to 24-bit audio data. I'd be curious to learn the details of how they work The data sheet says something about "a 64-tap FIR filter with 2^20 polyphases".
Reply by Jon Harris January 30, 20042004-01-30
"Bhaskar Thiagarajan" <bhaskart@deja.com> wrote in message
news:bveqa8$rj0fn$1@ID-82263.news.uni-berlin.de...
> "Jon Harris" <goldentully@hotmail.com> wrote in message > news:bvej4j$rhjko$1@ID-210375.news.uni-berlin.de... > > > > There's got to be something to this multi-stage approach because it is > > frequently suggested, but I have never been able to figure out how it is > > useful in converting for example, from 44.1 to 48kHz. If you just do a > > single polyphase filter, you run the filter directly at the desired
output
> > rate and don't have to do any zero-stuffing or worry about higher > > intermediate frequencies, etc.. > > Ahh..but most novice DSP folks asking about resampling aren't quite ready
to
> jump into polyphase resampling techniques - hence the multi-stage approach > is often suggested.
OK. For me, polyphase actually makes much more sense that all this crazy "zero stuffing, interpolating to some ridiculous sample rate, filtering, decimating" stuff! :-) Maybe that's because I first did sample rate conversion using simple linear interpolation because I didn't know any better. It then made sense to start looking at more and more samples around my interpolated point and use some sort of look-up table to generate the weights for each point. Pretty soon you're doing the polyphase thing, even if you don't know it! Hence polyphase FIR band-limited interpolation was a natural extension of simple linear interpolation. But maybe I'm weird!
> > Maybe it makes sense if you are actually going to use the up-sampled > result > > for something rather than just immediately down-sampling it. But when > your > > input and output sample rates are close, I can't see any advantage. Am
I
> > missing something? > > > > For the original poster, are you really trying to upsample by 160, or is > > your eventual goal to convert 44.1<->48kHz? Sometimes you get more
useful
> > answers if you ask a "bigger picture" question. > > I agree with your statements. The multi-stage approach has maximum
advantage
> when the up-sampling is viewed as a separate entity.
Cool.
Reply by Jon Harris January 30, 20042004-01-30
"Erik de Castro Lopo" <nospam@mega-nerd.com> wrote in message
news:401AE58E.2CEAC566@mega-nerd.com...
> Jon Harris wrote: > > > > > http://ccrma-www.stanford.edu/~jos/resample/ > > > > I'm not sure what is the difference is between JOS's approach and what
I'm
> > talking about. Polyphase is just an implementation of bandlimited > > interpolation. > > The JOS approach is to keep a large table containing a windowed sinc > function. Linear interplation of this table is then used to generate > the exact required sinc function for a given subsample delay. In effect, > this is a polyhphase implmentation with an infinite number of fractional > delay FIR filters.
OK, that's the approach I've used myself. I still considered in polyphase, but I see how it can be viewed as an extension of the basic polyphase approach. (You snipped the part where I said: "One alternative is to come up with a reasonable length table and further interpolate the coefs between the table values to get increased accuracy.")
> Congratulations, nit sucessfully picked :-). However, if you are willing > to dither the ratio (already a double floating point) you can achive a > arbitrarily close approximation to an irational ratio.
Agreed.
Reply by Bhaskar Thiagarajan January 30, 20042004-01-30
"Jon Harris" <goldentully@hotmail.com> wrote in message
news:bvej4j$rhjko$1@ID-210375.news.uni-berlin.de...
> "Bhaskar Thiagarajan" <bhaskart@deja.com> wrote in message > news:bvehcp$qr7hb$1@ID-82263.news.uni-berlin.de... > > "Rick S." <disregard@disregard.com> wrote in message > > news:uczSb.12533$TO4.10884@newssvr23.news.prodigy.com... > > > From scouring this group, I see that someone else is attempting the
same
> > thing > > > that I'm trying to accomplish - multistage interpolation of an audio > > signal. > > > Just getting my feet wet with this topic, I'd like to ask you guys a
few
> > > general qustions. > > > > > > Taking a bandlimited audio signal sampled at 44.1kHz and interpolating > by > > 160 > > > broken into multiple stages (4x, 5x, and 8x respectively), my question > is > > do I > > > have to apply a filter each stage? I assume I do since interpolation > > usually > > > implies zero stuffing followed by a filter (often combined so as not
to
> > have > > > to multiply filter coeffs by zero valued data) > > > > Yes, a filter after every stage. > > > > > > > > Here is my understanding, please correct me if I'm wrong: > > > > > > > > > In the first stage I interpolate by 4x, I would have 44.1 x 4 = > 176.4kHz. > > So > > > do I set my filter passband for 22.05Hz, and stopband at 88.2kHz (1/2
of
> > > 176.4kHz)? > > > > > > I'm confused with the 2nd & 3rd stage. With 5x I assume that I would > keep > > the > > > same passband but since the signal has been filtered in the previous > > stage, > > > wouldn't I acutally be interpolating from 88.2kHz instead on 176.4kHz? > Or > > do I > > > just keep the same passband and filter the signal with a stopband at > > (176.4 x > > > 5)/2? > > > > I suggest you read the responses to the other thread on this topic which > > clearly explain the exact frequencies you'd use and the filter cut-offs. > > It is also helpful to approach the filter cut-offs by normalizing it to > the > > sample rate. It can help keep things more straight forward. > > > > > The multistage approach has thrown me off. If you guys don't mind
please
> > set > > > me straight on this. > > > > > > I realize that interpolation in this case anyway, is zero-stuffing (as > > > opposed to cubic splines, etc) followed by a LPF. If I'm only to
filter
> > the > > > last stage then what is the point of cascading the filter into
multiple
> > > stages? Why not just zero-pad the entire bitstream and apply the
filter
> at > > the > > > end? > > > > The point of cascading the filter into multiple stages is that you get
to
> > keep your filters smaller *and* run them at slower speeds. If you did it > all > > in one shot, your filter will be a fairly long filter (relative to the > multi > > stage approach) and you'd have to make it run at the high sample rate. > > So this is more of a divide and conquer approach. > > > > Cheers > > Bhaskar > > There's got to be something to this multi-stage approach because it is > frequently suggested, but I have never been able to figure out how it is > useful in converting for example, from 44.1 to 48kHz. If you just do a > single polyphase filter, you run the filter directly at the desired output > rate and don't have to do any zero-stuffing or worry about higher > intermediate frequencies, etc..
Ahh..but most novice DSP folks asking about resampling aren't quite ready to jump into polyphase resampling techniques - hence the multi-stage approach is often suggested.
> Maybe it makes sense if you are actually going to use the up-sampled
result
> for something rather than just immediately down-sampling it. But when
your
> input and output sample rates are close, I can't see any advantage. Am I > missing something? > > For the original poster, are you really trying to upsample by 160, or is > your eventual goal to convert 44.1<->48kHz? Sometimes you get more useful > answers if you ask a "bigger picture" question.
I agree with your statements. The multi-stage approach has maximum advantage when the up-sampling is viewed as a separate entity. Cheers Bhaskar