Go Back   DriverHeaven.net > Forums > Hardware and Related Topics > kX Project Audio Driver Support Forum > Effects and the DSP

Notices

Reply
 
LinkBack Thread Tools Display Modes
Old Feb 23, 2007, 04:15 PM   #1 (permalink)
Maddogg6
Tail Razer
 
Maddogg6's Avatar
 
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,595
Maddogg6 will become famous soon enough

'simple' INTERP LP filter..

The dane guide shows:
Quote:
input in
output out
control filter=0.5

interp out, out, filter, in ;the value of out is preserved for the next sampe cycle
end ;thus forming a one sample delay line
Is that correct, and why am I not seeing how a 'simple one sample delay line' is created here. ??
Is this inherent to the INTERP instruction? - or is a 'static' declaration missing in this example?
Or does the CONTROL with INTERP do this?

Something seems wrong here - is it just me?
Maddogg6 is offline   Reply With Quote
Old Feb 23, 2007, 04:32 PM   #2 (permalink)
Lex Nahumury
DriverHeaven Senior Member
 
Join Date: Jan 2003
Location: The Netherlands
Posts: 1,730
Lex Nahumury is on a distinguished road

The "out" register functions as the filter's memory here.
(btw printed in bold)
Lex Nahumury is offline   Reply With Quote
Old Feb 23, 2007, 04:43 PM   #3 (permalink)
Maddogg6
Tail Razer
 
Maddogg6's Avatar
 
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,595
Maddogg6 will become famous soon enough

Quote:
Originally Posted by Lex Nahumury View Post
The "out" register functions as the filter's memory here.
(btw printed in bold)
Ok - its just me
Yeah I did notice that.... but,
Is it because its the nature an OUT register - or because its used as R and A - or used as R and A with INTERP instruction.

When can I expect this 'one sample delay' to occur - I guess might be the better way to ask this.. ??

edit: nvmnd : I found this..
Quote:
NOTE: the value of the output register can be reused in the next sample cycle before the processor gets to calculating the operation, the result of which is written to the same output register, when it gets overwritten with the next output value.
So its the OUT register...

Thanks Lex...
Maddogg6 is offline   Reply With Quote
Old Feb 23, 2007, 05:18 PM   #4 (permalink)
Russ
DriverHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 3,913
Russ has a spectacular aura aboutRuss has a spectacular aura aboutRuss has a spectacular aura about

Quote:
NOTE: the value of the output register can be reused in the next sample cycle before the processor gets to calculating the operation, the result of which is written to the same output register, when it gets overwritten with the next output value.
In other words, OUT is a static register ('static' in this context, meaning that it retains its value each sample cycle).

From the examples section of the guide:
Quote:
NOTE:. Remember that the values of static registers are preserved for the next sample cycle and can be reused until they are overwritten. Thus they form a delay line from which we get the delayed samples for the above formula.

Last edited by Russ; Feb 23, 2007 at 06:42 PM.
Russ is offline   Reply With Quote
Old Mar 1, 2007, 03:47 PM   #5 (permalink)
Maddogg6
Tail Razer
 
Maddogg6's Avatar
 
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,595
Maddogg6 will become famous soon enough

ok I hope my next question will not be so dum... dum dum. dum.

Im reading up on filters and see that IIR and FIR filters are differentiated by 'feedback' (re: DSP GURUs FAQ)

Quote:
1.3 What is the alternative to IIR filters?

DSP filters can also be "Finite Impulse Response" (FIR). FIR filters do not use feedback, so for a FIR filter with N coefficients, the output always becomes zero after putting in N samples of an impulse response.
Am I to understand this 'feedback' described is much like 'feedback' for a 'traditional' delay/reverb.
In other words - if I re-send output of one samples filter operation back into tram - and use that instead of a 'non-fed-back' but 'delayed' value - I would now have an IIR filter.
Other than coefficients - is that the only 'programming' consideration I need to be aware of?
In other words - Can I tell by the lack of such feedback operation in existing KX filter plugins - that they are FIR and not IIR? Or vice versa? (If there IS feedback - its definitly an IIR filter ??)

