DSPRelated.com
Forums

Anti Aliasing of Arbitrary Waveforms

Started by Scott Gravenhorst September 23, 2008
On Wed, 24 Sep 2008 11:55:52 -0700 (PDT), zebra
<ezra@eastwestsounds.com> wrote:

> >> Quite honestly, I think doing the above is great in theory, but >> in practice is probably a couple of orders of magnitude more >> difficult than generating a band limited signal to begin with. > >funny, my interpretation of the OP's first question: > >" >What are the common method(s) for preventing aliasing of arbitrary >waveforms generated within a DSP application? >" > >somehow became, "how do i generate a nice bandlimited sawtooth?" (or >whatever); which of course was not really the quesiton at all, but it >is still an interesting one (to me...) > >so i looked > >and found this paper: >http://www.acoustics.hut.fi/dafx08/papers/dafx08_05.pdf
Thank you for that, it looks very interesting.
>, which basically looks at integration of pulse trains. seems rather >straightforward, but requires a final DC filtering stage... > >i also saw these plugins: >http://blop.sourceforge.net/ > >which i have yet to check out really. > >maybe there are some other ideas...? > >thanks > >-zeb

glen herrmannsfeldt wrote:
> > jim wrote: > > (snip) > > > 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. > > I say he does, others disagree...
> > > 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. > > Consider that he took an ideal sawtooth wave,
He explained what he is doing, He has no ideal sawtooth. He has a register that gets incremented every time the the clock strikes and then when it overflows it starts over.
> digitized it, designed > logic to generate the sampled (digitized) result, but didn't do any > low pass filtering. The fact that the sampling is done on paper > or in his mind doesn't make the result any different than done > in an A/D converter.
That may or may not be its way too abstract for me to tell. I can't even begin to attach useful meaning to the statement "he took an ideal sawtooth wave". Did he visit an ideal hardware store? The logic that he designed produces a wave form whose frequency can be controlled in a simple way. As long as he just sets the desired frequency he has no problem with artifacts appearing. It is only when he does something non-linear like sweeping the frequency that he hears a problem. -jim
> > -- glen
----== 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 =---
Scott Gravenhorst <no.spam@gte.net> wrote:

>(Steve Pope) wrote:
>>There is some jargon in this paper that would be nice to know >>what it means -- "subtractive synthesis",
>This one refers to both digital and analog music synthesis methods, it >involves starting with a waveform rich in harmonics, such as sawtooth, >pulse, square or triangle and using filters to remove harmonics as a >way of changing timbre.
Thanks, that one makes sense.
>>and "anti-aliasing oscillator".
>This one is for digital synthesis and refers to any oscillator method >that produces a waveform without harmonics above Nyquist.
I would love to see this one defined formally. Steve
jim wrote:

(snip)

> 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.
I say he does, others disagree...
> 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.
Consider that he took an ideal sawtooth wave, digitized it, designed logic to generate the sampled (digitized) result, but didn't do any low pass filtering. The fact that the sampling is done on paper or in his mind doesn't make the result any different than done in an A/D converter. -- glen
On Sep 24, 2:26 pm, no.s...@gte.net (Scott Gravenhorst) wrote:

