DSPRelated.com
Forums

Anti Aliasing of Arbitrary Waveforms

Started by Scott Gravenhorst September 23, 2008
On Tue, 23 Sep 2008 17:35:02 GMT, no.spam@gte.net (Scott Gravenhorst)
wrote:

>What are the common method(s) for preventing aliasing of arbitrary >waveforms generated within a DSP application? 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. 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. 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? > >I looked a windowed sinc filters, but I also read that Chebyshev is >supposed to be quite good, but with much lower computational needs. > >Many thanks.
Holy jeebuz. I just went through this whole thread and am a bit surprised. A few thoughts, for what they're worth: 1. The phase-accumulation thingie you're using to generate the saw-tooth waveform isn't naive, it's a perfectly fine and time-tested way to do it. 2. You haven't said much (well, probably not enough) about your reconstruction filters. i.e., if you could expand a bit on the digital filtering you're doing prior to the ADC, the architecture of the ADC (whether it's sigma-delta, and any internal processing it might be doing), and the characteristics of your analog reconstruction filter. All of this stuff matters and may have a substantial effect on the output waveform. 3. Do you have an oscilloscope? If not, GET ONE. Hook it up to your output signal and see whether it's a nice, clean sawtooth or not. Synch it up to a falling edge and do the frequency sweep that you think causes the 'siren' effect. If it's really aliasing you'll probably be able to see it in the output waveform. 4. If you have an audio spectrum analyzer (or a spectrum analyzer with audio capability), hook it up to your output and see what you can see. It's not that difficult to put your desired, generated waveform into some analytical tool and look at the spectrogram of a few periods of the waveform, and then look at a spectrogram of the output. If it's aliasing it'll be plain as day. If it's something else, it'll probably be a lot easier to sort that out, too. This shouldn't be a difficult problem at all. Handwaving over typed descriptions is about the most frustrating way to debug something that I've come across, especially if you haven't bothered to instrument the output with anything but your ear. Hope that helps a little bit. Eric Jacobsen Minister of Algorithms Abineau Communications http://www.ericjacobsen.org Blog: http://www.dsprelated.com/blogs-1/hf/Eric_Jacobsen.php
On Tue, 23 Sep 2008 17:35:02 GMT, no.spam@gte.net (Scott Gravenhorst)
wrote:

>What are the common method(s) for preventing aliasing of arbitrary >waveforms generated within a DSP application? 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. 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. 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? > >I looked a windowed sinc filters, but I also read that Chebyshev is >supposed to be quite good, but with much lower computational needs. > >Many thanks.
Holy jeebuz. I just went through this whole thread and am a bit surprised. A few thoughts, for what they're worth: 1. The phase-accumulation thingie you're using to generate the saw-tooth waveform isn't naive, it's a perfectly fine and time-tested way to do it. 2. You haven't said much (well, probably not enough) about your reconstruction filters. i.e., if you could expand a bit on the digital filtering you're doing prior to the ADC, the architecture of the ADC (whether it's sigma-delta, and any internal processing it might be doing), and the characteristics of your analog reconstruction filter. All of this stuff matters and may have a substantial effect on the output waveform. 3. Do you have an oscilloscope? If not, GET ONE. Hook it up to your output signal and see whether it's a nice, clean sawtooth or not. Synch it up to a falling edge and do the frequency sweep that you think causes the 'siren' effect. If it's really aliasing you'll probably be able to see it in the output waveform. 4. If you have an audio spectrum analyzer (or a spectrum analyzer with audio capability), hook it up to your output and see what you can see. It's not that difficult to put your desired, generated waveform into some analytical tool and look at the spectrogram of a few periods of the waveform, and then look at a spectrogram of the output. If it's aliasing it'll be plain as day. If it's something else, it'll probably be a lot easier to sort that out, too. This shouldn't be a difficult problem at all. Handwaving over typed descriptions is about the most frustrating way to debug something that I've come across, especially if you haven't bothered to instrument the output with anything but your ear. Hope that helps a little bit. Eric Jacobsen Minister of Algorithms Abineau Communications http://www.ericjacobsen.org Blog: http://www.dsprelated.com/blogs-1/hf/Eric_Jacobsen.php
On Tue, 23 Sep 2008 17:35:02 GMT, no.spam@gte.net (Scott Gravenhorst)
wrote:

>What are the common method(s) for preventing aliasing of arbitrary >waveforms generated within a DSP application? 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. 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. 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? > >I looked a windowed sinc filters, but I also read that Chebyshev is >supposed to be quite good, but with much lower computational needs. > >Many thanks.
Holy jeebuz. I just went through this whole thread and am a bit surprised. A few thoughts, for what they're worth: 1. The phase-accumulation thingie you're using to generate the saw-tooth waveform isn't naive, it's a perfectly fine and time-tested way to do it. 2. You haven't said much (well, probably not enough) about your reconstruction filters. i.e., if you could expand a bit on the digital filtering you're doing prior to the ADC, the architecture of the ADC (whether it's sigma-delta, and any internal processing it might be doing), and the characteristics of your analog reconstruction filter. All of this stuff matters and may have a substantial effect on the output waveform. 3. Do you have an oscilloscope? If not, GET ONE. Hook it up to your output signal and see whether it's a nice, clean sawtooth or not. Synch it up to a falling edge and do the frequency sweep that you think causes the 'siren' effect. If it's really aliasing you'll probably be able to see it in the output waveform. 4. If you have an audio spectrum analyzer (or a spectrum analyzer with audio capability), hook it up to your output and see what you can see. It's not that difficult to put your desired, generated waveform into some analytical tool and look at the spectrogram of a few periods of the waveform, and then look at a spectrogram of the output. If it's aliasing it'll be plain as day. If it's something else, it'll probably be a lot easier to sort that out, too. This shouldn't be a difficult problem at all. Handwaving over typed descriptions is about the most frustrating way to debug something that I've come across, especially if you haven't bothered to instrument the output with anything but your ear. Hope that helps a little bit. Eric Jacobsen Minister of Algorithms Abineau Communications http://www.ericjacobsen.org Blog: http://www.dsprelated.com/blogs-1/hf/Eric_Jacobsen.php
On Tue, 23 Sep 2008 17:35:02 GMT, no.spam@gte.net (Scott Gravenhorst)
wrote:

>What are the common method(s) for preventing aliasing of arbitrary >waveforms generated within a DSP application? 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. 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. 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? > >I looked a windowed sinc filters, but I also read that Chebyshev is >supposed to be quite good, but with much lower computational needs. > >Many thanks.
Holy jeebuz. I just went through this whole thread and am a bit surprised. A few thoughts, for what they're worth: 1. The phase-accumulation thingie you're using to generate the saw-tooth waveform isn't naive, it's a perfectly fine and time-tested way to do it. 2. You haven't said much (well, probably not enough) about your reconstruction filters. i.e., if you could expand a bit on the digital filtering you're doing prior to the ADC, the architecture of the ADC (whether it's sigma-delta, and any internal processing it might be doing), and the characteristics of your analog reconstruction filter. All of this stuff matters and may have a substantial effect on the output waveform. 3. Do you have an oscilloscope? If not, GET ONE. Hook it up to your output signal and see whether it's a nice, clean sawtooth or not. Synch it up to a falling edge and do the frequency sweep that you think causes the 'siren' effect. If it's really aliasing you'll probably be able to see it in the output waveform. 4. If you have an audio spectrum analyzer (or a spectrum analyzer with audio capability), hook it up to your output and see what you can see. It's not that difficult to put your desired, generated waveform into some analytical tool and look at the spectrogram of a few periods of the waveform, and then look at a spectrogram of the output. If it's aliasing it'll be plain as day. If it's something else, it'll probably be a lot easier to sort that out, too. This shouldn't be a difficult problem at all. Handwaving over typed descriptions is about the most frustrating way to debug something that I've come across, especially if you haven't bothered to instrument the output with anything but your ear. Hope that helps a little bit. Eric Jacobsen Minister of Algorithms Abineau Communications http://www.ericjacobsen.org Blog: http://www.dsprelated.com/blogs-1/hf/Eric_Jacobsen.php
On Tue, 23 Sep 2008 17:35:02 GMT, no.spam@gte.net (Scott Gravenhorst)
wrote:

>What are the common method(s) for preventing aliasing of arbitrary >waveforms generated within a DSP application? 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. 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. 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? > >I looked a windowed sinc filters, but I also read that Chebyshev is >supposed to be quite good, but with much lower computational needs. > >Many thanks.
Holy jeebuz. I just went through this whole thread and am a bit surprised. A few thoughts, for what they're worth: 1. The phase-accumulation thingie you're using to generate the saw-tooth waveform isn't naive, it's a perfectly fine and time-tested way to do it. 2. You haven't said much (well, probably not enough) about your reconstruction filters. i.e., if you could expand a bit on the digital filtering you're doing prior to the ADC, the architecture of the ADC (whether it's sigma-delta, and any internal processing it might be doing), and the characteristics of your analog reconstruction filter. All of this stuff matters and may have a substantial effect on the output waveform. 3. Do you have an oscilloscope? If not, GET ONE. Hook it up to your output signal and see whether it's a nice, clean sawtooth or not. Synch it up to a falling edge and do the frequency sweep that you think causes the 'siren' effect. If it's really aliasing you'll probably be able to see it in the output waveform. 4. If you have an audio spectrum analyzer (or a spectrum analyzer with audio capability), hook it up to your output and see what you can see. It's not that difficult to put your desired, generated waveform into some analytical tool and look at the spectrogram of a few periods of the waveform, and then look at a spectrogram of the output. If it's aliasing it'll be plain as day. If it's something else, it'll probably be a lot easier to sort that out, too. This shouldn't be a difficult problem at all. Handwaving over typed descriptions is about the most frustrating way to debug something that I've come across, especially if you haven't bothered to instrument the output with anything but your ear. Hope that helps a little bit. Eric Jacobsen Minister of Algorithms Abineau Communications http://www.ericjacobsen.org Blog: http://www.dsprelated.com/blogs-1/hf/Eric_Jacobsen.php
jim  <"sjedgingN0sp"@m@mwt.net> wrote:

>Scott Gravenhorst wrote:
>> I know I cannot completely eliminate the aliasing, >> but I was thinking that I might be able to reduce it to an acceptable >> level by upsampling (and interpolating) the naive signal, filtering >> while upsampled and then decimating the filter's output.
> No that won't help. The best that will do is nothing - the > worst would be to add more aliasing.
> It still isn't clear to me how you get your signal, but that > is probably where you need to look for a solution. Starting > with a high sample rate and then filtering and decimating may > help. Upsampling an already affected signal and then downsampling > is pointless.
I fully agree with Jim. The artifacts if as described cannot be filtered out of this signal, since they are already in the passband the moment the signal is created. Steve
On Sep 23, 7:07 pm, no.s...@gte.net (Scott Gravenhorst) wrote:

> >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
> >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".
You don't seem to have though through what you are trying to achieve. The high frequency components come from the single-sample step "reset" of the saw tooth. You don't need to upsample to fix that, you simply need to pass your signal through a low pass filter that will round off and thus band limit that step transition. Another option that may give slightly better results is to generate your signal at a higher sample rate, low pass filter it to notably below the nyquist limit of your desired sample rate (again, band limiting that step transition), and then decimate.
On Wed, 24 Sep 2008 10:06:15 -0700 (PDT), cs_posting@hotmail.com
wrote:

>On Sep 23, 7:07 pm, no.s...@gte.net (Scott Gravenhorst) wrote: > >> >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 > >> >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". > >You don't seem to have though through what you are trying to achieve.
Or I haven't the vocabulary to properly describe it. I am not degreed, so I don't have that benefit, but I do appreciate what people are saying here.
>The high frequency components come from the single-sample step "reset" >of the saw tooth.
Yes, I get that. In fact, I've read about using BLIT to band limit the waveform acceptably. However - I won't necessarily be using a waveform that is easily constructed with BLIT.
>You don't need to upsample to fix that, you simply need to pass your >signal through a low pass filter that will round off and thus band >limit that step transition.
I will be looking into this as well.
>Another option that may give slightly better results is to generate >your signal at a higher sample rate, low pass filter it to notably >below the nyquist limit of your desired sample rate (again, band >limiting that step transition), and then decimate.
Which is probably where ultimately I'm headed (for this experiment). If I cannot get "good enough" results (i.e., where the alias components are at such a low amplitude compared to the desired harmonics that they are not audibly perceived), then I will have to investigate BLIT, or perhaps additive synthesis with sines, both of which have their own challenges.

Eric Jacobsen wrote:

> 2. You haven't said much (well, probably not enough) about your > reconstruction filters. i.e., if you could expand a bit on the > digital filtering you're doing prior to the ADC, the architecture of > the ADC (whether it's sigma-delta, and any internal processing it > might be doing), and the characteristics of your analog reconstruction > filter. All of this stuff matters and may have a substantial effect > on the output waveform.
You seem to be under the impression that the OP has an anolog signal he is sampling. I thought he made it clear in the first post he does not. He said: "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? " As far as I can tell he is just adding increments to a storage register and when it overflows it starts over. The pitch of his waveform varies with the size of increment added. It isn't clear if he "samples" this register after each addition or if he samples it at some n number of iterations or at some fixed interval of time. He has been very vague and unclear about describing the actual process. -jim ----== Posted via Pronews.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.pronews.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= - Total Privacy via Encryption =---
On Wed, 24 Sep 2008 09:49:22 -0700, Eric Jacobsen
<eric.jacobsen@ieee.org> wrote:

>On Tue, 23 Sep 2008 17:35:02 GMT, no.spam@gte.net (Scott Gravenhorst) >wrote: > >>What are the common method(s) for preventing aliasing of arbitrary >>waveforms generated within a DSP application? 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. 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. 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? >> >>I looked a windowed sinc filters, but I also read that Chebyshev is >>supposed to be quite good, but with much lower computational needs. >> >>Many thanks. > > >Holy jeebuz. I just went through this whole thread and am a bit >surprised. > >A few thoughts, for what they're worth: > >1. The phase-accumulation thingie you're using to generate the >saw-tooth waveform isn't naive, it's a perfectly fine and time-tested >way to do it.
I use "naive" only in the sense that it's known to have an infinite series of harmonics and any that are beyond Nyquist will fold back below Nyquist when the waveform is sampled.
>2. You haven't said much (well, probably not enough) about your >reconstruction filters. i.e., if you could expand a bit on the >digital filtering you're doing prior to the ADC, the architecture of >the ADC (whether it's sigma-delta, and any internal processing it >might be doing), and the characteristics of your analog reconstruction >filter. All of this stuff matters and may have a substantial effect >on the output waveform.
There is no ADC used at all. The sawtooth waveform is being generated by arithmetic within the FPGA, basically it's just a counter that wraps on overflow. It's an audio synthesizer experiment, for music which is why I am concerned about eliminating aliased harmonics.
>3. Do you have an oscilloscope? If not, GET ONE. Hook it up to your >output signal and see whether it's a nice, clean sawtooth or not. >Synch it up to a falling edge and do the frequency sweep that you >think causes the 'siren' effect. If it's really aliasing you'll >probably be able to see it in the output waveform.
I have an Oscope, and I am using it. I will play around with sync to determine if I can see it, but I am quite sure that what I am hearing is aliasing. Both because of the siren effect (which goes up and down cyclically when sweeping the fundamental in one direction) and if I stop the sweep, It will likely produce an inharmonic partial in addition to the "sawtooth". The effect is more pronounced as the fundamental frequency is increased (because at low fundamentals, more of the harmonics above Nyquist are at an amplitude below perception, but as the fundamental is increased, the harmonics that are above Nyquist become more perceptible). Additionally, more careful listening reveals that what I hear is not just one siren, but many, noncoordinated sirens indicating that I can hear the higher amplitude harmonics (plural) that are beyond Nyquist folding back below Nyquist. If I suppress bass response of the monitor, it's even more apparent.
>4. If you have an audio spectrum analyzer (or a spectrum analyzer >with audio capability), hook it up to your output and see what you can >see. It's not that difficult to put your desired, generated waveform >into some analytical tool and look at the spectrogram of a few periods >of the waveform, and then look at a spectrogram of the output. If >it's aliasing it'll be plain as day. If it's something else, it'll >probably be a lot easier to sort that out, too.
That would be great - and I would do it if I had such a tool. However, this is a (ahem) "hobby" project for me, so budget is limited to what reality supports for me.
>This shouldn't be a difficult problem at all. Handwaving over typed >descriptions is about the most frustrating way to debug something that >I've come across, especially if you haven't bothered to instrument the >output with anything but your ear. > >Hope that helps a little bit. > >Eric Jacobsen >Minister of Algorithms >Abineau Communications >http://www.ericjacobsen.org > >Blog: http://www.dsprelated.com/blogs-1/hf/Eric_Jacobsen.php