In <fb78d2e7.0407090927.50acf218@posting.google.com> Luis Fernando wrote:

> 1) why is it necessary to run a filter when I upsample? I won't be
> generating any high frequency doing this, will I?

Maybe this will help. You're probably aware that a digital signal has
aliased images that mirror and repeat--that is the reason we need to
apply a low pass filter ("anti-imaging filter", "reconstruction filter",
etc.) when we convert to analog. You've probably seen frequency graphs
that look something like this (use a fixed-width font):
0 a b c d
| | | | |
______ ___________ __________ ...
\ / \ /
\ / \ /
It goes in the negative direction too, but here I'm showing the positive
half, starting at 0 Hz. Your nice audio content is in the band of 0
though a, and your sample rate is b. (If you converted this signal to
analog, you would follow the D/A with a low pass filter with a cutoff at
a.) If you double the sample rate without doing anything else, you've
simply moved the sample rate to d, increasing the available working
bandwidth from 0-a to 0-b. So you can see that you have now "revealed"
the aliasing in the area from a to b. You need to low pass filter with a
cutoff at a to get rid of that aliased image before applying your non-
linear processing.
So the answer is that while you haven't generated any new high
frequencies, you've widened the audio band so that frequencies that were
above the audio band before are now in the new audio band.

Reply by Jon Harris●July 12, 20042004-07-12

"Jerry Avins" <jya@ieee.org> wrote in message
news:40ef446b$0$1178$61fed72c@news.rcn.com...

> Jon Harris wrote:
> > I'm arguing here for a unified filtering-centric treatment of interpolation.
> > I've found this to be the most useful way of analyzing and comparing various
> > interpolation methods.
>
> You certainly don't need to argue that with me: I agree. We're trying to
> give the OP a feel for what he's doing. (I'm sure he knows by now that
> filtering of a sort is in fact needed.) As a matter of practical
> implementation, the way it's done is the whole point.

Glad to hear you agree with this. From some of your past comments, it sounded
to me like you were considering interpolation and filtering to be different
animals. To wit:
"One way is do use a good interpolation formula. A
better and often simpler way is to insert zeros and then to filter out
the new artifacts."
and
"True enough, but the results of linear interpolation and of low-pass
filtering are not the same. Linear interpolation can generate in-band
distortion products that defy subsequent filtering."
IMHO, realizing that interpolation formulas and zero-stuffing/filtering are just
different implementations of LP filtering is an important step in understanding
the big picture of sample rate converting.

Reply by Jerry Avins●July 9, 20042004-07-09

Jon Harris wrote:

> I'm arguing here for a unified filtering-centric treatment of interpolation.
> I've found this to be the most useful way of analyzing and comparing various
> interpolation methods.

You certainly don't need to argue that with me: I agree. We're trying to
give the OP a feel for what he's doing. (I'm sure he knows by now that
filtering of a sort is in fact needed.) As a matter of practical
implementation, the way it's done is the whole point.
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������

Reply by Jon Harris●July 9, 20042004-07-09

"Jerry Avins" <jya@ieee.org> wrote in message
news:40ef164b$0$1169$61fed72c@news.rcn.com...

> Jon Harris wrote:
> > "Jerry Avins" <jya@ieee.org> wrote in message
> > news:40eee85d$0$1169$61fed72c@news.rcn.com...
> >
> >>One way is do use a good interpolation formula. A
> >>better and often simpler way is to insert zeros and then to filter out
> >>the new artifacts.
> >
> >
> > The two methods are different ways of conceptualizing, but mathematically

are

> > the same process (i.e. your interpolation formula can be analyzed as a

filter*,

> > and your LP filter can be viewed as an interpolation formula).
> >
> > *assuming a linear interpolation formula
>
> True enough, but the results of linear interpolation and of low-pass
> filtering are not the same. Linear interpolation can generate in-band
> distortion products that defy subsequent filtering. About "my"
> interpolation formula, I cited none in particular. The most appropriate
> method has to do with the system's specs and the resources available to
> meet them.

My point here is that linear interpolation _is_ low pass filtering. It's not
very good LP filtering, but it is indeed LP filtering. In fact, you can design
a FIR LP filter that does give you the _exact_ same result as a LP filter (it
has a triangular impulse response). Or conversely, you can find the impulse of
any linear interpolation method and implement it as a filter. You can also
measure the response of a linear interpolator and observe the LP characteristic
(complete with some really nasty sidelobes, the main source of the aliasing you
are speaking of).
I'm arguing here for a unified filtering-centric treatment of interpolation.
I've found this to be the most useful way of analyzing and comparing various
interpolation methods.

Reply by Jerry Avins●July 9, 20042004-07-09

Jon Harris wrote:

