Csound Csound-dev Csound-tekno Search About

Re: Filter clicks

Date1999-02-03 17:03
From"Peter L. Hoekje"
SubjectRe: Filter clicks
J. Drexler wrote:
>I have been trying to set up an instrument in which the filter's
>cutoff-frequency  "tracks" the current note being played, similar to
>keyboard tracking in commercial synthesizers.  When I program a passage 
>which simulates legato, the filter clicks at the beginning of many of
>the notes.  The problem is apparently coming from the filter because
>...

Whenever you start up a filter, there will always be a startup transient.  
Because you are trying to do legato, with a sudden step amplitude for each 
frequency, this problem is exacerbated.  The smoothest response will come if 
you can turn off the old tone and turn on the new one slowly, within the 
context of your legato.  Here's an example, is this the kind of thing you're 
looking for?

peter

;drexler.orc
;Trying to find a problem with J. Drexler's scheme
sr=44100
kr=44100
ksmps=1
nchnls=1

instr 1
; p4=amp, p5=freq, p6=f-table, p7=rise, decay
; p8 = khp/p5
  aenv	linen   p4, p7, p3, p7
  a1	oscil aenv, p5, p6
  a2	tonex a1, p5*p8, 4, 0
	out a2
endin

;drexler.sco
f1 0 2048 10 1
f2 0 2048 10 1 1 1 1 1 1 1 1 1 1 .5 .3 .1

; p4=amp, p5=freq, p6=f-table, p7=rise, decay, p8=khp/p5 for filter 
t120
;First example shows problem: a double-size peak in
;filter output during first cycle, due to filter
;initialization.  Filter khp = p5.
i1 0 1 300000 440 2 0 1
i. 1 1 .	493.9 . .
i. 2 1 .	523.3 . .
i. 3 1 .	493.9 . . 
i. 4 1 .	440 . .
i. 5 1 0 . . . 
s
; Filter at 5th harmonic
i1 0 1 90000 440 2 0 5
i. 1 1 .	493.9 . .
i. 2 1 .	523.3 . .
i. 3 1 .	493.9 . . 
i. 4 1 .	440 . .
i. 5 1 0 . . . 
s
; Try turning the sound on with linen,
; irise = i/p5... better!
i1 0 1 90000 440 2 .00227  5
i. 1 1 .	493.9 . .00202 
i. 2 1 .	523.3 . .00191
i. 3 1 .	493.9 . .00202 
i. 4 1 .	440 . .00227
i. 5 1 0 . . . 
s
; Now try turning down the previous sound
; during new note's attack - best.
i1 0 1.00227 90000 440 2 .00227  5
i. 1 1.00202 .	493.9 . .00202 
i. 2 1.00191 .	523.3 . .00191
i. 3 1.00202 .	493.9 . .00202 
i. 4 1.00227 .	440 . .00227 
i. 5 1 0 . . .
e