DSPRelated.com
Forums

Anti Aliasing of Arbitrary Waveforms

Started by Scott Gravenhorst September 23, 2008

Scott Gravenhorst wrote:

> What are the common method(s) for preventing aliasing of arbitrary > waveforms generated within a DSP application?
Offtopic: Question: - Why it is impossible to have sex in the middle of the Red Square in Moscow? Answer: - Because every idiot bystander will try to give you his valuable advice. I understand that
> waveforms supplied as analog signals and presented to an ADC must > first be lowpass filtered to remove harmonics above the Nyquist > frequency, but what about generated waveforms? I know about BLIT and > it won't be appropriate for completely arbitrary waveforms. I'm > currently experimenting with a Chebyshev filter by upsampling (2:1), > filtering at Fc of 0.25, then decimating (1:2), but I'm still hearing > aliasing.
How did you came up with those numbers? Have you checked that the Chebyshev filter works properly? How much of attenuation do you need?
> The filter I'm using is 8 poles, 0.5% ripple, but I don't > hear a difference between the unfiltered and the filtered signals.
I have a car. It has four wheels. The wheels are 15'. But I can't drive the car. Why?
> My > sample rate is 200KHz, expected range of frequency for the arbitrary > waveforms is 0Hz to 10KHz. > > Do I need more poles? > A different Fc? > More oversampling? > > Or do I need a completely different method?
You need to get a clue. Or find someone who has a clue.
> I looked a windowed sinc filters, but I also read that Chebyshev is > supposed to be quite good, but with much lower computational needs.
I looked at the ships and the airplanes, but I think that my car should ride very good and consume less gas. Please help.
> Many thanks.
How many thanks? Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
On 23 Sep 2008 21:57:38 GMT, Scott Seidman
<namdiesttocs@mindspring.com> wrote:

>no.spam@gte.net (Scott Gravenhorst) wrote in news:48e96146.104440734 >@news.verizon.net: > >> One thing I just realized, when I decimate, I'm merely decimating, >> i.e., sending every other sample to the DAC. I should be averaging >> two samples to generate the decimated output. I need to try that too. >> It may not reduce aliasing as much as I want it to, but it will show >> that I'm on the right track if I can audibly reduce it. >> > > >No-- you should be applying a digital filter at about 40% of the target >sample rate, then decimating.
Ah, ok then, I need to reduce Fc of my filter. I assume that this is because no digital filter rolls off perfectly. Thank you to all involved, I now need to go back to the lab and do more experiments.
Vladimir Vassilevsky  <antispam_bogus@hotmail.com> wrote:

>Scott Gravenhorst wrote:
> I understand that >> waveforms supplied as analog signals and presented to an ADC must >> first be lowpass filtered to remove harmonics above the Nyquist >> frequency, but what about generated waveforms? I know about BLIT and >> it won't be appropriate for completely arbitrary waveforms. I'm >> currently experimenting with a Chebyshev filter by upsampling (2:1), >> filtering at Fc of 0.25, then decimating (1:2), but I'm still hearing >> aliasing.
>How did you came up with those numbers? >Have you checked that the Chebyshev filter works properly? >How much of attenuation do you need?
>You need to get a clue. Or find someone who has a clue.
I'm not sure this advice helps. ;) The salient problem here seems to be that that the original waveform, before upsampling/filtering/downsampling, *already contains* the "inharmonics" that are resulting in the audible artifact. They are already below the cutoff frequency of the LPF, they are already in the passband, and so they cannot be filtered out. This is why it would be helpful to synthesize the target waveform at a higher sample rate to begin with. Steve
no.spam@gte.net (Scott Gravenhorst) wrote in news:48eb6c45.107255218
@news.verizon.net:

> On 23 Sep 2008 21:57:38 GMT, Scott Seidman > <namdiesttocs@mindspring.com> wrote: > >>no.spam@gte.net (Scott Gravenhorst) wrote in news:48e96146.104440734 >>@news.verizon.net: >> >>> One thing I just realized, when I decimate, I'm merely decimating, >>> i.e., sending every other sample to the DAC. I should be averaging >>> two samples to generate the decimated output. I need to try that
too.
>>> It may not reduce aliasing as much as I want it to, but it will show >>> that I'm on the right track if I can audibly reduce it. >>> >> >> >>No-- you should be applying a digital filter at about 40% of the target >>sample rate, then decimating. > > Ah, ok then, I need to reduce Fc of my filter. I assume that this is > because no digital filter rolls off perfectly. > > Thank you to all involved, I now need to go back to the lab and do > more experiments. > > >
More acurately, averaging two samples does not necessarily have the frequency characteristics you think it does. -- Scott Reverse name to reply
Scott Gravenhorst wrote:

