Matt, maybe a couple of thought experiments will help here.
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!
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? From the point of the digital samples forward, the system does not know the difference - do you agree? But yet don't you expect the sampling of your square wave to result in aliasing?
Hope this helps.
Larry Troxler
On Fri, 5 Mar 2004, matthew jones wrote:
cheers for replying,
yes, that's all straightforward. BUT - if you _construct_ the signal in the digital domain, it will automatically get those ripples when it goes through the reconstruction filters in the DAC's (they are designed to take out the steps from the sample-and-hold circuitry anyway). you only get aliasing when going from analogue TO digital without applying antialiasing filters before the ADC's.
you get what I'm driving at? ;)
Matt
-=-=-=-=-=-=-=-=-=-=-=-=- http://www.loopit.org/ -=-=-=-=-=-=-=-=-=-=-=-=- ----- Original Message ----- From: "Johannes Taelman" j0@advalvas.be To: "matthew jones" m.jones@signal.dra.hmg.gb Sent: Friday, March 05, 2004 4:22 PM Subject: Re: [PD] band-limited square wave
Hi Matt,
A non-bandlimited square wave will only look like straight squares when viewed in the continue (non-sampled) time-domain. If you'd pass it to an ADC, the ADC would need to brick-wall filter the signal (in the frequency domain) to remove frequency components (harmonics) above half the sampling rate (nyquist frequency). After this filter the square wave will have overshoot and ringing at the edges, which you need to reproduce when synthesizing a digital domain alias-free signal. If you don't, all the harmonics will be wrapped to the spectrum between DC and nyquist frequency.
Filtering after sampling a non-band-limited square wave does not help, since the filter cannot distinguish aliased from non-aliased harmonics.
Perfect bandlimited waveforms can be generated with additive synthesis but this is very expensive. It can be approximated in several ways. I think Tom has written a nice paper on it Check also the music-dsp mailinglist archives where this was/is a frequenct topic.
DSP is can of tricky worms. It's full of approximations involving more complex math processing than immediatly obvious, and trade-offs between quality and cpu usage.
regards,
j#|@
matthew jones wrote:
Hi Johannes,
this is strange. I'm certainly being a dunce, but I can't see how you
can
get aliasing when you're already in the digital domain...?? the DAC's have reconstruction filters so there won't be any aliasing
when
converted to analogue either.....????!!?!?!
any hints/prods appreciated. regards,
Matt
-=-=-=-=-=-=-=-=-=-=-=-=- http://www.loopit.org/ -=-=-=-=-=-=-=-=-=-=-=-=- ----- Original Message ----- From: "Johannes Taelman" j0@advalvas.be To: "matthew jones" m.jones@signal.dra.hmg.gb Cc: "PD-List" pd-list@iem.kug.ac.at; "Martin Dupras" martin.dupras@uwe.ac.uk Sent: Friday, March 05, 2004 3:42 PM Subject: Re: [PD] band-limited square wave
Matt,
None of these methods are band-limited in any sense, and will sound aliased.
Check out Tom Schouten's creb package. I started porting it to win32, some objects work, but continued working other projects before finishing it...
j#|@
matthew jones wrote:
why not an [osc~] or [phasor~] connected to a [>~]? then bandpass
filter?
phasor is probably nicest cos you can change the 'larger than' value linearly to get pulse width modulation.
ideally you want to subtract 0.5 ([-~ 0.5]) from the result and
multiply
by
two ([*~ 2]) to make it a true square wave.
Matt
----- Original Message ----- From: "Martin Dupras" martin.dupras@uwe.ac.uk
Does anyone know how to generate band-limited square waves (or other classi waeforms) in PD?
Thanks.
- martin
PD-list mailing list PD-list@iem.at http://iem.at/cgi-bin/mailman/listinfo/pd-list
PD-list mailing list PD-list@iem.at http://iem.at/cgi-bin/mailman/listinfo/pd-list
-- Larry Troxler -- lt@westnet.com -- Patterson, NY USA --