Hellos to ya all and a happy and creative (or non-"Creative" :evil: ) 2003!!!! Well, my issue is on the implementation of matlab designed static filters on the emu10kx with dane assembler. More specificly the problem is that although the design in matlab seems to be stable when i'm trying to implement the designed filter in dane assembler the results are rather dissapointing :tears:. Well actually filtering is occuring but completely different than the specifications!!! For example in the example below i designed a quantised 2nd order lowpass filter with cutoff at 200 Hz in matlab but when i'm trying to implement it using the below code i get something like a highpass but not even the opposite from the one i designed!!! Here is the matlab filter information Fs = 48 KHz Cutoff = 200 Hz Passband attenuation = 0 db Stopband attenuation = -40 db ------- Section 1 ------- Numerator QuantizedCoefficients{1}{1} (1) 0.3210358396172524 (2) -0.6207185396924615 (3) 0.3210358396172524 Denominator QuantizedCoefficients{1}{2} (1) 0.5000000000000000 (2) -0.9855409921146929 (3) 0.4859153456054628 FilterStructure = df1t ScaleValues = [1] NumberOfSections = 1 StatesPerSection = [4] CoefficientFormat = quantizer('fixed', 'round', 'saturate', [32 31]) InputFormat = quantizer('fixed', 'floor', 'saturate', [32 31]) OutputFormat = quantizer('fixed', 'floor', 'saturate', [32 31]) MultiplicandFormat = quantizer('fixed', 'floor', 'saturate', [32 31]) ProductFormat = quantizer('fixed', 'floor', 'saturate', [64 62]) SumFormat = quantizer('fixed', 'floor', 'saturate', [64 62]) And this is the dane code: input in; output out; control level=0; static b0=0.3210358396172524 , b1=-0.6207185396924615; static b2=0.3210358396172524 , a0=0.5; static a1=0.9855409921146929 , a2=-0.4859153456054628; static x1=0 , x2=0 , y1=0 , y2=0; temp t1 , t2 , t3; ; code macs 0 , 0 , 0 , 0; macmv x2 , x1 , x2 , b2; macmv x1 , in , x1 , b1; macmv t1 , t1 , in , b0; macs t2 , accum , 0 , 0; macs 0 , 0 , 0 , 0; macmv y2 , y1 , y2 , a2; macmv y1 , t2 , y1 , a1; macmv t1 , t1 , t2 , a0; macs t3 , accum , 0 , 0; macs out , 0 , level , t3; end At first i thought that the problem was the quantizing but i don't thing that the changes due to quantizing would be so drastic!!! So please help me with that since being not a student somewhere and studying dsp all alone it's very difficult to finger out something that i may be doing wrong! Thx for your time and again happy 2003!

it looks for me that the whole feedback ('denominator') path is implemented incorrectly (sound does not goes through it at all), also i'd recommend you to think of the following stuff: 1. 32bit fixed-point coefficients are really large enough to not care about quantization at all... (just try to compare filters after/before quantization) 2. Think of implementing filter as "Direct-Form II Transpose", it is really better for real applications (especially in terms of required DSP resources) 3. MACMV is very usefull when doing large order FIR filters, but something like "MACS R, accum, X, Y" can produce much more better code for simple second-order IIR. 4. Check the frequency response of the filter you designed once more... Is 30dB boost at 200Hz what you exactly want?

hi max and thx for your answer! Actually the wrong thing about the implementation is that the "feedback" section is actually a feedforward one in cascade with the first!. But on the other side i think that the signal is passing through it via the t2 register where the accum of the first section in been assigned (please correct me where i'm wrong). 1. Yes you're absolutely right. 32bit fixed-point with a minor "step" of 2^-31 is really enough! (Btw with FDA tool in matlab filter design is being very quick and comparison is done automaticly so no prob there). 2. Well yes ti surely is better; it only needs the half delay registers than direct form I in a biquad (although it is more sensible to overflows but that's not a problem for short static filters), but i'm just trying to know dane better and to learn how to control the signal flow. 3. Yes i think you're right. It'll give better flow control for start. And i suppose that the missing move instruction is done with a macs t1 , t2 , 0 , 0 right ? btw i was checking the biquad filters that come with the package. are they implemented in direct form I normal or transposed? (i think it's normal but i'm not sure).

The filters (peaking, lp,hp,notch,bp and shelvings) are implemented in a direct form I biquad. 'The missing' a0 coef is normalized into the other coefs (all other coefs are divided by a0). The a1 and a2 gets multiplied by -1 before they are transfered to the DSP. Furthermore the values are divided by a scalar value which is needed to keep the values between -1 and 1. This is 'undone' with the 'sca' value in the DSP code. The overall formula then looks like this (without the scalar): y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2] - (a1/a0)*y[n-1] - (a2/a0)*y[n-2] .. which rougly translates into to the 5 macmv lines (without the /a0 part). Scaling and normalizing are done in the GUI/control c++ code (see the developer package). HTH Soeren

>But on the other side i think that the signal is passing through it via the t2 register where the accum of the first section in been assigned (please correct me where i'm wrong). Yes, but t2 is just immidiately multiplied by a0 and goes to output and never riches a1, a2 and never goes back.