In <1118175450.502685.196710@o13g2000cwo.googlegroups.com> Mark wrote:
> Is the D/A >A/D method theoretically equivalent to a very high order
> digital interpolation? It seems we need to compare the operation of
> the digital interpolation filter vs the operation of the analog
> reconstruction filter.
Yes, the usual sample rate conversion in the digital domain follows the
same principles as doing into by converting to analog, resampling in the
analog domain, and converting back to digital.
For instance: To resample, you could play the digital output through a D/
A convertor and resample it with the A/D of another system running at
the new rate:
48kHz system: 96kHz system:
[ samples -> D/A -> 48KHz lowpass ] -> [ 96kHz lowpass -> A/D ->
samples ]
In the case of upsampling, as depicted, the second lowpass is
superfluous (no need to lowpass at 96k when you've already bandlimited
it to 48k with the first). So, we have [ D/A -> lowpass -> A/Dx2 ] that
performs the conversion (the "x2" is there to remind us that the A/D
runs 2x the D/A rate). This would be hard to do in memory, but we can
observe that if we pull the lowpass out of the middle and move it to the
end, we have the same thing. (Why? Because nothing is stopping us from
using a D/A without a lowpass, except that we realize that we are
getting aliased images of the bandlimited signal by doing so. Following
it with the 48kHz lowpass gets rid of these images.) We now have D/A ->
A/Dx2 -> 48kHz lowpass.
"D/A -> A/Dx2" simplifies to "x2". So we really just need the doubling
of sample rate, followed by a lowpass filter set to block everything
over 48kHz. We can do both of those things in memory (yay!).
OK, to double the samples, the most straight-forward way would be to
keep the samples we have and put new ones in between. If we say that the
samples represent the impulse train from which the original signal was (
or at least could have been) "discretized", then the in-between values
are a constant--zero is the best choice for several obvious reasons--
things like avoiding overflow, DC offset in the signal, and also because
it may let us dispense with multiplies for efficiency. (Don't make the
mistake of thinking that the sampled data represents a staircase wave,
and repeat the samples to fill in the blanks--samples represent impulses (
or can--please, no "they represent the amplitude of a sinc blah blah");
repeating samples gives a sinc-shaped frequency roll-off. Inserting
zeros, on the other hand, maintains the spectrum exactly, with the
addition of mirror-image aliasing. The low pass that follows removes the
aliasing--that why they are sometimes referred to as anti-aliasing or
anti-imaging filters.)
For completeness, here's the view of downsampling:
96kHz system: 48kHz system:
[ samples -> D/A -> 96KHz lowpass ] -> [ 48kHz lowpass -> A/D ->
samples ]
Here the 96kHz lowpass is superfluous, so it reduces to [ D/A -> 48kHz
lowpass -> A/Dx0.5 ]. Since the 0.5 times factor for the sample rate
throws away information, we need to reverse the order used for
upsampling and reduce this to [ 48kHz lowpass -> D/A -> A/Dx0.5 ], or
simply [ lowpass -> 0.5x rate ]. The "0.5 rate" conversion is performed
by discarding every other sample.
Linear interpolation for the upsampling, as others have mentioned, is
simply a poor lowpass filter, one that rolls off the highs a bit, and
aliases quite a bit due to the fat sidelobes. Linear interpolation can
work fine when the signal is already oversampled, but in your case you
most likely want to preserved the maximum bandwidth, so that won't be
true. FIRs using windowed sinc (that is, the impulse response of a
linear phase low pass filter) are a popular choice.
In the end, the quality of the conversion depends on your algorithm and
how much computational time you want to devote to each sample. It's easy
to get far more accurate conversion computationally than to go the D/A-
>A/D route.
Reply by Jon Harris●June 7, 20052005-06-07
"Tim Wescott" <tim@seemywebsite.com> wrote in message
news:11ac21srirdp41@corp.supernews.com...
> Mark wrote:
> > I have a question about PLESIOCHROUNOUS re-sampling of audio.
> >
> >
> > It was mentioned in another thread that simply deleting or repeating a
> > sample now and then is a poor solution because it adds clicks.
> >
> Correct.
> >
> > It was mentioned that linear interpolation is not ideal. Why? Because
> > it adds noise? or distortion?
> >
> I assume because it wouldn't entirely get rid of the clicks (I haven't
> tried it, myself).
It does get rid of the clicks, but doesn't filter out the images very well. A
linear interpolator is an FIR low-pass filter, just not a very good one! It
"features" both poor pass-band flatness (rolls off too early) and lousy
stop-band rejection (with big ugly sidelobes).
> > And here is my real question. I understand that re-sampling by
> > converting the signal back to analog, reconstruction filtering, then
> > re-sampling in a A/D is considered a kludgey. But assuming we didn't
> > care that it was kludgey and the A/D and D/A are good, in terms of
> > audio quality, how does the D/A > A/D method compare to the other
> > methods mentioned above in terms of audio quality?
> >
> In theory it could work very well, with the anti-aliasing filter being
> the limiting factor.
> >
> > Is the D/A >A/D method theoretically equivalent to a very high order
> > digital interpolation? It seems we need to compare the operation of
> > the digital interpolation filter vs the operation of the analog
> > reconstruction filter.
> >
> Yes.
> >
> > In practice, how complex of a digital interpolation filter would be
> > needed to get audio performance that was as good or better than can be
> > obtained using typical D/A > A/D.
> >
> That depends entirely on your antialiasing filter. With no filter you'd
> just be deleting or repeating samples _and_ adding noise and distortion.
(I am assuming an audio application.) Most of the audio converters are of the
upsampling (or oversampling) variety, so a good deal of the anti-aliasing filter
is digital and built into the chips. Generally, all you need to add on the
outside is a simple 2 or 3 pole analog filter.
Reply by Jon Harris●June 7, 20052005-06-07
"Mark" <makolber@yahoo.com> wrote in message
news:1118175450.502685.196710@o13g2000cwo.googlegroups.com...
> I have a question about PLESIOCHROUNOUS re-sampling of audio.
>
>
> It was mentioned in another thread that simply deleting or repeating a
> sample now and then is a poor solution because it adds clicks.
True, but if your sample rates are really close together in frequency, the click
may only happen very rarely, so it _might_ be tolerable, depending on your audio
signal and application. For example, if the click happened only once a day,
maybe that would be OK. But in general, free-running sample rates aren't that
close so the clicks are objectionable.
> It was mentioned that linear interpolation is not ideal. Why? Because
> it adds noise? or distortion?
I guess you would technically call what it adds non-harmonic distortion. It
also creates high frequency roll-off.
> I presume the "ideal" digital solution is to use a higher order
> interpolation algorithm. Is this correct?
Yes.
> And here is my real question. I understand that re-sampling by
> converting the signal back to analog, reconstruction filtering, then
> re-sampling in a A/D is considered a kludgey. But assuming we didn't
> care that it was kludgey and the A/D and D/A are good, in terms of
> audio quality, how does the D/A > A/D method compare to the other
> methods mentioned above in terms of audio quality?
High end audio A/D and D/A converters are capable of about 120dB dynamic range.
Back to back in a system, you probably get 116dB dyanmic range or so. For many
applications, that would be more that sufficient. (You haven't told us what
your application is, so I can't comment on that.) The best all-digital
solutions can obtain 140dB dynamic range.
> Is the D/A >A/D method theoretically equivalent to a very high order
> digital interpolation? It seems we need to compare the operation of
> the digital interpolation filter vs the operation of the analog
> reconstruction filter.
Yes, they are equivalent. Both methods add some amount of noise, the D/A > A/D
due to electrical noise, and the digital method due to finite numerical
precision. Both have finite attenuation of alias frequencies.
> In practice, how complex of a digital interpolation filter would be
> needed to get audio performance that was as good or better than can be
> obtained using typical D/A > A/D.
It kind of depends on your sample rate and what portion of the available
frequency spectrum your input signal operates (i.e. how much frequency headroom
you have for a filter transition band). But in general, I think the dedicated
audio sample rate converters use about an FIR filter in the range of 64 taps.
Running at 48kHz, for example, that is trivial for today's DSPs.
My question to you is if you have full access to designing hardware, then why
don't you design in one of the many audio sample rate converter chips? Their
interfaces look just like that of an A/D or D/A, but they are cheap, keep
everything digital, and are generally easier to work with. Some manufacturers
to look at are Analog Devices, Crystal/Cirrus, TI, and AKM.
--
Jon Harris
SPAM blocked e-mail address in use. Replace the ANIMAL with 7 to reply.
Reply by Tim Wescott●June 7, 20052005-06-07
Mark wrote:
> I have a question about PLESIOCHROUNOUS re-sampling of audio.
>
>
> It was mentioned in another thread that simply deleting or repeating a
> sample now and then is a poor solution because it adds clicks.
>
Correct.
>
> It was mentioned that linear interpolation is not ideal. Why? Because
> it adds noise? or distortion?
>
I assume because it wouldn't entirely get rid of the clicks (I haven't
tried it, myself).
>
> I presume the "ideal" digital solution is to use a higher order
> interpolation algorithm. Is this correct?
>
Yes.
>
> And here is my real question. I understand that re-sampling by
> converting the signal back to analog, reconstruction filtering, then
> re-sampling in a A/D is considered a kludgey. But assuming we didn't
> care that it was kludgey and the A/D and D/A are good, in terms of
> audio quality, how does the D/A > A/D method compare to the other
> methods mentioned above in terms of audio quality?
>
In theory it could work very well, with the anti-aliasing filter being
the limiting factor.
>
> Is the D/A >A/D method theoretically equivalent to a very high order
> digital interpolation? It seems we need to compare the operation of
> the digital interpolation filter vs the operation of the analog
> reconstruction filter.
>
Yes.
>
> In practice, how complex of a digital interpolation filter would be
> needed to get audio performance that was as good or better than can be
> obtained using typical D/A > A/D.
>
That depends entirely on your antialiasing filter. With no filter you'd
just be deleting or repeating samples _and_ adding noise and distortion.
>
> thanks
> Mark
>
Look for "polyphase filtering". Your challenge in doing this comes in
two parts: one, to filter the audio; and two to know how much phase to
slip each sampling interval.
You want to filter the audio to get a nice smooth transition without
using lots of processor bandwidth -- this is where the polyphase
filtering comes in. It'll let you introduce an arbitrary phase shift
into the audio, ready for resampling.
You also need to know how much phase to add or subtract at each sample
interval to keep the two audio streams lined up. This is more
difficult. If you knew the _exact_ ratio between the sample rates of
the input and output stream it would be easy. Without this knowledge
you'd probably want to have a nice deep FIFO, and you'd want to keep the
FIFO depth servoed to 1/2 by adjusting your sampling rates.
-------------------------------------------
Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply by Mark●June 7, 20052005-06-07
I have a question about PLESIOCHROUNOUS re-sampling of audio.
It was mentioned in another thread that simply deleting or repeating a
sample now and then is a poor solution because it adds clicks.
It was mentioned that linear interpolation is not ideal. Why? Because
it adds noise? or distortion?
I presume the "ideal" digital solution is to use a higher order
interpolation algorithm. Is this correct?
And here is my real question. I understand that re-sampling by
converting the signal back to analog, reconstruction filtering, then
re-sampling in a A/D is considered a kludgey. But assuming we didn't
care that it was kludgey and the A/D and D/A are good, in terms of
audio quality, how does the D/A > A/D method compare to the other
methods mentioned above in terms of audio quality?
Is the D/A >A/D method theoretically equivalent to a very high order
digital interpolation? It seems we need to compare the operation of
the digital interpolation filter vs the operation of the analog
reconstruction filter.
In practice, how complex of a digital interpolation filter would be
needed to get audio performance that was as good or better than can be
obtained using typical D/A > A/D.
thanks
Mark