| I've had similar experiences.
Try with zfilter2 instead.
Try to reverse the sign of the coefficents.
Here is an example with both applied.
It worked the last time I checked ( consound version 3.49 I think ), why I don't know.
;10.order butterworth-lp, sr/6
ibgain=0.00001
iagain=-1
aout zfilter2 amix,1,1,10,10,ibgain*.0027,ibgain*.0273,ibgain*.1230,ibgain*.3281,ibgain*.5742,ibgain*.6891,ibgain*.5742,ibgain*.3281,ibgain*.1230,ibgain*.0273,ibgain*.0027,iagain*-7.4907,iagain*25.4989,iagain*-51.8964,iagain*69.8813,iagain*-65.0115,iagain*42.2946,iagain*-18.9909,iagain*5.6301,iagain*-0.9948,iagain*0.0795
> Sinan Bokesoy wrote:
> Hello everbody,
> I need some help for using the filter2 opcode.
> I can get the Bh and Ah vectors as the filter coefficents with corresponding number of poles and
> zeros from Matlab.
> But after implementing the filter with the filter2 opcode, the result has been zero output.
> Could someone please send us an example?
> Thanks for your help,
> Sinan Bokesoy
There seems to be some bugs in filter2/zfilter2
As I am a little interested myself in this I'll try
to look at the sourcecode to see if I understand something
of it.
Last time Erik Spjut wrote:
>As usual, the devil is in the details. I used the filter design page to
>generate some of the coefficients I used to test filter2 for IIR filters.
>The filters work fine in infinite-precision math but fail miserably in
>Csound's single-precision math. I agree that the proposed opcode would be
>most wonderful. However, whoever does it is in for some tedious work in
>finite precision arithmetic.
to proposed opcode:
>>ar filtgen asig, iftype, ibandtype, iripple, iorder, icorner2, icorner2
>>
>>where
>>iftype : filtertype 1=Butterworth,2=Chebychev,3=Bessel
>>ibandtype : Bandtype 1=Lowpass , 2=Highpass, 3=Bandpass, 4=Bandstop
>>iripple : ripple in dB for Chebychev filter
>>iorder : order of filter
>>icorner1 : cornerfrequency 1
>>icorner2 = cornerfrequency 2, for Bandpass/Bandstop filters
>>
>>the opcode would then at inittime design the filter and maybe show
>>a graphic output of freq ,phase and impulse response.
>>
>>at http://www.cs.york.ac.uk/~fisher/mkfilter/ there is an online |