[music-dsp] Re: [Csnd] lo/hi filter & dc offset hygiene
tolve
tlv at tuna.net
Wed Aug 9 07:46:44 EDT 2000
regarding avoidance of speaker damage from unintentional ultra low
frequencies, and unintentional aliasing, without unduly affecting audible
frequencies, a world of thanks to Erik Spjut <Erik_Spjut at HMC.Edu> for
writing:
>A quick discussion on digital filters:
(snip)
>If I get some free time, I'll generate the files and post them somewhere
>so you can experiment with them and convolve.
>My next sabbatical is the 2001-2002 school year, and if no-one has
>added the necessary FIR and higher-order IIR filter op-codes by then,
>I'll promise to develop them.
(snip)
i've been digging a bit and came up with the enlightening post of 24 may
2000 from xavier dietrich (reprinted in full below my signature) in which
he states:
>I've got the low pass design down though.< (in C)
perhaps this would also be helpful to the expert developers in our midst.
still, for the meantime, someone somewhere must have developed a recipe for
a simple (ha!) csound instrument for these problems. anyone? anyone?
tolve
>Mailing-List: contact csound-help at lists.bath.ac.uk; run by ezmlm
>Precedence: bulk
>X-Mailing-List: csound
>Delivered-To: mailing list csound at lists.bath.ac.uk
>From: "xavier dietrich" <xavier.dietrich at gte.net>
>To: "Gabriel Maldonado" <g.maldonado at agora.stm.it>,
> "Rick Mealey" <rickmealey at netscape.net>
>Cc: "Csound List" <csound at lists.bath.ac.uk>
>Date: Wed, 24 May 2000 20:11:15 -0400
>MIME-Version: 1.0
>X-Priority: 3 (Normal)
>X-MSMail-Priority: Normal
>Importance: Normal
>X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
>Subject: Re: [Csnd] [Re: [Csnd] resonx]
>
>I've done a fair amount of reading on digital filter design and I think I
>can explain what's going on here.
>
>Every digital filter design textbook I've read teaches filter design like
>this...
>
>Chapter 1
>"Here's the math for a first-order filter [insert lots of equations], you'll
>need to specify a pole radius and your preference for a low-pass or high
>pass filter. The pole radius controls the height of the peak in the
>frequency response - this peak is always at either 0 Hz or samplerate/2 Hz.
>This type of filter rolls off at 6 dB/octave."
>
>Chapter 2
>"Here's the math for a second-order filter [insert lots of equations],
>you'll need to specify a pole radius and angle. The pole radius again
>controls the height of the peak in the frequency response. The angle
>controls the frequency at which the peak occurs. This type of filter rolls
>off at 12 dB/octave."
>
>Chapter 3
>"The math for third-order and higher filters is too complicated for anyone
>to figure out so we'll create third-order (and higher) filters by cascading
>first and second-order filters. We can obtain the overall frequency
>response by multiplying the individual frequency responses of the cascaded
>filters. Higher-order filters roll off at 6n dB/octave where n is the
>filter order."
>
>Chapter 4 through the end of the book
>"Here's how to select the pole radii and angles for first and second-order
>filters that we will cascade to create all types of filters - Butterworth,
>Chebychev, Elliptical, blah, blah, blah".
>
>Now that we've all studied digital filter design we can design a filter.
>
>Let's assume that you wish to design a filter with a cutoff frequency of 500
>Hz and steep roll-off of 48 dB/octave. From Chapter 3 we think we can
>cascade four identical second-order filters (each with a cutoff of 500 Hz)
>and achieve the desired result - but this won't work. Each filter will
>attenuate the cutoff frequency by 3dB - the output of out four cascaded
>second-order filters will be down -24 dB at 500 Hz. This is why you get
>that smooth "Gaussian" instead of the brick wall you'd like. This trick is
>to study Chapter 4 and NOT to use identical filters but pick ones with
>different pole angles (cutoff frequencies) and pole radii (bandwidths).
>
>For example (these are for illustrative purposes only!!!):
>
>a1 reson a0,500,100
>a2 reson a1,500,100
>a3 reson a2,500,100
>a4 reson a3,500,100
>
>might produce a frequency response that is reasonably flat around 0 Hz and
>does roll off at 48 dB somewhere above 500 Hz but is somewhat "soft" in the
>middle - like this:
>
>...............
> .....
> .+.. ----- -24 dB
> ...
> .
> .
> .
> .
> .<- slope = -48 dB/octave
> .
> | .
> 500 Hz
>
>However, if we had cascaded these four filters (don't try these in an orc,
>the numbers aren't the ones you'd actually use just illustrating how they
>MIGHT come out)
>
>a1 reson a0,50,250
>a2 reson a1,100,100
>a3 reson a2,350,50
>a4 reson a3,500,10
>
>and assuming we'd selected the kcf's and kbw's properly we'd get the
>following frequency response
>
>.....................
> + ----- -3 dB
> .
> .
> .
> .
> .
> .
> .<- slope = -48 dB/octave
> .
> | .
> 500 Hz
>
>Again the trick is how do we select the right kcf and kbw's for each of the
>four reson opcodes?
>I know how to do this and it's pretty complicated (harder to explain than
>understand).
>
>We could create an opcode, resonxxx [usage: aout resonxxx asig,kcf,order],
>and use it like this:
>
>a4 resonxxx a0,500,8
>
>This will achieve the same results as the previous two examples but now the
>cascading of four second-order filters will be done in the C-code not by the
>orc code (as well as all the calculations needed for various pole radii and
>angles).
>
>I had some off-line discussions with Gabriel about this awhile back - then
>he blew me away with a request for a band-pass filter explanation (Sorry,
>Gabriel, haven't had time to get to that yet).
>
>I've got the low pass design down though.
>
>
>
>
>> -----Original Message-----
>> From: Gabriel Maldonado [mailto:g.maldonado at agora.stm.it]
>> Sent: Monday, May 22, 2000 3:37 AM
>> To: Rick Mealey
>> Cc: Csound List
>> Subject: Re: [Csnd] [Re: [Csnd] resonx]
>>
>>
>> Cool Edit Pro has additional filters called "scientific filters". These
>> filters implement Cutterworth, Chebychev, and Bessel filters in which
>> the order can be choosen by the user. I experimented with Butterworth
>> filters setting the order to 20 or more, and I noticed that the response
>> of bandpass filters is both very flat and very steep at the cutoff
>> edges. It is almost vertical. I expressed wrongly myself when using the
>> term "sigmoid" I intended a "Gaussianoid" response curve:
>> ........
>> .... ....
>> ... ...
>> .. ..
>> ... ...
>> ...... .......
>> .............
>> .................................
>>
>> CSOUND RESONX and CACSCADING BUTTERBP frequency response curve
>>
>>
>>
>>
>> ...........................................
>> .. ..
>> ; '
>> ; '
>> , '
>> .........
>> ....................
>> Cool Edit's high order Butterworth frequency response curve.
>>
>> Gabriel
>>
>>
>>
>>
>> Rick Mealey wrote:
>> >
>> > =====
>> > > Unfortunately, using resonx or cascading more butterbp does not help
>> > to
>> > > produce a bandpass filter with a flat response and a sharp cutoff.
>> > The
>> > > result is always a sigmoid response curve.
>> > =====
>> >
>> > I'm trying (believe me, I'm trying) to visualize a sigmoid as I
>> > write-- it
>> > sounds like you're talking about a graph shape I would have seen over
>> > and over
>> > had I taken calculus in college, which, alas, I didn't. Though I might
>> > have
>> > given that impression, I don't think I was expecting flatness from the
>> > end
>> > result. I was more interested in the cutoff steepness-- as close to a
>> > brick
>> > wall as I could get.
>> >
>> > Thought you'd be curious to know that I had some success in
>> > preliminary
>> > experiments using resonx bandpassing white noise. I hit my own point
>> > of
>> > diminishing returns at inumlayer=6 or 7, after which I noticed no
>> > discernible
>> > cutoff difference in spectrographs generated with Cool Edit. (BTW it
>> > *isn't*
>> > Cool Edit Pro-- it's a crippleware version I got with my Layla card.
>> > So I
>> > don't think I have access to the filters you describe. Anyway I
>> > uninstalled it
>> > and am gravitating to Sound Forge.)
>> >
>> > =====
>> > > I'm still trying to implement a high order bandpass
>> > > butterworth filter as a Csound opcode.
>> > =====
>> >
>> > Brother, I wish you luck. I'm out of my depth when you all start
>> > talking about
>> > programming the actual ugens.
>> >
>> > And I *really* need to put Direct Csound 4.x through its paces, but
>> > that's
>> > been on my To Do list for a while.... -- Rick
>> >
>> > ---------------------------------------------------------------
>> >
>> > There are only two ways to live your life. One as though nothing is a
>> > miracle. The other is as though everything is a miracle.-- Albert
>> > Einstein
>> >
>> > ---------------------------------------------------------------
>> > Get your own FREE, personal Netscape WebMail account today at
>> > http://webmail.netscape.com.
>>
>> --
>> Gabriel Maldonado
>>
>http://web.tiscalinet.it/G-Maldonado
>
>--
>To unsubscribe, send email to csound-unsubscribe at lists.bath.ac.uk
>
>--
>To unsubscribe, send email to csound-unsubscribe at lists.bath.ac.uk
dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/
More information about the music-dsp
mailing list