*hopes that made more sense , than me sounding dum*

Thanks,
Mark
Maddogg6 is offline   Reply With Quote
Old Mar 1, 2007, 04:38 PM   #6 (permalink)
Russ
DriverHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 3,913
Russ has a spectacular aura aboutRuss has a spectacular aura aboutRuss has a spectacular aura about

I think that you will find that most of the more complicated filters used in existing kX plugins are IIR filters because they require less resources to implement.

Feedback here means a recursive filter (filters use previous outputs and (usually) inputs).

i.e.
If you look at the difference equation for the filter, you might see something like the following:
y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2]

In the above:
y[n] is the output of the filter
y[n-1] is the previous output of the filter
y[n-2] is the output from 2 cycles ago

x[n] is the current input (current sample)
x[n-1] is the previous input
x[n-2] is the input from 2 cycles ago

You wouldn't really use Tram to implement the delays here, rather you would just use static registers.

i.e. (code implementation would do the following)

y = b0*x + b1*x1 + b2*x2 - a1*y1 - a2*y2
y2 = y1
y1 = y
x2 = x1
x1 = x

The above is used for most of the EQ plugins bundled with kX.

Last edited by Russ; Mar 1, 2007 at 07:08 PM.
Russ is offline   Reply With Quote
Old Mar 1, 2007, 04:51 PM   #7 (permalink)
Max M.
d/h member-shmember
 
Max M.'s Avatar
 
Join Date: Dec 2002
Location: from the edge of the deep green sea
Posts: 2,111
Max M. is on a distinguished road

speaking of "interp out, out, k, in":
it feeds back the value of the out register delayed by one sample (hense "delay" and "feedback")
Max M. is offline   Reply With Quote
Old Mar 1, 2007, 05:15 PM   #8 (permalink)
Russ
DriverHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 3,913
Russ has a spectacular aura aboutRuss has a spectacular aura aboutRuss has a spectacular aura about

BTW: I should also add that your typical echo delay using Tram would also be an IIR filter, but I was trying to make the point that Tram is not necessary (i.e. if you a trying to use Tram as the identifier).

Quote:
Originally Posted by Maddogg6 View Post
If there IS feedback - its definitly an IIR filter ??
I guess that would be true in most cases (unless you are using the feedback for some purpose that results in it not effecting the impulse response in any way).

Last edited by Russ; Mar 1, 2007 at 05:41 PM.
Russ is offline   Reply With Quote
Old Mar 1, 2007, 07:00 PM   #9 (permalink)
Maddogg6
Tail Razer
 
Maddogg6's Avatar
 
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,595
Maddogg6 will become famous soon enough

Quote:
Originally Posted by Russ View Post
I think that you will find that most of the more complicated filters used in existing kX plugins are IIR filters because they require less resources to implement.

Feedback here means a recursive filter (filters use previous outputs and/or inputs).
Ok - I think I get it. (Max's Explanation of 'delay' and feedback' - seems like a reasonable interpretation to me - Thanks to both of ya)
Tho - it seems more like plain old 'delay' - than 'delay+feedback' to me...
DSP GURUS use of 'feedback' must be more derived from 'feedback' from resonant active analog filters.. (doh!- that makes more sense too)

Quote:
Originally Posted by Russ View Post
i.e.
If you look at the difference equation for the filter, you might see something like the following:
y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2]

In the above:
y[n] is the output of the filter
y[n-1] is the previous output of the filter
y[n-2] is the output from 2 cycles ago

x[n] is the current input (current sample)
x[n-1] is the previous input
x[n-2] is the input from 2 cycles ago

You wouldn't really use Tram to implement the delays here, rather you would just use static registers.

i.e. (code implementation would do the following)

y = b0*x + b1*x1 + b2*x2 - a1*y1 - a2*y2
y2 = y1
y1 = y
x2 = x1
x1 = x

