I did some more research and have this analog phaser model pretty well tuned in Matlab (actually FreeMat). Probably is fine in Octave, too.

This is a simple script file, not really a function. It performs a frequency sweep on the filter and averages the output sort of reminiscent of the analog bench test signal generator police siren mode with an external trigger to trace the envelope outline. It's one way to get the job done.

I am hoping that porting the DSP phaser block to C++ will solve my phaser woes. This and the reverse delay will have to wait until my next free block of time to sit down and do some coding.

See below:

SR = 48000;

DUR = 4;

t = (1:1:DUR*SR);

tt = t/SR;

fmax = 12000;

fq = tt*fmax/DUR;

x = sin(2*pi*tt.*(1+fmax*tt/DUR));

%x = sin(2*pi*tt.*8000);

PER = length(x);

f3 = 2000;

C = 0.1e-6;

R = 1/(2*pi*C*f3)

b = 1/(2*SR*R*C);

att = (1 - b)/(b + 1)

IN =1;

output = x;

sta = 4;

CHARGE=0*(1:sta);

delta=CHARGE;

x1=delta;

i=1;

feedback = 0;

fb = 0;

for (k=1:PER);

j=0;

x(i) = x(i) + feedback;

b = 1/(2*SR*(.9*R + .1*R/(1 - x(i)*x(i)) )*C);

att = (1 - b)/(b + 1);

for stages = 1:sta

j = j+1;

CHARGE(j) = -x1(j) + att*(x(i) + CHARGE(j));

x1(j)=x(i);

x(i) = CHARGE(j);

end

feedback = x(i)*fb;

i=i+1;

end

output = .5*x + .5*output;

dbput = 20*log10(abs(output));

dcharge=0;

ddelta=0;

j=0;

att = .02;

for i=1:PER

j=j+1;

ddelta = dbput(j) - dcharge; %Low CPU interpolation

dcharge = dcharge + att*ddelta;

dbput(j) = dcharge;

end

%plot(tt,output,'r-',tt,x,'g-');

plot(fq,dbput,'r-');

CHARGE

max(output)

## Thursday, October 15, 2009

Subscribe to:
Post Comments (Atom)

## No comments:

## Post a Comment