On 7/23/12 4:52 AM, Oli Larkin wrote:
Can anyone here advise me how I can precisely compensate for pitch dependant
detuning when my damping filter is active in a tuned comb filter? I'm trying to
implement a damping control that doesn't alter the fundamental frequency of the
comb filter. I'm not concerned with modelling the exact behaviour of a string -
I just want to have precisely tuned resonances with adjustable damping. So far
I have implemented tuning compensation by adding an offset to the comb
frequency, however I have just worked out an approximate fudge-factor which is
scaled based on the value of the damping control and the fundamental frequency.
I have thought about using a linear phase FIR as the damping filter, but I
think it would be too CPU heavy and hard to modulate the damping.
At the moment I use basic linear interpolation for the comb filter with a 1P
LPF in the feedback loop.
Here is the code for the filter:
lpfOutM1 = lpfOutM1 + clip(lpfcoeff, 0., 1.) * (input - lpfOutM1);
So my problem is how to mathematically calculate the phase delay of this LPF at
the comb filter's fundamental, in order to adjust the delay length accordingly.
the issue is further described here:
http://www.native-instruments.com/forum/showthread.php?t=46491
i didn't read through that NI list from 2005.
you can use an all-pass filter to add a controllable about of phase
delay to a particular frequency of interest. usually this frequency of
interest is the intended fundamental frequency of the note. what you
want (and all you can get with a single 1st-order APF) is too get the
entire loop delay in the karplus-strong alg to be precisely the period
length (expressed in precise fractional samples). that will insure that
the fundamental is tuned to what you want it to me. you have to do some
"time-management", some delay is the integer-sample delay from the delay
line (you have control of that, but only integer control), add to that
the delay of the damping filter (which you do not have control of, the
damping degree is another control and you have to accept whatever phase
delay you get outa it), and the APF (which you control specifically to
get the loop delay to add up to what you want). don't forget the
implicit 1-sample delay you get with feedback.
the other harmonics will be a little bit detuned. that might sound
interesting, but if you want to used karplus-strong and to get all the
harmonics well tuned, you will need to draw multiple taps offa the delay
line just like a precision delay algorithm, and your damping filter has
to be linear phase (FIR). that's the way to get all of the harmonics to
be perfectly harmonic.
if this sounds like it's barking up the correct tree for you, we can
talk about how to implement it. the APF will need a two-variable
control function where the target frequency and target fractional delay
are the input and what comes out is the APF coefficient. you might have
to generate a 2-dim lookup table, or maybe some low-order polynomials
can be figgered out. do you have MATLAB or Octave or something that
let's you fiddle with math?
--
r b-j r...@audioimagination.com
"Imagination is more important than knowledge."
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp