1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

decoupling a filter from pitch in a karplus-strong delay line

Discussion in 'REAKTOR' started by meatwalker, Feb 20, 2007.

Thread Status:
Not open for further replies.
  1. meatwalker

    meatwalker Forum Member

    Messages:
    49
    actually looking at it again i think all the diffusion delay does (in steampipe) is delay the entire signal by a variable amount so its not really the same as a filter

    so if i were to put a delay in the feedback line how long would i have to hold it for to get a pitch an octave lower for example (in samples or ms ratio?)
     
  2. meatwalker

    meatwalker Forum Member

    Messages:
    49
    yeah. i guess like i said in the first post the reason i wanted to do it is because being able to put realtime controllable processing in the delay line really changes the character of the sound in much more varied ways than using the same thing after the feedback network) , but almost everything u do will change the pitch, so its not really useful if u are trying to do something melodic.

    i know this contradicts the model of a genuine physical string system but i guess i am not so much interested in that

    well - can you think of any other processing within the feedback network that might produce interesting changes in the sound character *without* screwing up the tuning? :)

    by the way what is "phi-mod"

    i am still very keen to see a demonstration of a fir filter if you are still up for trying to put one together ;)

    thanks again,
     
  3. Chet Singer

    Chet Singer NI Product Owner

    Messages:
    822
    Here's one example. It's a PM string that hits a fret and reflects back when the string is plucked too hard. Moving the location, height, and reflection coefficient of the fret has no effect on the tuning.

    http://www.native-instruments.com/i...y_us&type=0&ulbr=1&plview=detail&patchid=5144

    btw, it uses Yamaha's piecewise-linear method to manually adjust the brightness, sustain time, and pitch of the string at every fourth semitone.
     
  4. Robin Davies

    Robin Davies Forum Member

    Messages:
    280
    Physical Modelling Synthesis.

    http://en.wikipedia.org/wiki/Physical_modelling_synthesis

    Working on it. I fell into a bottomless pit on UI side of things (as usual), but making progress.

    The symmetric 5-tap FIR I mentioned before (the one with 3 dials) should do interesting things, and it will have constant group delay. You'd have to do so tweaking to get sensible control over it, but the basic idea is good, i think.

    5 tap FIR:

    Shorten the delay line by 2 samples.

    delayoutput = knob1*current_sample
    + knob2 * sample[n-1]
    + knob3 * sample[n-2]
    + knob2 * sample[n-3]
    + knob1 * sample[n-4]

    In all likelihood, you should recast the knob1, knob2 and knob3 parameters slighlty. You want 2*knob1+2*knob2+knob3 to be slightly less than one. (knob2 and knob 3 should allow values betwen -1 and 1 (ish).

    Because the weights are symmetric, this filter will have a constant group delay of 2 samples.

    The basic idea: the normal karplus string filter is a one zero low-pass filter. this structure gives you the equivalent of a two zero filter, with fixed group delay (so no tuning problems). If you hook up dials as stated above, control will be a bit non-intuitive, but tweaking should produce interesting (if unpredictable) results.

    Haven't tried it. But something along these lines looks promising.
     
  5. Robin Davies

    Robin Davies Forum Member

    Messages:
    280
    k. I took a look at Steampipe. (finally). Here's the deal. (It's good news).

    I really don't know what a "diffusion delay" is. What I do know about it is that it's the actual delay line (provides fractional sample delay). When the "Diffisuion" is set to zero, you get an allpass filter (like a delay line, but not as colored by comb effects). When "diffussion" is set to non-zero... I don't know what happens. It "diffuses". (Whatever that is). Your guess is as good as mine. At any rate, whatever the magic is, it's probably not related to the "diffusion". Consider the "Diffusion delay" to be equivalent to a delay line.

    Here's the good news. The way steampipe handles tuning of the pipe is that it provides one tuning parameter that affects *all* notes. You tune the instruemnt at A440 using the tuning knob, and then the rest of the notes will be more-or-less in tune. (An Aha! moment occured at this point for me, while I was reading back the implementation).

    You can do this because, of the way the filters in the instrument work when the cutoff frequency changes. You may not know what the phase delay for each of the filters is. But you will know one thing: that whatever the phase delay is, the phase delay *at the cutoff frequency* is constant, even if the cutoff frequency changes. Change the cutoff frequency, and the phase delay *at the cutoff frequency* does not change.

    This property actually does not hold exactly for frequencies other than the cutoff frequency. But it must be (apparently, from reading back steampipe) approximately constant. Approximately constant enough that varying the cutoff frequencies of all the various filters in the steampipe implementatin doesn't change the phase delay enough to significantly change the tuning.

    The relevant control in Steampipe is the SREC control in the Allpass Tune module.

    I would expect some filters to behave better than others in this case. Filters with approximately linear phase delay would do better than filters with wildly non-linear phase delay. A butterworth filter has approximately linear phase delay. Perhaps the "MW" filter in steampipe also has this property. (Try borrowing the entire filter from steampipe and copying it into your ensemble. If it works for steampipe, it will work for a Karplus strong algorithm too).

    Diving a bit deeper, the actual details get a bit more complicated. Steampipe has keyboard tracking adjustments for it's filters, so the relationship given above doesn't really hold. And the digital filters appear to be uncompensated, so the actual cutoff frequency is only a very crude approximation of the cutoff frequency value at the input of the filter. So things are all very approximate.

    But the basic observation that you might be able to get away with one tuning parameter for all notes probably does hold.

    My guess is that one of the following things are true. Either, the "MW filter" has approximately constant group delay" (I would be surprised if it did, but it might). Or, the filters have approximately cosntant gorup delay as long as the cutoff frequenices of the filters are far away from the fundamental frequency of the note that's being played (more likely), and the group delays are approximately constant enough that a single fixed tuning adjustment is good enough. Approximately.

    It would be interesting to put the "MW Filter" in steampipe into the test harness I posted to see what the phase delay does look like.

    So. To summarize: try using one constant tuning parameter, and see if it works well across a wide variety of notes in your instrument. Consider copying the "MW filter" structure from steampipe, becuase, if it works well for a physically modelled pipe, it should work well for a physically modelled string as well.
     
  6. daswesen

    daswesen NI Product Owner

    Messages:
    157
    Thanks for all the details Robin, this is really interesting!
     
  7. Chet Singer

    Chet Singer NI Product Owner

    Messages:
    822
    meatwalker, if you're still interested in this subject, I posted an ensemble to the user library at http://www.nativeinstruments.de/index.php?id=userlibrary_us&type=0&ulbr=1&plview=detail&patchid=5920 which contains a pitch-compensated Karplus-Strong delay line. You'll notice that as you move the Tone slider (which is the cutoff frequency of the loop filter), the pitch remains constant.

    The pitch compensation is performed using piecewise linear interpolations in two dimensions: note number and filter cutoff frequency. It's a brute force approach to the problem, but I don't have the digital filter math to come up with an elegant solution.
     
Thread Status:
Not open for further replies.