| Helpful Links and Info |
|
|
Forum Rules & FAQ
New to the forums? Read this to learn the basics:
|
Helpful Resources
Need help with a product? Please check these pages:
|
|
|
|
|
 |
|

20-02-2007, 07:08
|
|
Forum Member
|
|
|
Join Date: Jul 2006
Posts: 49
|
|
|
decoupling a filter from pitch in a karplus-strong delay line
hi. i notice that if i put a filter in a karpus-strong delay line it alters the pitch. i know why it happens since a lowpass is at the basis of the algorithim. i don't really understand how the tuning works within the karplus-strong but is it possible to decouple a filter from pitch with out getting into too much detail?
im asking cause synths like steampipe have interesting controls like the allpass filter and the lo and hi passes in the delay line but its difficult actually use these in a melodic passage because they make the synth go out of tune.
what would be a method to decouple these filters from the pitch? the only thing that i thought is if i could predict how much the filter would alter the pitch i could pass it through a module to tune it back corrospondingly. any hints on how this could be done or other there any other methods or resources u can suggest??
thanku
|

20-02-2007, 11:52
|
|
NI Product Owner
|
|
Join Date: Jul 2005
Posts: 617
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
In KS, the pitch depends on the length of the delay line. Filters introduce phase delay - in effect this alters the length of the delay line in turn altering the pitch.
|

20-02-2007, 14:16
|
|
Forum Member
|
|
Join Date: Oct 2006
Posts: 280
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
A digital filter introduces a slight delay. Usually, the delay is described in terms of "phase delay" (delay in terms of phase shift for a particular reference frequency). For your purposes, you would be interested in the delay in samples (which will also be a function of frequency).
You *can* compensate for the delay introduced by the filter. But it will require some heavy math lifting, because most of the existing literature is concerned more with phase delay rather than absolute delay. I'm not sure can think of an easy off-the-shelf way to calculate what the delay would be.
I can suggest a general approach to try (with no guarantee that it actually works), but you'd have to take care of the details.
Phase delay in IIR filters is difficult to calculate; it's much easier to do with FIR filters. The general plot summary: use the FFT design method for FIR filters. Start in the frequency domain with a 32-bin FFT of the filter. Set the amplitude appropriately for each bin. Then adjust the phase so that the sin/cos pair for the bin reaches 1 at 16 samples. (i.e. line up the phase of each bin at 16 samples of delay). Use an IFFT to convert to time domain. The result will be real coefficents for a 32-tap FIR filter with the frequency response you set in the bin amplitudes.
With this filter in hand, you can the adjust the KP delay line by subtracting 16 sample from the delay length. When you feed it through the FIR, the effectively delay will be correct.
Let me know if you're interested in this approach, I can supply more details. Implementing this approach in reaktor would be *TOUGH*.
An alternate approach: start with an existing filter. Take the impulse response of the filter. Transform into frequency domain with FFT. Phase bash (line up the phases). Convert back to FIR parameters with IFFT.
If you're handy with a programming language, a good approach would be to use a programming language to build pre-cooked tables for a pre-selected set of filter parameters. In a high-level language, it's not that hard to calculate these tables. Write a program that writes table data to a text file, and then import the table into reaktor. That's the approach I've used a lot when dealing with complex initializations in reaktor.
fwiw, design methods for FIR that yeild "constant phase delay" will produce results that are equivalent to the technique given above (phase alignment at filter_length/2 samples).
An alternate approach: calculate the absolute delay of an IIR filter at your target frequency. Subtract that amount of the delay line length. This will give you correct response at the fundamental frequency, and slightly skewed response at harmonic frequencies. But most real instruments have slightly skewed harmonics as well, so this may not be a bad thing. Unfortunately, this will be pretty tough going with the pre-built filters, since there's no documentation on how they were constructed. I'd have to do some serious thinking about how exactly to calculate the exact delay; but it's probably not that hard to do if you can get your hands on the IIR filter coefficients.
Pretty tough going in Reaktor, either way.
Maybe someone can suggest an easier way.
Actually... an approach I *have* seen that's relatively easy: use the filter as is; and then use a table to make hand-tweaked tuning adjustments for each midi pitch. Add or subtract a pitch adjustment from the table from the intended pitch before feeding it to the KP unit. That's easy. And it produces good results. The downside: you have to rebuild the table by hand whenever you change the filter.
|

20-02-2007, 15:13
|
|
Moderator
|
|
Join Date: May 2005
Posts: 3,386
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
I'm not exactly sure what you hope to achieve by having the filter inside of the delay line, but couldn't you:
1. Put a filter after the whole thing if you want a "filtered sound".
2. Try one of the "phase linear" filters that you'll find (as a core macro) in the cross-over section of Flatblaster2. You won't have any resonance with this type of filter, but it does act as a 1-pole HP/LP filter without changing the phase of the input.
- CList
|

