filters unit iii

29

Upload: mrecedu

Post on 18-Jan-2015

256 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Filters unit iii
Page 2: Filters unit iii

FilteringFilteringFilteringFiltering• Filtering is another name for Filtering is another name for

subtractive synthesis subtractive synthesis because it subtracts because it subtracts frequencies from a soundfrequencies from a sound

• Filtering is the opposite approach of Filtering is the opposite approach of additive synthesis: additive synthesis: • Additive synthesis builds a complex sound Additive synthesis builds a complex sound

out of sine waves.out of sine waves.• Subtractive synthesis starts with a complex Subtractive synthesis starts with a complex

source sound and removes some of the source sound and removes some of the frequency components. frequency components.

Page 3: Filters unit iii

Sound ExamplesSound ExamplesSound ExamplesSound Examples• Atlantic Brass QuintetAtlantic Brass Quintet• Praetorius, "Introduction" from Praetorius, "Introduction" from TerpsichoreTerpsichore::• 2 trumpets (high)2 trumpets (high)• horn and trombone (medium)horn and trombone (medium)• tuba (low)tuba (low)

• [iv:10][iv:10] original original• [iv:11][iv:11] low-pass filtered low-pass filtered• [iv:12][iv:12] high-pass filtered high-pass filtered• [iv:13][iv:13] band-pass filtered band-pass filtered• [iv:14][iv:14] notch (band-stop) filtered notch (band-stop) filtered• [iv:10][iv:10] original original

Page 4: Filters unit iii

Csound FiltersCsound FiltersCsound FiltersCsound Filters

• Four Main Filter Types:Four Main Filter Types:• Low-pass — Low-pass — tonetone • High-pass — High-pass — atoneatone • Band-pass — Band-pass — resonreson • Notch (Band-stop) — Notch (Band-stop) — aresonareson

Page 5: Filters unit iii

Low-Pass FilterLow-Pass FilterLow-Pass FilterLow-Pass Filter• Very common, probably about 50% of filters Very common, probably about 50% of filters

used in computer music are low-pass.used in computer music are low-pass.

Frequency Response Curve

• power = amppower = amp22; amp = sqrt(power); amp = sqrt(power)• 1/2 power = sqrt(2)/2 amp = ~71% amp1/2 power = sqrt(2)/2 amp = ~71% amp

Page 6: Filters unit iii

Csound Low-Pass Filter (tone)Csound Low-Pass Filter (tone)Csound Low-Pass Filter (tone)Csound Low-Pass Filter (tone)

• synthesized oboesynthesized oboe

[iv:15] original tone261.6 Hertz

[iv:16] low-pass filterat 523.2 Hz

Page 7: Filters unit iii

Csound Low-Pass Filter (tone)Csound Low-Pass Filter (tone)Csound Low-Pass Filter (tone)Csound Low-Pass Filter (tone)

• synthesized oboe with low-pass filtersynthesized oboe with low-pass filter;; p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8

;; startstart durdur ampamp freqfreq attkattk decdec filtfrfiltfr

i10i10 11 3.03.0 1000010000 261.6261.6 .045.045 .15.15 523.2523.2

;ifiltfr=cps of response

afilt tone asig, ifiltfr ;curve's half amp point

afilt2 tone afilt, ifiltfr ;2nd filter =;steeper rolloff

abal balance afilt2, asig ;balance amplitude

Page 8: Filters unit iii

High-Pass FilterHigh-Pass FilterHigh-Pass FilterHigh-Pass Filter• Passes high frequencies, attenuates lows.Passes high frequencies, attenuates lows.• Used to brighten a signal Used to brighten a signal • be careful, can also increase noisebe careful, can also increase noise

• About 20% of filters used in computer music About 20% of filters used in computer music are high-pass.are high-pass.

Frequency Response Curve

Page 9: Filters unit iii

Csound High-Pass Filter (atone)Csound High-Pass Filter (atone)Csound High-Pass Filter (atone)Csound High-Pass Filter (atone)

• synthesized oboesynthesized oboe

[iv:15] original tone261.6 Hertz

[iv:19] high-pass filterat 1046.4 Hz

Page 10: Filters unit iii

Csound High-Pass Filter (atone)Csound High-Pass Filter (atone)Csound High-Pass Filter (atone)Csound High-Pass Filter (atone)

• synthesized oboe with high-pass filtersynthesized oboe with high-pass filter;; p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8

;; startstart durdur ampamp freqfreq attkattk decdec filtfrfiltfr

i10i10 11 3.03.0 1000010000 261.6261.6 .045.045 .15.15 1046.41046.4

;ifiltfr=cps of response

afilt atone asig, ifiltfr ;curve's half amp point

afilt2 atone afilt, ifiltfr ;2nd filter =;steeper rolloff

abal balance afilt2, asig ;balance amplitude

Page 11: Filters unit iii

Band-Pass FilterBand-Pass FilterBand-Pass FilterBand-Pass Filter• Passes band of frequencies, attenuates those Passes band of frequencies, attenuates those

above and below band.above and below band.• Most common in implementations of discrete Most common in implementations of discrete

Fourier transform to separate out harmonics.Fourier transform to separate out harmonics.• About 20% of filters used in computer music About 20% of filters used in computer music

are band-pass.are band-pass.

Frequency Response Curve

Page 12: Filters unit iii

Csound Band-Pass Filter (reson)Csound Band-Pass Filter (reson)Csound Band-Pass Filter (reson)Csound Band-Pass Filter (reson)• Defined by center frequency fDefined by center frequency f00, and bandwidth , and bandwidth

of pass-band = fof pass-band = fhighcutoffhighcutoff - f - flowcutofflowcutoff

• synthesized oboesynthesized oboe

[iv:15] original tone261.6 Hertz

[iv:18] b-pass filterat 523.2 Hz/10 bw

Page 13: Filters unit iii

Csound Band-Pass Filter (reson)Csound Band-Pass Filter (reson)Csound Band-Pass Filter (reson)Csound Band-Pass Filter (reson)

• synthesized oboesynthesized oboe

[iv:19] b-p filter at1046.4 Hz/100 bw

[iv:20] b-p filter at1046.4 Hz/500 bw

Page 14: Filters unit iii

Csound Band-Pass Filter (reson)Csound Band-Pass Filter (reson)Csound Band-Pass Filter (reson)Csound Band-Pass Filter (reson)

• synthesized oboe with band-pass filtersynthesized oboe with band-pass filter;; p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8 p9 p9

;; startstart durdur ampamp freqfreq attkattk decdec filtfr bwfiltfr bw

i10i10 11 3.03.0 1000010000 261.6261.6 .045.045 .15.15 523.2 10523.2 10

i10i10 11 3.03.0 1000010000 261.6261.6 .045.045 .15.15 1046.4 1001046.4 100

i10i10 11 3.03.0 1000010000 261.6261.6 .045.045 .15.15 1046.4 5001046.4 500

;ifiltfr=center freq of

afilt reson asig,ifiltfr,ibw,0 ;the passbandafilt2 reson afilt,ifiltfr,ibw,0 ;steeper rolloff

abal balance afilt2, asig ;balance amplitude

Page 15: Filters unit iii

Band-Stop (Notch) FilterBand-Stop (Notch) FilterBand-Stop (Notch) FilterBand-Stop (Notch) Filter• Stops band of frequencies, passes those Stops band of frequencies, passes those

above and below band.above and below band.• Most common in removing electric hum (50 Most common in removing electric hum (50

Hertz A/C).Hertz A/C).• About 10% of filters used in computer music About 10% of filters used in computer music

are band-stop.are band-stop.

Frequency Response Curve

Page 16: Filters unit iii

Csound Notch Filter (areson)Csound Notch Filter (areson)Csound Notch Filter (areson)Csound Notch Filter (areson)• Defined by center frequency fDefined by center frequency f00, and bandwidth , and bandwidth

of stop-band = fof stop-band = fhighcutoffhighcutoff - f - flowcutofflowcutoff

• pulse wavepulse wave

[iv:21] original tone261.6 Hertz

[iv:22] notch filterat 1046.4 Hz

100 bw

Page 17: Filters unit iii

Csound Notch Filter (areson)Csound Notch Filter (areson)Csound Notch Filter (areson)Csound Notch Filter (areson)• synthesized oboe with notch filtersynthesized oboe with notch filter;; p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8 p9 p9

;; startstart durdur ampamp freqfreq attkattk decdec filtfr bwfiltfr bw

i11i11 11 3.03.0 1000010000 261.6261.6 .045.045 .15.15 1046.4 1001046.4 100

;ifiltfr=center freq of

afilt areson asig,ifiltfr,ibw,1 ;the stopbandafilt2 areson afilt,ifiltfr,ibw,1 ;steeper rolloff

abal balance afilt2, asig ;balance amplitude• NOTE: The fourth argument in areson is NOTE: The fourth argument in areson is

scaling — it must be scaling — it must be 11 (0 default in Csound (0 default in Csound manual doesn't work)manual doesn't work)

Page 18: Filters unit iii

LP FilterLP FilterLP FilterLP Filter

• original synthesized oboe tone 261.6 original synthesized oboe tone 261.6 HertzHertz

[iv:15] 0. unfiltered tone [iv:26] 1. low-pass filter523.2 Hz

Page 19: Filters unit iii

HP and BP FilterHP and BP FilterHP and BP FilterHP and BP Filter

• original synthesized oboe tone 261.6 original synthesized oboe tone 261.6 HertzHertz

[iv:27] 2. high-pass1046.4 Hz

[iv:28] 3. band-pass1046.4 Hz

Page 20: Filters unit iii

Dynamically Changing the Center Dynamically Changing the Center Frequency and BandwidthFrequency and Bandwidth

Dynamically Changing the Center Dynamically Changing the Center Frequency and BandwidthFrequency and Bandwidth

• original synthesized bassoon tone 69 Hzoriginal synthesized bassoon tone 69 Hz• b-pass filter — freq from fundamental to harmonic 15b-pass filter — freq from fundamental to harmonic 15

[iv:23] bassoon at 69 Hz [iv:24] bp filter 69-1035 Hz/bw 15

;; p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13

;; st dur amp frq attk dec flt1 flt2 bw1 bw2 wai gls st dur amp frq attk dec flt1 flt2 bw1 bw2 wai gls

i15 1i15 1 3 9000 69 .23 3 9000 69 .23 .1 69 1035 15 .1 69 1035 15 15 .2 .615 .2 .6

Page 21: Filters unit iii

Dynamically Changing the Center Dynamically Changing the Center Frequency and BandwidthFrequency and Bandwidth

Dynamically Changing the Center Dynamically Changing the Center Frequency and BandwidthFrequency and Bandwidth

• original synthesized bassoon tone 69 Hzoriginal synthesized bassoon tone 69 Hz• band-pass filter — bw moving from 10 to 500band-pass filter — bw moving from 10 to 500

[iv:25] bp filter 276 Hz/bw 10-500 same — first 3 harmonics

;; p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13

;; st dur amp frq attk dec flt1 flt2 bw1 bw2 wai gls st dur amp frq attk dec flt1 flt2 bw1 bw2 wai gls

i15 1i15 1 10 9000 69 .23 10 9000 69 .23 .1 276 276 10 .1 276 276 10 500 .2 .6500 .2 .6

Page 22: Filters unit iii

Dynamically Changing the Center Dynamically Changing the Center Frequency and BandwidthFrequency and Bandwidth

Dynamically Changing the Center Dynamically Changing the Center Frequency and BandwidthFrequency and Bandwidth

• In the Csound manual:In the Csound manual:

ar tone asig, khp[,istor] ;l-pass

ar atone asig, khp[,istor] ;h-pass

ar reson asig, kcf,kbw[,iscale,istor] ;b-pass

ar areson asig, kcf,kbw[iscale,istor];notch

• Default is 0 for iscale and istorDefault is 0 for iscale and istor

• NOTE: Make sure that NOTE: Make sure that iscaleiscale is is 11 if using if using the the aresonareson notch filter, as Csound notch filter, as Csound doesn't work properly with the 0 defaultdoesn't work properly with the 0 default

Page 23: Filters unit iii

Dynamically Changing the Center Dynamically Changing the Center Frequency and BandwidthFrequency and Bandwidth

Dynamically Changing the Center Dynamically Changing the Center Frequency and BandwidthFrequency and Bandwidth

• We can change the half-power, the center We can change the half-power, the center frequency and the bandwidth at the k-rate frequency and the bandwidth at the k-rate using linseg statementsusing linseg statements

• original synthesized bassoon tone 69 Hzoriginal synthesized bassoon tone 69 Hz• b-pass filter — freq from fundamental to harmonic 15b-pass filter — freq from fundamental to harmonic 15

kflfr linseg 69, idur, 1035 ;linseg for centerafilt reson asig,kflfr,ibw,0 ;freq of the

passband• band-pass filter — bandwidth moving from 10 to 500band-pass filter — bandwidth moving from 10 to 500

kbw linseg 10, idur, 500 ; linseg for bandwidth

afilt reson asig,iflfr,kbw,0 ; of the passband

Page 24: Filters unit iii

Dynamically Changing the Center Dynamically Changing the Center Frequency and BandwidthFrequency and Bandwidth

Dynamically Changing the Center Dynamically Changing the Center Frequency and BandwidthFrequency and Bandwidth

• a musical example: oboe, Bach, a musical example: oboe, Bach, Fugue #2 in C MinorFugue #2 in C Minor• [iv:29][iv:29] no filter no filter

• [iv:30][iv:30] lp filter, 55 -> 160 Hertz lp filter, 55 -> 160 Hertz • [iv:31][iv:31] bp filter, 220 -> 7040 Hertz, bw 1 bp filter, 220 -> 7040 Hertz, bw 1 • [iv:32][iv:32] bp filter, 220 -> 7040 Hertz, bw 1 -> 100 bp filter, 220 -> 7040 Hertz, bw 1 -> 100

Page 25: Filters unit iii

[iv:33][iv:33] Hiss and Hum Hiss and Humcompare with compare with [iv:34][iv:34] 60 Hertz sine wave 60 Hertz sine wave

[iv:33][iv:33] Hiss and Hum Hiss and Humcompare with compare with [iv:34][iv:34] 60 Hertz sine wave 60 Hertz sine wave

• hiss hiss • high frequency noise you hear on cassette tapes high frequency noise you hear on cassette tapes • unfocused — not just a single frequency unfocused — not just a single frequency • which kind of filter can you use to get rid of it? which kind of filter can you use to get rid of it?

• hum hum • the noise you hear from machinery (such as lights the noise you hear from machinery (such as lights

and computers) and computers) • focused frequency, same as the local electrical focused frequency, same as the local electrical

power power • which kind of filter can you use to get rid of it? which kind of filter can you use to get rid of it?

Page 26: Filters unit iii

Filtered NoiseFiltered Noisewith Band-Pass Filterswith Band-Pass Filters

Filtered NoiseFiltered Noisewith Band-Pass Filterswith Band-Pass Filters

[iv:35] noise with bp filter at 1046.4 Hz/bw 1% of filter freq

;; p2p2 p3p3 p4p4 p5 p6 p7 p8p5 p6 p7 p8

;; startstart durdur ampamp freq freq attk dec attk dec bwbw

i16i16 11 55 40004000 1046.4 21046.4 2 2.5 2.5 .01.01

Page 27: Filters unit iii

Filtered NoiseFiltered Noisewith Band-Pass Filterswith Band-Pass Filters

Filtered NoiseFiltered Noisewith Band-Pass Filterswith Band-Pass Filters

• [iv:36][iv:36] a musical example: Ayers, a musical example: Ayers, Companion Companion of Strange Intimaciesof Strange Intimacies

Page 28: Filters unit iii

Filtered NoiseFiltered Noisewith Band-Pass Filterswith Band-Pass Filters

Filtered NoiseFiltered Noisewith Band-Pass Filterswith Band-Pass Filters

;noiseflt.orc

instr 16 ; noise filteridur = p3iamp = p4ifilfr = p5 ;filter frequencyiattack = p6idecay = p7ibw = p8 * ifreq ;max bandwidth for

filter

isus = idur - iattack - idecay

Page 29: Filters unit iii

kenv linseg 0,iattack,1,isus,1,idecay,0,1,0 ;ampenv

knenv = kenv * iamp ;env for noise sourceanoise rand knenv ;noise source

;filter the noise source at ifreqafilt reson anoise,ifreq,ibw*kenv,0,0

abal balance afilt, anoise ;balance amplitude out abal ;OUTPUT asig

here endin

Filtered NoiseFiltered Noisewith Band-Pass Filterswith Band-Pass Filters

Filtered NoiseFiltered Noisewith Band-Pass Filterswith Band-Pass Filters