[PD] band-limited square wave
j0 at advalvas.be
Mon Mar 8 17:46:24 CET 2004
matthew jones wrote:
> interesting arguments larry.
> But you're definitely wrong....! ;)
> how amusing.
>>For the next experiment, imagine that you are sampling a non-filtered
>>square wave through an ADC. In other words, there is no anti-aliasing
>>filter in place. What do you expect the digitized samples to look like in
>>this case? Would they not be exactly the same as a square wave constructed
>>entirely in the digital domain?
> well, this is where aliasing will occur. aliasing MEANING more than one
> analogue signal will give rise to the observed digital signal.
strange definition of aliasing
> aliasing is
> MEANINGLESS if you're already in the digital domain. it refers to going
> from a high bandwidth to a lower bandwidth.
>>The reconstruction filters in an DAC are there to remove all analogue
>>frequency content above nyquist, without affecting the frequency content
>>So, yes it would ripple, but not in the right way.
> no, this would be in the right way! the ripples are due to filtering out all
> above Nyquist as you say, which is what we want...!!! that IS naturally
The signal after the DAC will indeed be bandlimited to nyquist.
But the signal in the digital domain (generated with >~ or something
similar) allready contains all harmonics (including the ones higher than
nyquist) wrapped to below nyquist.
>>A bandwith-limited square digital osc sould give the same output as
>>ADC'ing a squarly analog square wave. So antialiasing filters are
> ?? what ?? sorry, don't get u
The output from a digital squarewave osc should be no different than
what you get from sampling an analogue squarewave with an ADC (including
its brickwall low-pass filter).
>>And it's not the only way to get aliasing: nonlinearities (waveshaping),
>>all kinds of modulation (fm, am,...), and much more.
>>Digital sine oscillators and digital filters are bandwith-limited by
>>First, set your sampling rate to 44100Hz. Now take a digital sine
>>oscillator, say [osc~] in PD and set its frequency to 30000Hz.
>>What do you expect to hear from the DAC? A sine wave at 30000Hz, even
>>though that frequency is higher than fs/2? No, you will in fact here
>>an aliased sine at 14100Hz - do you agree. But wait, we constructed this
>>signal entirely in the digital domain, and yet we have aliasing!
> well, in DSP terminology, this isn't aliasing.
Sorry Matt, I disagree with your DSP terminology.
> of course in the digital
> domain you can't synthesise ANYTHING higher than nyquist, it's impossible.
But if you do not prevent synthesising anything higher than nyquist, it
will be wrapped to a frequency below nyquist. This is aliasing.
> if your own code runs functions that attempt to do that, but end up doing
> something else (ie return numbers that represent tones that have the same
> reflected frequency as the equivalent aliased signals) then that function is
> not producing aliased outputs, but correctly generating frequencies that are
> lower than YOU intended.
Huh? What's correct about generating a frequency that is lower than
> again, aliasing only applies to going from high
> bandwidth to low bandwidth, so if you're sample rate hasn't changed, you're
> not getting aliasing.
> this is getting pedantic, I can see what you're getting at but at the end of
> the day:-
> constructing a bunch of numbers in the digital domain cannot produce
> 'aliased' outputs because the bandwidth has not changed.
> will 'perfectly' bandlimit the output (although perfect sinc functions are
> impossible) everytime.
yes, but the evil aliasing happens before the bandlimiting at the DAC,
and it does not cancel the aliases.
How about a reality check with PD? (to stay on-topic)
Here's a non-band-limited square wave oscillator:
Now vary the frequency with the number box around 2000Hz with your
mouse. You can hear the aliased components. They carry no harmonic
relationship with fundamental frequency. Some are going up as the
frequency goes up (but at a higher rate), some going down as the
frequency goes up. I think this aliasing sound effect is called "birdies".
Do you hear them?
More information about the Pd-list