20-02-2007, 17:00
|
|
Forum Member
|
|
|
Join Date: Jul 2006
Posts: 49
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
hmm i probably should have mentioned im an idiot so i guess its basically impossible i am having trouble with the basics of reaktor so i think if u guys dont know how to do this i dont have a chance
clist: steampipe already has 1 pole hp and lp filters in the delay line by default and they still make the pitch change. i couldnt find the filters in flatblaster - do u think they are the same?
robin: with the quick fix you suggested (with the table) would i still be able to sweep the filter and maintain a constant pitch?
is it impossible to have a filter that compensates for its own delay?
i think if someone could figure this out it would be totally awesome it can make the karplus strong synthesis much more interesting and usable
|

20-02-2007, 17:09
|
|
Moderator
|
|
Join Date: May 2005
Posts: 3,386
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
It's only in Flatblaster2.
I started doing a whole explanation of where to find it in the structure, but it's easier if I just post it.
Note that it takes a FREQUENCY not a PITCH - you might need to do a conversion.
The corecell is attached. The Lo out is the LP filtered input based on the frequency setting, the Hi out its the HP filtering of the input based on the same freqeuncy.
- CList
|

20-02-2007, 17:10
|
|
Moderator
|
|
Join Date: May 2005
Posts: 3,386
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
Note that my knowledge of DSP is nothing compared to Robin's so I have no idea if this will work or not! ^_^
- C
|

20-02-2007, 17:23
|
|
NI Product Owner
|
|
Join Date: Jul 2006
Posts: 610
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
Robin explained it well. Compensating mathematically for the filter's delay is a daunting task.
Steampipe takes a one-knob approach, subtracting samples from the delay line. It works pretty well, I think, as long as the cutoff frequency remains fixed.
But it becomes more difficult when you realize that you often want the filter's cutoff frequency to vary along with the note number. This is especially true when modeling acoustic guitars, so that the low notes aren't unnaturally bright.
Yamaha's VL solution was to build use piecewise-linear tables for both filter cutoff frequency and pitch compensation.
An alternative would be to use a 2-dimensional compensation table, addressed by both filter cutoff frequency and note number. Then, the brightness could be varied without affecting the pitch. Because Reaktor's tables do both X and Y interpolation, not _every_ frequency or note need to be tuned. I built a KS ensemble with that feature once, but tuning it became so tedious that I lost interest before I was finished.
|

21-02-2007, 02:33
|
|
Forum Member
|
|
Join Date: Oct 2006
Posts: 280
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
|
meatwalker wrote:
robin: with the quick fix you suggested (with the table) would i still be able to sweep the filter and maintain a constant pitch?
|
Maybe..... Chet's post about Yamaha using peicewise linear interpolation from table driven data looks encouraging. But I'm pretty sure that the Yamaha guys would have actually calculated the table. Populating the table manually might also be a bit challenging. If you're trying to do note-by-note tuning, then it's fairly easy to adjust the table values (see below). If you're trying to populate the tables based on something other than MIDI note-by-note values, you'll have to come up with an ingenious way to tune the values against a reference pitch (see below). If you want variable resonance on the filter as well, manual tweeking will be out of the question. 2D table-driven conformal maps for filters get very complicated, and I don't think you'd be able to build one of these manually.
Another interesting ensemble to look at is Cathedral Flutes. This is the ensemble I mentioned that used manual tuning tables. In this case, the ensemble is using physical modelling to generate flute-like tones. The basic mechanism is very similar to KP: a tuned delay line, with one of three sets of selectable fixed filters in the middle. What you might find interesting is how the tables were populated. The really cool thing about this ensemble: look for invisible macros around the internal tuning table. Make these macros visible, and look on the B view: voila! the reaktor UI that the author of this ensemble used to tune the pipes (including a small peice of instrument that plays reference pitches so that he could tune the instrument pitch against a reference tone). If you're going to go the manually populated table route, definitely look at this ensemble. Must have been a lot of hard work though.
You might be able to use the same approach: one or two or three sets of hand-tuned filters. You could get away with fixed sets of filters from which the user can select two or three "instrument responses".
In the meantime, I'll do some scribbling to see if I can think of a simple way to calculate the phase delay for a signle frequency in an IIR filter. Truth be told, I know the theory of this stuff in very general terms; translating general terms to actual implementable solutions is a challenge for me. ... I'll let you know if I think of an easier way. But don't hold your breath. This one smells like a really challenging reaktor problem.
If you're able, precomputed tables would be a great way to go, esp. given Chet's posting about Yamaha's approach. That says that it can be done. And it also says that some very very good audio engineers used table interpolation to get a workable solution.
|