> "Jerry Avins" <jya@ieee.org> wrote in message
> news:40eee85d$0$1169$61fed72c@news.rcn.com...
>
>>Luis Fernando wrote:
>>
>>
>>>thanks! that's a very nice text, but I still have some doubts:
>>>
>>>1) why is it necessary to run a filter when I upsample? I won't be
>>>generating any high frequency doing this, will I?
>>
>>One way is do use a good interpolation formula. A
>>better and often simpler way is to insert zeros and then to filter out
>>the new artifacts.
>
>
> The two methods are different ways of conceptualizing, but mathematically are
> the same process (i.e. your interpolation formula can be analyzed as a filter*,
> and your LP filter can be viewed as an interpolation formula).
>
> *assuming a linear interpolation formula

True enough, but the results of linear interpolation and of low-pass
filtering are not the same. Linear interpolation can generate in-band
distortion products that defy subsequent filtering. About "my"
interpolation formula, I cited none in particular. The most appropriate
method has to do with the system's specs and the resources available to
meet them.
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������

Reply by Jon Harris●July 9, 20042004-07-09

"Jerry Avins" <jya@ieee.org> wrote in message
news:40eee85d$0$1169$61fed72c@news.rcn.com...

> Luis Fernando wrote:
>
> > thanks! that's a very nice text, but I still have some doubts:
> >
> > 1) why is it necessary to run a filter when I upsample? I won't be
> > generating any high frequency doing this, will I?
>
> One way is do use a good interpolation formula. A
> better and often simpler way is to insert zeros and then to filter out
> the new artifacts.

The two methods are different ways of conceptualizing, but mathematically are
the same process (i.e. your interpolation formula can be analyzed as a filter*,
and your LP filter can be viewed as an interpolation formula).
*assuming a linear interpolation formula

Reply by Jerry Avins●July 9, 20042004-07-09

Luis Fernando wrote:

> thanks! that's a very nice text, but I still have some doubts:
>
> 1) why is it necessary to run a filter when I upsample? I won't be
> generating any high frequency doing this, will I?

You will. When you insert extra samples, the new sequence rill represent
a waveform with new frequencies unless you have a way to know what those
samples would have been if they had been taken from the original source.
(Whew! Long sentence sorry!) You don't have a way to know that, but you
can calculate it. One way is do use a good interpolation formula. A
better and often simpler way is to insert zeros and then to filter out
the new artifacts.
...
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������

Reply by Luis Fernando●July 9, 20042004-07-09

thanks! that's a very nice text, but I still have some doubts:
1) why is it necessary to run a filter when I upsample? I won't be
generating any high frequency doing this, will I?
2) I tried to implement my distortion like:
input -> interpolate -> "distortion" (cut amplitude) -> lowpass filter
-> decimate -> output
i'm using this simple "distortion" algorithm:
---------
x = input / DISTORTION_LEVEL;
if (x < -1) y = -2/3;
else if (x > 1) y = 2/3;
else y = x - (x*x*x)/3;
y *= NIVEL_DISTORCAO;
output = y;
---------
i'm working on 48000 Hz sample ratio and interpolating four "0", so it
would become 240000 Hz
but, if I understand correct:
"when I receive an input, for example '10000', I act like I had
received 5 inputs: '10000', '0', '0', '0', '0', then I apply the
distortion to them, run the lowpass filter, and return just the first
one"
the problem is that I end up in the same thing as if I hadn't
upsampled/decimated:
let's again suppose I received '10000', and suppose my "limit"
amplitude (DISTORTION_LEVEL) is '5000'
what will happen?
input: 10000
interpolate: 10000 0 0 0 0
apply distortion: 5000 0 0 0 0
apply lowpass filter: 5000 0 0 0 0
decimate: 5000
output: 5000
it's the same output as:
input: 10000
apply distortion: 5000
output: 5000
:(
the problem is probably on "apply lowpass filter"
is it right to interpolate putting "0" instead putting average values?
won't the filter get "crazy" (instead receiving a sinusoid, it's
receiving a weird thing that goes up and down every time)?
BTW, i'm using a 5 bi-quad IIR filter with sample ratio of 240000 Hz.
thanks in advance,
Luis Fernando

Reply by Stephan M. Bernsee●July 9, 20042004-07-09

And here: http://www.musicdsp.com
--smb
Erik de Castro Lopo <nospam@mega-nerd.com> wrote in message news:<40EDB05C.486C4C9C@mega-nerd.com>...

This issue has been rasied here hundreds of times. See for instance
this:
http://groups.google.com/groups?&selm=401AF523.A2C504A8%40mega-nerd.com&rnum=1
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"I want to make sure (a user) can't get through ... an online
experience without hitting a Microsoft ad."
- Microsoft CEO, Steve Ballmer on the Microsoft search engine.