> Alternatively, a wavetable can be used (which I believe is what you > were describing) that is constructed with sines up to Nyquist - but > the problem with this and with BLIT is that the number of harmonics > that are below Nyquist depends on the fundamental frequency of the > waveform required. So if the table is constructed to properly > bandlimit the waveform at the highest fundamental frequency that would > ever be produced (this is a musical instrument application), the > wavetable will produce a lackluster sound at low frequencies because > harmonics that should be there because they would be below Nyquist at > the lower fundamental will not be in the table.
A filtering solution might be better, because that better matches the situation in a musical instrument, where harmonic production is limited by the cutoff frequency of the acoustical resonator (since you are talking harmonic overtones, I'm guessing you mean a wind instrument, strings tend to have mistuned overtones due to the fixing of the ends of the strings). For example, a trumpet bell just stops reflecting much energy back into the pipe above a given frequency. It would seem to me that you could put a sawtooth into a filter that modeled the cutoff of the acoustical resonator and get something crudely representative. But yes, usually higher quality synthesis is done with sampled wavetables, often a new one every few notes. Maybe you should get one of today's cheap FPGA eval boards with a few megs of ram or flash? Your sample rates are easily low enough that accessing external memory should be reasonable.
On Wed, 24 Sep 2008 17:45:21 GMT, no.spam@gte.net (Scott Gravenhorst)
wrote:

>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.
Sorry, I meant the DAC. The point is that your post filtering (everything past the waveform generator) has an affect on the signal that you're hearing. Without understanding what the digital post filtering, the DAC processing, and the reconstruction are like, it's hard to opine about what to expect or where the problem might actually be.
> >>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.
If you're right, you should be able to see it in the output waveform with the Oscope. Aliasing is a distortion, it changes the output waveform from what it's supposed to be to something else. If you can hear it, there's a good chance you'll see it on the scope. Being able to see the nature of the change could go a long ways toward understanding where it's coming from and confirming whether it's really aliasing (and how bad and what you might be able to do about it), or some other effect. Since your desired waveform is a simple sawtooth, it should be pretty easy to see distortions. If there are distortions such as ringing, etc., the scope will help to measure the period of the ringing and help analyze whether it's really aliasing or a filter effect or something else.
>>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.
I seem to recall that there are a number of free audio tools around that need nothing more than a sound card to run. Even just sticking a microphone in front of a speaker running your sweep test and looking at the spectrogram will tell CONCLUSIVELY whether what you're seeing is aliasing or something else. It'll also help understand how to fix it. You can get there from here just by using some simple tools that should be economically available (hell, FREE!). Asking people to speculate through teh intarweb without the benefit of any plots, instrumentation, etc., is not a recipe for efficient debug. "It sounds like aliasing" doesn't mean squat, IMHO, fwiw. Eric Jacobsen Minister of Algorithms Abineau Communications http://www.ericjacobsen.org Blog: http://www.dsprelated.com/blogs-1/hf/Eric_Jacobsen.php
On Wed, 24 Sep 2008 16:24:08 -0500, jim <"sjedgingN0sp"@m@mwt.net>
wrote:

> > >glen herrmannsfeldt wrote: >> >> jim wrote: >> >> (snip) >> >> > 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. >> >> I say he does, others disagree... > > > > >> >> > 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. >> >> Consider that he took an ideal sawtooth wave, > >He explained what he is doing, He has no ideal sawtooth. He has a register that >gets incremented every time the the clock strikes and then when it overflows it >starts over. > >> digitized it, designed >> logic to generate the sampled (digitized) result, but didn't do any >> low pass filtering. The fact that the sampling is done on paper >> or in his mind doesn't make the result any different than done >> in an A/D converter. > >That may or may not be its way too abstract for me to tell. I can't even begin >to attach useful meaning to the statement "he took an ideal sawtooth wave". Did >he visit an ideal hardware store? > The logic that he designed produces a wave form whose frequency can be >controlled in a simple way. As long as he just sets the desired frequency he has >no problem with artifacts appearing. It is only when he does something >non-linear like sweeping the frequency that he hears a problem. >
Almost - when the system is producing a high frequency sawtooth (5KHz to 10KHz), if I stop the sweep, I am still able to hear inharmonic partials. At lower frequencies, because the harmonics that fall above Nyquist are quite low in amplitude, these effects are not perceived.
On Wed, 24 Sep 2008 15:16:00 -0700, Eric Jacobsen
<eric.jacobsen@ieee.org> wrote:

>On Wed, 24 Sep 2008 17:45:21 GMT, no.spam@gte.net (Scott Gravenhorst) >wrote: > >>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. > >Sorry, I meant the DAC. The point is that your post filtering >(everything past the waveform generator) has an affect on the signal >that you're hearing. Without understanding what the digital post >filtering, the DAC processing, and the reconstruction are like, it's >hard to opine about what to expect or where the problem might actually >be.
The experiment setup uses a stereo DAC, one channel outputs the raw sawtooth, the other channel outputs the filtered signal (filtered meaning upsample 2:1 to an 8 pole chebyshev filter .5% ripple to a decimater 1:2). I can hear the aliases in both channels. I know why the raw one aliases, I would have thought the filtered one would have reduced that somewhat. From other posts, I'm coming to understand that firstly, my 2:1 upsampling is not enough. Or I could simply clock the waveform generation much faster, lowpass filter and then decimate back to my DAC's output sample rate.
>> >>>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. > >If you're right, you should be able to see it in the output waveform >with the Oscope. Aliasing is a distortion, it changes the output >waveform from what it's supposed to be to something else. If you can >hear it, there's a good chance you'll see it on the scope. Being >able to see the nature of the change could go a long ways toward >understanding where it's coming from and confirming whether it's >really aliasing (and how bad and what you might be able to do about >it), or some other effect.
BTW, In this setup, I have tried using a wavetable with a band limited sawtooth created by adding the sine series up to Nyquist. This does not have the siren/alias effect at all - but it does suffer from a lackluster sound at the low end of the fundamental frequency range.
>Since your desired waveform is a simple sawtooth, it should be pretty >easy to see distortions. If there are distortions such as ringing, >etc., the scope will help to measure the period of the ringing and >help analyze whether it's really aliasing or a filter effect or >something else. > > >>>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. > >I seem to recall that there are a number of free audio tools around >that need nothing more than a sound card to run. Even just sticking >a microphone in front of a speaker running your sweep test and looking >at the spectrogram will tell CONCLUSIVELY whether what you're seeing >is aliasing or something else. It'll also help understand how to fix >it. > >You can get there from here just by using some simple tools that >should be economically available (hell, FREE!). Asking people to >speculate through teh intarweb without the benefit of any plots, >instrumentation, etc., is not a recipe for efficient debug. "It >sounds like aliasing" doesn't mean squat, IMHO, fwiw. > > >Eric Jacobsen >Minister of Algorithms >Abineau Communications >http://www.ericjacobsen.org > >Blog: http://www.dsprelated.com/blogs-1/hf/Eric_Jacobsen.php


> > > >That may or may not be its way too abstract for me to tell. I can't even begin > >to attach useful meaning to the statement "he took an ideal sawtooth wave". Did > >he visit an ideal hardware store? > > The logic that he designed produces a wave form whose frequency can be > >controlled in a simple way. As long as he just sets the desired frequency he has > >no problem with artifacts appearing. It is only when he does something > >non-linear like sweeping the frequency that he hears a problem. > > > > Almost - when the system is producing a high frequency sawtooth (5KHz > to 10KHz), if I stop the sweep, I am still able to hear inharmonic > partials. At lower frequencies, because the harmonics that fall above > Nyquist are quite low in amplitude, these effects are not perceived.
Well then you need to get your story straight. Here is what you wrote earlier "The siren effect is apparent _only_ while the fundamental frequency of the sawtooth is actively changing, not while it is constant." You even emphasized "only". Your set up should be band-limited as long as you keep the increment value below half the size of the register (2^16?). As long as you keep the number of samples per period to >2 it is bandlimited. At your sample rate you probably aren't even going to hear anything unless you have at least 15-20 samples per period as your Nyquist rate is way above what you can hear. When the frequency is not changing there is no reason for any aliasing to occur so it now sounds like what you think your wave generator is doing is not really what it's doing. That is something is not working like you think it is. If it were working properly and the frequency is not changing you should get a note that sounds something like a tinny oboe. -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 22:52:16 GMT, no.spam@gte.net (Scott Gravenhorst)
wrote:

>On Wed, 24 Sep 2008 15:16:00 -0700, Eric Jacobsen ><eric.jacobsen@ieee.org> wrote: > >>On Wed, 24 Sep 2008 17:45:21 GMT, no.spam@gte.net (Scott Gravenhorst) >>wrote: >> >>>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. >> >>Sorry, I meant the DAC. The point is that your post filtering >>(everything past the waveform generator) has an affect on the signal >>that you're hearing. Without understanding what the digital post >>filtering, the DAC processing, and the reconstruction are like, it's >>hard to opine about what to expect or where the problem might actually >>be. > >The experiment setup uses a stereo DAC, one channel outputs the raw >sawtooth, the other channel outputs the filtered signal (filtered >meaning upsample 2:1 to an 8 pole chebyshev filter .5% ripple to a >decimater 1:2). I can hear the aliases in both channels. I know why >the raw one aliases, I would have thought the filtered one would have >reduced that somewhat. From other posts, I'm coming to understand >that firstly, my 2:1 upsampling is not enough. Or I could simply >clock the waveform generation much faster, lowpass filter and then >decimate back to my DAC's output sample rate.
Upsampling, then applying a filter, and then downsampling back to the same rate would not be expected to do much of anything to the signal unless the BW of the filter is smaller than the supported bandwidth of the reduced rate. If you've mentioned where the cutoff frequency is, I missed it. Also, again, the analog reconstruction filter after the DAC is also very important. IIRC you're running the DAC at 200kHz as well? What's the cutoff and characteristic of the analog reconstruction filter? That can make a great deal of difference.
>>>>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. >> >>If you're right, you should be able to see it in the output waveform >>with the Oscope. Aliasing is a distortion, it changes the output >>waveform from what it's supposed to be to something else. If you can >>hear it, there's a good chance you'll see it on the scope. Being >>able to see the nature of the change could go a long ways toward >>understanding where it's coming from and confirming whether it's >>really aliasing (and how bad and what you might be able to do about >>it), or some other effect. > >BTW, In this setup, I have tried using a wavetable with a band limited >sawtooth created by adding the sine series up to Nyquist. This does >not have the siren/alias effect at all - but it does suffer from a >lackluster sound at the low end of the fundamental frequency range.
That's a good data point. With the oscilloscope you might want to compare the waveforms of each case and see the differences. If you can hear the difference, you may well be able to see it in the waveforms and get some clue as to what's going on.
> >>Since your desired waveform is a simple sawtooth, it should be pretty >>easy to see distortions. If there are distortions such as ringing, >>etc., the scope will help to measure the period of the ringing and >>help analyze whether it's really aliasing or a filter effect or >>something else. >> >> >>>>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. >> >>I seem to recall that there are a number of free audio tools around >>that need nothing more than a sound card to run. Even just sticking >>a microphone in front of a speaker running your sweep test and looking >>at the spectrogram will tell CONCLUSIVELY whether what you're seeing >>is aliasing or something else. It'll also help understand how to fix >>it. >> >>You can get there from here just by using some simple tools that >>should be economically available (hell, FREE!). Asking people to >>speculate through teh intarweb without the benefit of any plots, >>instrumentation, etc., is not a recipe for efficient debug. "It >>sounds like aliasing" doesn't mean squat, IMHO, fwiw. >> >> >>Eric Jacobsen >>Minister of Algorithms >>Abineau Communications >>http://www.ericjacobsen.org >> >>Blog: http://www.dsprelated.com/blogs-1/hf/Eric_Jacobsen.php
Eric Jacobsen Minister of Algorithms Abineau Communications http://www.ericjacobsen.org Blog: http://www.dsprelated.com/blogs-1/hf/Eric_Jacobsen.php