Csound Csound-dev Csound-tekno Search About

Re: Frequency Shifting & Hilbert Transforms

Date1999-03-19 08:37
FromRoger Klaveness
SubjectRe: Frequency Shifting & Hilbert Transforms
>Jens Groh wrote:
> 
> Hi Roger!
> Probably it will, if you replace your delay line with one that has its taps at every sample,
?? 
I'm using a-rate for the filter
 
>not every ksmps samples. Try it with the delay1 opcode. Or try to use the filter2 opcode which 
>should be suitable to implement a FIR filter, too.
> Jens Groh

I have had difficulties with filter2 and zfilter2.
Sometimes they just doesen't work ( coeffs generated 
by matlab and http://www.cs.york.ac.uk/~fisher/mkfilter )
That was with some Butterworth IIR-filters, I didn't 
try them out with the hilbert-FIR though.

Anyway I think it is funny to implement a filter directly 
in csound-code ;-)


> 
> Roger Klaveness  wrote:
> 
> >Will this do the trick ?
> [......]
> >
> > ; Hilbert transform, 11-order FIR
> > igain =     1.570796327
> >
> > axv0 init 0
> > axv1 init 0
> > axv2 init 0
> > axv3 init 0
> > axv4 init 0
> > axv5 init 0
> > axv6 init 0
> > axv7 init 0
> > axv8 init 0
> > axv9 init 0
> > axv10 init 0
> >
> > axv0 = axv1
> > axv1 = axv2
> > axv2 = axv3
> > axv3 = axv4
> > axv4 = axv5
> > axv5 = axv6
> > axv6 = axv7
> > axv7 = axv8
> > axv8 = axv9
> > axv9 = axv10
> > axv10 = ain/igain;
> >
> > ahilb = .0160000000 * (axv0 - axv10) + .1326173942 * (axv2 - axv8) + .9121478174 * (axv4 - axv6)
> > ; ------------------------------------------------------------------
> >
> > amod1 = ahilb*asinmod
> > amod2 = ain*acosmod
> >
> > outs amod2-amod1,amod1+amod2
> >