Hi, hope the subject name figurates my problem well enough. I'm totally lost with this, maybe just a basic matter of math (I'm a total math n00b). I have this data: b = [ 0.04872204977233 -0.09076930609195 0.04202280710877] a = [ 1.00000000000000 -0.85197860443215 -0.10921171201431] for to use in formula: out[i] = b0*in[i] + b1*in[i-1] + b2*in[i-2] - a1*out[i-1] - a2*out[i-2] This works otherwise OK but, it gives me the "compensation curve" as "/" (cuts low frequencies, boosts high frequencies) ... my problem is .. it needs to be as "\" (opposite/inverted). I have digged the web couple of days already to find some easy instructions or free software, which I could use for to get this filter affect turned. I've found lots of documentation in this area but, I don't understand higher math and My technical english is not good enough to get any advantage of those documents, and also some direct instructions as like swap the a/b vectors: b = [ 1.00000000000000 -0.85197860443215 -0.10921171201431] a = [ 0.04872204977233 -0.09076930609195 0.04202280710877] multiply then with 1/a0: b = [ 20.5245880391493 -17.4865098741392 -2.24152539814392] a = [ 1.00000000000000 -1.86300261413672 0.86250080415614] I have also tried to "normalize" above data for b, using method described somewhere (bn/∑b): b = [ 0.50989442055370 -0.43441913683108 -0.05568644261521] a = [ 1.00000000000000 -0.93150130706836 0.86250080415614] (I read somewhere, the a1 can be divided by two (a1/2) and then just subtract twice in formula) ... .. though, (using with above formula) this turns the direction but, the filter does not give the curve as it should anymore and, by some analyzer software, the curve shows up around +220dB-+280dB area when it should show up around -20dB-+20dB. Aren't there any methods to do this swap w/o MatLab etc. software? Also, some instructions (n00b level) on how to do this (w/ some explanation if possible) would be a hope. Thanks, jtp
Lost with direct-form filter equations (inverting)
Started by ●March 7, 2007
Reply by ●March 7, 20072007-03-07
On Mar 7, 9:00 am, "jtp_1960" <jtp_1...@hotmail.com> wrote:> Hi, > hope the subject name figurates my problem well enough. > > I'm totally lost with this, maybe just a basic matter of math (I'm a total > math n00b). >The problem is that signal processing is a field where you can't really get by without having at least some level of understanding the underlying mathematics. If you're willing to delve into the details a bit, what you want is a lowpass-to-highpass filter transformation algorithm. Jason
Reply by ●March 7, 20072007-03-07
On Mar 7, 1:36 pm, cincy...@gmail.com wrote:> On Mar 7, 9:00 am, "jtp_1960" <jtp_1...@hotmail.com> wrote: > > > Hi, > > hope the subject name figurates my problem well enough. > > > I'm totally lost with this, maybe just a basic matter of math (I'm a total > > math n00b). > > The problem is that signal processing is a field where you can't > really get by without having at least some level of understanding the > underlying mathematics. If you're willing to delve into the details a > bit, what you want is a lowpass-to-highpass filter transformation > algorithm. > > JasonCorrection: you actually want to transform a highpass filter to a lowpass form. You can apply the same sort of algorithm, just in reverse to do this. Jason
Reply by ●March 7, 20072007-03-07
>On Mar 7, 1:36 pm, cincy...@gmail.com wrote:..>> >> The problem is that signal processing is a field where you can't >> really get by without having at least some level of understanding the >> underlying mathematics. If you're willing to delve into the details a >> bit, what you want is a lowpass-to-highpass filter transformation >> algorithm. >> >> Jason > >Correction: you actually want to transform a highpass filter to a >lowpass form. You can apply the same sort of algorithm, just in >reverse to do this. > >Jason > >But, how? That's the big question for me. Is that what I already have been done the right/partly right way or do you mean that everything would need to calculate from the start. Hmm.. this is what I get w/ the original coefficients: http://img155.imageshack.us/img155/6074/delphiriaa2qo8.png this is what I get w/ those I have tried to fix: http://img150.imageshack.us/img150/7741/riaa2dy6.png and, this is what I want to have: http://img254.imageshack.us/img254/1633/riaamagnitudeeh3.png As it's a RIAA EQ curve in question -> original accuracy (F.Umminger) got for production filter (error +/-0.01dB (88.2kHz) - +/-0.006dB (96kHz)) needs to be preserved in Reproduction filter. (! Noticed that the formula (bn/(b0+b1+b2) I mentioned in my OP was not correctly showed. Maybe because of unicode I used in it.) jtp
Reply by ●March 7, 20072007-03-07
cincydsp@gmail.com wrote:> On Mar 7, 9:00 am, "jtp_1960" <jtp_1...@hotmail.com> wrote: >> Hi, >> hope the subject name figurates my problem well enough. >> >> I'm totally lost with this, maybe just a basic matter of math (I'm a total >> math n00b). >> > > The problem is that signal processing is a field where you can't > really get by without having at least some level of understanding the > underlying mathematics. If you're willing to delve into the details a > bit, what you want is a lowpass-to-highpass filter transformation > algorithm.Or scrap your coefficients and get a high-pass filter from a program like http://www.dsptutor.freeuk.com/IIRFilterDesign/IIRFiltDes102.html Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply by ●March 7, 20072007-03-07
jtp_1960 wrote: ...> As it's a RIAA EQ curve in question -> original accuracy (F.Umminger) got > for production filter (error +/-0.01dB (88.2kHz) - +/-0.006dB (96kHz)) > needs to be preserved in Reproduction filter.Ah! If the response is (numerator/(denominator), the inverse response is necessarily (denominator/numerator). That way [response]*[inverse] = 1. It may help to renormalize, but remember: normalizing is a convenience, not an inherent need. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply by ●March 8, 20072007-03-08
jtp_1960 wrote:> swap the a/b vectors:> multiply then with 1/a0: > b = [ 20.5245880391493 -17.4865098741392 -2.24152539814392] > a = [ 1.00000000000000 -1.86300261413672 0.86250080415614]Those are indeed the coefficients you seek. A plot should show the original curve upside-down, with all dB values negated. If you want 0 dB gain at 1 kHz as the third image you posted suggests, divide b by the (linear, not dB) gain at 1 kHz that results from the coefficients as given above. As a check, I get the scale factor .8005923096e-2 with 48 kHz sampling. Both inversion and scaling preserve the dB error in the original design. I notice that your plot of the original curve only goes up to about -25 dB while the true value is almost -20 dB. The difference might be due to your test signal or intervening filters in your setup. Maybe it doesn't matter for your purposes but I thought I'd point it out. Martin -- Quidquid latine scriptum est, altum videtur.
Reply by ●March 13, 20072007-03-13
>jtp_1960 wrote: > >> swap the a/b vectors: > >> multiply then with 1/a0: >> b = [ 20.5245880391493 -17.4865098741392 -2.24152539814392] >> a = [ 1.00000000000000 -1.86300261413672 0.86250080415614] > >Those are indeed the coefficients you seek. A plot should show the >original curve upside-down, with all dB values negated. If you want 0 >dB gain at 1 kHz as the third image you posted suggests, divide b by >the (linear, not dB) gain at 1 kHz that results from the coefficients >as given above. As a check, I get the scale factor .8005923096e-2 >with 48 kHz sampling. Both inversion and scaling preserve the dB >error in the original design. > >I notice that your plot of the original curve only goes up to about >-25 dB while the true value is almost -20 dB. The difference might be >due to your test signal or intervening filters in your setup. Maybe >it doesn't matter for your purposes but I thought I'd point it out. > > >Martin > >-- >Quidquid latine scriptum est, altum videtur. >Thanks for suggestions ... you're probably fully right in this but, ... hmm.. yes, the curve 'form' looks good in TobyBears FilterExplorer when use those coefficients: http://img76.imageshack.us/img76/2259/riaa88errornt7.png and, when I then divide b's w/ that 116.6 showing up in "info field", the 1kHz point becomes 0dB and still good but, when I then use those new coefficients in a VST plugin, I get only this (no matter what I try (tried w/ SynthMaker and Delphi + VST/ASIO SDK)): http://img389.imageshack.us/img389/4550/fe882lq2.png ??? Maybe the FilterExplorer runs @ 44.1kHz in demo-mode (though, it's possible to change the samplerate ...)? If someone could check if the 116.6 as divider is wrong. Could this issue which I'm having be hardware related (Intel P4 (denormal bug) or Creative soundcard) ... or could that filter w/ those coefficients just be badly 'unstable' (coefficients for 48kHz version works w/o any issues and those original for 44.1, 88.2 and 96kHz works well too when not inverted)?>I notice that your plot of the original curve only goes up to about >-25 dB while the true value is almost -20 dB. The difference might be >due to your test signal or intervening filters in your setup. Maybe >it doesn't matter for your purposes but I thought I'd point it out. >Yes, I noticed that too ... maybe this is related to the C.W.Buddes "VST Plugin Analyzer" which one I'm using (it's working @ 44.1kHz all the time and there are no samplerate setting option available in software or in soundcard settings panel... and there are some other 'strange' issues w/ it as well)? jtp
Reply by ●March 14, 20072007-03-14
jtp_1960 wrote:> hmm.. yes, the curve 'form' looks good in TobyBears > FilterExplorer when use those coefficients: > > http://img76.imageshack.us/img76/2259/riaa88errornt7.pngI don't think that's what you meant to show us, so I can't say much there. But note that the Filter Explorer uses the reverse naming convention for the coefficients from Frederick Umminger's submission. So you need to put your b vector in its a fields and vice versa.>>I notice that your plot of the original curve only goes up to >>about -25 dB while the true value is almost -20 dB.> Yes, I noticed that too ... maybe this is related to the > C.W.Buddes "VST Plugin Analyzer" which one I'm using (it's > working @ 44.1kHz all the time and there are no samplerate > setting option available in software or in soundcard settings > panel... and there are some other 'strange' issues w/ it as > well)?It may be that the program's spectrum analyzer has some top-end droop, I don't know. But it's most probably nothing to do with the sampling rate because the same coefficients will give the same curve at any rate, just with different numbers along the frequency axis. Martin -- Quidquid latine scriptum est, altum videtur.
Reply by ●March 14, 20072007-03-14
>I don't think that's what you meant to show us, so I can't say much >there. But note that the Filter Explorer uses the reverse naming >convention for the coefficients from Frederick Umminger's submission. >So you need to put your b vector in its a fields and vice versa. >Sorry 'bout those swapped pictures .. the other one just shows how high volume levels I get in software before everything freezes (~+700dB).> >It may be that the program's spectrum analyzer has some top-end >droop, I don't know. But it's most probably nothing to do with the >sampling rate because the same coefficients will give the same curve >at any rate, just with different numbers along the frequency axis.So, as those 88.2/96 filters freezes every software I've tried this far, it must be either those coefficient values or hardware in question that is giving those issues (since both, 44.1/48kHz filters works well). Noticed that when those coefficients for 88.2kHz and 96kHz are inverted, in both cases, a1 and a2 gets values which maybe are not good in equation y[i] = b0x[i] + b1x[i-1] + b2x[i-2] - a1y[i-1] - a2y[i-1] because of, "a1" gets a negative coefficient and its decimal part is bigger than "a2" is --> " --a1y[i-1] - a2y[i-2]" --> y[i] seem to start slowly grow after 'bout every sample calculation (this is not an issue w/ data for 44.1kHz and 48kHz). When I changed the decimal parts of "a1" and "a2" a bit so that the "abs(a1) - a2 =< 1", filter starts working but as expected, the filter graphics looks a bit different from what it should be. Also, while analyzing the VST plugin in C.W.Buddes VST PluginAnalyzer, Delphi tracer (Watch) shows y[i] become over 1.000000000 after 'bput 850 sampleframes and after 8192 sampleframes, y[i] has value of 2.488847401e+11 already (i.e. 248884740100). This shouldn't be a coding (data type, etc) issue because of the SynthMaker (not much you can code there) did result equally. If this is the culprit for these issues I'm having here, are there any 'mathematical' methods to get this fixed w/o loosing the accuracy Umminger got into those original coefficients or, are those 88.2/96kHz coefficients just unusable when inverted (least the one works well :) )? jtp