21-02-2007, 03:55
|
|
Forum Member
|
|
Join Date: Oct 2006
Posts: 280
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
Actually, scrath that last reply altogether. If you're going to allow configurable filters inside the KP delay line, then you'd use a different approach. In the previous method, you do fine tuning on the pitch of each note on the final instrument, with the filter in place, and place the fine-tuning parameters in a table.
If you plan to use a configurable filter, then what you really want is a table of phase adjustments for a given cutoff frequency, for a given fundamental pitch. (e.g., what's the delay line adjustment for cutoff frequency 1200hz, with an input pitch of 440hz. That's a 2D table. Much more difficult, and you're definitely not going to be able to build it by hand tuning.
To give you an idea of what you're up against, here's a test harness for plotting filter phase delay and response for a filter under test. (attached). You'll have to edit the structure to put another filter under test. I've been meaning to do this for a while just to see how some of the libary filters behaved. (Glad I did. I learned a lot. I'm going to be using the 2 Pole SV T filter a lot from now on).
btw, the FlatBlaster2 filter doesn't seem to have linear phase delay (I don't think), except at cf = SR/4. (My guess; the analog prototype was linear phase, but the digital implementation isn't).
I'm guessing that you'll need to go the FIR route, right now.
|

21-02-2007, 13:02
|
|
Moderator
|
|
Join Date: May 2005
Posts: 3,386
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
|
Robin Davies wrote:
btw, the FlatBlaster2 filter doesn't seem to have linear phase delay (I don't think), except at cf = SR/4. (My guess; the analog prototype was linear phase, but the digital implementation isn't).
|
Ah, I see. I had only tested it in relation to a cross-over where you are splitting the frequencies and recombining them. After doing some more tests just now, I see what you mean, and I see that it's just phase-matched between the input and the *sum* of the HP and LP outputs, while the standard HP/LP filter does not have this behavior.
Thanks for clearing that up...
- CList
|

21-02-2007, 14:34
|
|
Forum Member
|
|
Join Date: Oct 2006
Posts: 280
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
|
CList wrote:
... it's just phase-matched between the input and the *sum* of the HP and LP outputs...
- CList
|
Hey, that's a very cool trick. I get it. <files that away for future use>
|

21-02-2007, 15:09
|
|
Forum Member
|
|
|
Join Date: Jul 2006
Posts: 49
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
|
Robin Davies wrote:
Actually, scrath that last reply altogether. If you're going to allow configurable filters inside the KP delay line, then you'd use a different approach. In the previous method, you do fine tuning on the pitch of each note on the final instrument, with the filter in place, and place the fine-tuning parameters in a table.
If you plan to use a configurable filter, then what you really want is a table of phase adjustments for a given cutoff frequency, for a given fundamental pitch. (e.g., what's the delay line adjustment for cutoff frequency 1200hz, with an input pitch of 440hz. That's a 2D table. Much more difficult, and you're definitely not going to be able to build it by hand tuning.
To give you an idea of what you're up against, here's a test harness for plotting filter phase delay and response for a filter under test. (attached). You'll have to edit the structure to put another filter under test. I've been meaning to do this for a while just to see how some of the libary filters behaved. (Glad I did. I learned a lot. I'm going to be using the 2 Pole SV T filter a lot from now on).
btw, the FlatBlaster2 filter doesn't seem to have linear phase delay (I don't think), except at cf = SR/4. (My guess; the analog prototype was linear phase, but the digital implementation isn't).
I'm guessing that you'll need to go the FIR route, right now.
|
okay this is a really cool little ensemble you made.
would it be possible by using this module to connect to another filter and somehow phase all the other frequencies corrospondingly so the absolute signal is not phased at all?
|

21-02-2007, 15:20
|
|
Forum Member
|
|
|
Join Date: Jul 2006
Posts: 49
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
has everything you've said so far apply also to the diffusion delay?
steampipe has a DifDel H module in the delay line and it has the same effect on the frequency of the signal as a filter does.
wondering if it might be more straightforward to pitch correct this one..or not?
|

21-02-2007, 15:26
|
|
Forum Member
|
|
|
Join Date: Jul 2006
Posts: 49
|
|
|
Re: decoupling a filter from pitch in a karplus-strong delay line
[QUOTE=Robin Davies]you'll need to go the FIR route[QUOTE]
are there inbuilt fir filters in reaktor?
|
 |
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|