The above is used for most of the EQ plugins bundled with kX.
Ok - I didn't realize they were using statics to achieve delays of > 1 sample. I thought I seen one use iTram - but I could be mistaken - Ive been looking at alot of DANE...so... ??



Quote:
BTW: I should also add that your typical echo delay using Tram would also be an IIR filter, but I was trying to make the point that Tram is not necessary (i.e. if you a trying to use Tram as the identifier).
Ok I got ya... (*forgot most any DSP algo can be referred to as a 'filter as well - but my previous use of 'filter' was aimed at what you assumed correctly - LP/BP/HP)

Is there a FIR filter example (in DANE) in existence? - so I can get a better understanding of just how much resources are needed - looking at the formulas - it would look like ~ 3x amount of instructions (guessing) - but wonder what the audible difference there would be as well - seeing as I read IIR are 'less accurate' and 'prone to errors'.
My experiments have seemed to be 'noisy' and wonder if this noise was from 'errors' I read about. ??

Thanks guys.
Mark
Maddogg6 is offline   Reply With Quote
Old Mar 1, 2007, 07:40 PM   #10 (permalink)
Russ
DriverHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 3,913
Russ has a spectacular aura aboutRuss has a spectacular aura aboutRuss has a spectacular aura about

Quote:
Originally Posted by Russ View Post
Feedback here means a recursive filter (filters use previous outputs and (usually) inputs).
That shouldn't be an 'and/or', rather it should be 'previous outputs, and (usually) previous inputs' (I corrected it above). FIR filters can use previous inputs too.

Quote:
Originally Posted by Maddogg6 View Post
Tho - it seems more like plain old 'delay' - than 'delay+feedback' to me...
A plain delay would be:
out = previous_out

'interp out, out, k, in' would basically be:
out = (1 - k) * previous_out + (k * in)

Notice that among the other calculations, previous_out is added to in, thus feedback.

Quote:
Originally Posted by Maddogg6 View Post
Is there a FIR filter example (in DANE) in existence? - so I can get a better understanding of just how much resources are needed
I do not know if there are any of the more complex kind (I haven't really looked at (and analyzed) the Dane code for every plugin).

Quote:
Originally Posted by Maddogg6 View Post
but wonder what the audible difference there would be as well - seeing as I read IIR are 'less accurate' and 'prone to errors'.
My experiments have seemed to be 'noisy' and wonder if this noise was from 'errors' I read about. ??
Well I am not an expert, but as I understand it, the errors are not so much of a problem with a DSP with a double wide accumulator (like we have here).

As for your noisy experiments, I do not know...
Russ is offline   Reply With Quote
Old Mar 1, 2007, 07:48 PM   #11 (permalink)
Maddogg6
Tail Razer
 
Maddogg6's Avatar
 
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,595
Maddogg6 will become famous soon enough

Quote:
Notice that among the other calculations, previous_out is added to in, thus feedback.
Ahh yes - yet again you are right and I was ....not
I wasnt looking at the interpol - as 'mixing' but I guess it is.

Quote:
Well I am not an expert, but as I understand it, the errors are not so much of a problem with a DSP with a double wide accumulator (like we have here).

As for your noisy experiments, I do not know...
Prolly more *my* errors than the algos...


hehe - I warned ya...lolz

Thanks again Russ...
Maddogg6 is offline   Reply With Quote
Old Mar 1, 2007, 09:38 PM   #12 (permalink)
Maddogg6
Tail Razer
 
Maddogg6's Avatar
 
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,595
Maddogg6 will become famous soon enough

Ok I have yet 1 more question...

Im looking at a HP_LP Filter made by Radiocolonel.it (havent seen him around in a while..??)

Quote:
input in_l, in_r
output HP_L, HP_R, LP_L, LP_R
control Filter=0
static K=1
temp tl_1, tl_2, tl_3, tl_4, tl_5, tl_6, tl_7, tl_8, tl_9
temp tr_1, tr_2, tr_3, tr_4, tr_5, tr_6, tr_7, tr_8, tr_9

interp tl_1, tl_1, Filter, in_l
interp tl_2, tl_2, Filter, tl_1
interp tl_3, tl_3, Filter, tl_2
interp tl_4, tl_4, Filter, tl_3
interp tl_5, tl_5, Filter, tl_4
interp tl_6, tl_6, Filter, tl_5
interp tl_7, tl_7, Filter, tl_6
interp tl_8, tl_8, Filter, tl_7
interp tl_9, tl_9, Filter, tl_8
interp LP_L, LP_L, Filter, tl_9
macsn HP_L, in_l, LP_L, K

interp tr_1, tr_1, Filter, in_r
interp tr_2, tr_2, Filter, tr_1
interp tr_3, tr_3, Filter, tr_2
interp tr_4, tr_4, Filter, tr_3
interp tr_5, tr_5, Filter, tr_4
interp tr_6, tr_6, Filter, tr_5
interp tr_7, tr_7, Filter, tr_6
interp tr_8, tr_8, Filter, tr_7
interp tr_9, tr_9, Filter, tr_8
interp LP_R, LP_R, Filter, tr_9
macsn HP_R, in_r, LP_R, K

end


Anyway, he used a static register, but is assigning a value to it.
1) is this valid - and ONLY uses that value upon plugin translation? (as opposed to every sample) - or

2) is it simply ignored?
Maddogg6 is offline   Reply With Quote
Old Mar 1, 2007, 10:11 PM   #13 (permalink)
Russ
DriverHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 3,913
Russ has a spectacular aura aboutRuss has a spectacular aura aboutRuss has a spectacular aura about

