[PD] band-limited square wave

Miller Puckette mpuckett at man104-1.ucsd.edu
Fri Mar 5 17:36:43 CET 2004


HI all,

There's a discussion of this in chapter 3 of my "book",

http://www.crca.ucsd.edu/~msp/techniques/latest/book-html/

See figure 3.4 for what goes wrong trying to represent a high
frequency square wave in the "obvious" way.

A solution of sorts is in the patch, K05.bandlimited.pd, in the audio
examples in the Pd distribution.

cheers
Miller

On Fri, Mar 05, 2004 at 04:22:09PM -0000, 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 at advalvas.be>
> To: "matthew jones" <m.jones at 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 at advalvas.be>
> > > To: "matthew jones" <m.jones at signal.dra.hmg.gb>
> > > Cc: "PD-List" <pd-list at iem.kug.ac.at>; "Martin Dupras"
> > > <martin.dupras at 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 at 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 at iem.at
> > >>http://iem.at/cgi-bin/mailman/listinfo/pd-list
> > >>
> > >
> > >
> >
> >
> 
> 
> _______________________________________________
> PD-list mailing list
> PD-list at iem.at
> http://iem.at/cgi-bin/mailman/listinfo/pd-list




More information about the Pd-list mailing list