> I realize that this is a naive method for generating a sawtooth and > that bandlimited sawtooth generators can be made,
In particular, note that our naive method of sawtooth generation is not band limited. In effect, you have already generated the alias components at the same time as you generated the sawtooth.
> but this is a test for an alias reducing method.
What you are trying to do here is unscramble an egg. It would be theoretically possible to reduce the alias components by applying a filter that allows through the harmonic components and attenuates the alias components, but I suspect that is too hard for you FPGA. BTW, I am a lurker on the FPGA Synth mailing list. Cheers, Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "Indeed, I am impressed that Google runs an 8,000 node Linux cluster, 5 data centers, an extensive network, and a rapidly evolving application all with a staff of 12." -- http://research.microsoft.com/~gray/papers/FAAMs_HPTS.doc

Steve Pope wrote:


> The salient problem here seems to be that that the original > waveform, before upsampling/filtering/downsampling, > *already contains* the "inharmonics" that are resulting > in the audible artifact. They are already below the cutoff frequency > of the LPF, they are already in the passband, and so they cannot be > filtered out. > > This is why it would be helpful to synthesize the target > waveform at a higher sample rate to begin with.
The problem is known to anyone who dealt with the nonlinear functions in the sampled domain. Oversampling is the brute force way; there are more elegant methods if either the input signal or the nonlinearity can be represented as the analytical functions. VLV
Steve Pope wrote:

> Then you are not seeing any aliaising. For aliasing to happen, > you need either a change in sample rate, or a sampling of > an analog signal.
He isn't sampling an analog signal, but he is sampling a continuous time mathematical expression describing a sawtooth. Hence aliasing. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- The idea that Bill Gates has appeared like a knight in shining armour to lead all customers out of a mire of technological chaos neatly ignores the fact that it was he who, by peddling second-rate technology, led them into it in the first place. - Douglas Adams in Guardian, 25-Aug-95
Vladimir Vassilevsky  <antispam_bogus@hotmail.com> wrote:

>Steve Pope wrote:
>> The salient problem here seems to be that that the original >> waveform, before upsampling/filtering/downsampling, >> *already contains* the "inharmonics" that are resulting >> in the audible artifact. They are already below the cutoff frequency >> of the LPF, they are already in the passband, and so they cannot be >> filtered out.
>> This is why it would be helpful to synthesize the target >> waveform at a higher sample rate to begin with.
>The problem is known to anyone who dealt with the nonlinear functions in >the sampled domain. Oversampling is the brute force way; there are more >elegant methods if either the input signal or the nonlinearity can be >represented as the analytical functions.
Sure, but at this stage the OP needs to identify the source of his problem. This usually means implementing and testing the straightforward solution, prior to looking for elegant approaches. Steve
Erik de Castro Lopo  <nospam@mega-nerd.com> wrote:

>He isn't sampling an analog signal, but he is sampling a >continuous time mathematical expression describing a >sawtooth. Hence aliasing.
I can see this, however I do not consider it correct usage of "aliasing". He is deciding to synthesize a signal that has certain components. At no point did these components "alias" from a higher frequency image anywere in his system. If I have a sample rate of 200 KHz, and synthesize a 20 KHz sine wave, it is a true statement that this sine wave could have been produced by sampling a 380 KHz sine wave, which would then alias down to 20 KHz. However it is nonsense to say my system therefore includes "aliasing". The same argument applies to the OP's situation. There is no aliasing anywhere. Steve
On Wed, 24 Sep 2008 08:40:42 +1000, Erik de Castro Lopo
<nospam@mega-nerd.com> wrote:

>Scott Gravenhorst wrote: > >> I realize that this is a naive method for generating a sawtooth and >> that bandlimited sawtooth generators can be made, > >In particular, note that our naive method of sawtooth generation >is not band limited.
Which is why I chose it.
>In effect, you have already generated the >alias components at the same time as you generated the sawtooth.
Right, the purpose of my practical experiment is to see how well upsample-filter-downsample reduces aliasing and what the realistic parameters are to do that at a "good enough" level. So I asked if 2:1 upsample is enough, and whether an 8 pole Chebyshev is enough. I think the answer to especially the first one is "no". Which is why I am _here_ asking this question of you folks who know more than I do. (c:
>> but this is a test for an alias reducing method. > >What you are trying to do here is unscramble an egg.
Yeah, I know, that's why I said that I want to reduce aliasing knowing that it is impossible to elimate entirely. Inaudible, however, is "good enough".
>It would >be theoretically possible to reduce the alias components by >applying a filter that allows through the harmonic components >and attenuates the alias components, but I suspect that is >too hard for you FPGA.
Because the computational load is too large? That's what I want to know or discover, i.e., if it can't be done because the device isn't fast enough. I will ultimately be using a Spartan-3A DSP 1800, not the Spartan-3E 500.
>BTW, I am a lurker on the FPGA Synth mailing list.
(c; so you've seen some of the whacky stuff I've done...