Yes, that is how you would set the initial value (think of filter coefficients, etc). It would only be ignored if you wrote to it before using it (which would defeat the purpose of declaring it static (not that you couldn't do that if you wanted to)). It uses that value when the plugin is first loaded and until such time it is overwritten (by a DSP instruction or from C++).

BTW: In most cases, Dane will not let you do something that is not 'allowed' (it would give an error when updating the code, and when trying to save, and when trying to load the plugin).

Last edited by Russ; Mar 1, 2007 at 10:32 PM.
Russ is offline   Reply With Quote
Old Mar 2, 2007, 03:01 AM   #14 (permalink)
Max M.
d/h member-shmember
 
Max M.'s Avatar
 
Join Date: Dec 2002
Location: from the edge of the deep green sea
Posts: 2,111
Max M. is on a distinguished road

btw. this code above is ill formed. all 'temp' registers there must be 'static'
(that code works only because kx's loader interpretes 'temp's as 'static's anyway
- as we recently discussed in 'using accums' thread)

As for FIR, well, you won't find any FIR based equalizers within kX plugins - simply because: to achive a frequency response comparable to what IIR is capable of, you need to build a FIR with thousands of taps (e.g. thousands registers and thousands MACs).
(although there're a few 'vacuous' fir filters in plugins here and there - for example a simplest lowpass with cutoff at FS/4 (e.g. 12kHz) is just a two tap fir (but the lower frequency - the more taps you need)

Last edited by Max M.; Mar 2, 2007 at 03:23 AM.
Max M. is offline   Reply With Quote
Old Mar 2, 2007, 09:38 AM   #15 (permalink)
Lex Nahumury
DriverHeaven Senior Member
 
Join Date: Jan 2003
Location: The Netherlands
Posts: 1,730
Lex Nahumury is on a distinguished road

@maddog6:
In addition to what Max mentioned,
even if you would implement a usable FIR, the delay it introduces
could render it useless for 'real time' applications.

Best to use the well known BiQuad IIR implementation.
(See Soeren's filter plugins)
As you can see there's little that hasn't been done yet in emu10kx.

Btw; What is it you are trying to develop if I may ask?
Lex Nahumury is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump