# How to use filter for audio signal?

Status
Not open for further replies.

#### panda1234

##### Full Member level 2 Hi,
I want an audio signal that's equation is:
y[n]=x[n]+kx[n-3200]+k^2x[n-6400]+k^3x[n-9600]
now i want to filter this and obtain y_new=x
i know it's function is:H=(1+kR+k^2R^2+k^3R^3)
so invert function is:H'=1/(1+kR+k^2R^2+k^3R^3)
Q1:should i put 3200 instead R?
Q2:how to use this filter in matlab?
is this correct?(y_new=filter(1,[1 k*3200 (3200)^2*k^2 (3200)^3*k^3],y))

#### barry This doesn't make a lot of sense to me. You've got an audio signal that is comprised of samples spaced 3200 samples apart? What's happening to those other 3199 samples?

To further add to the confusion, what is "x" in "y_new=x"? The present value of x? (x )?

#### panda1234

##### Full Member level 2 this equation make echo for your audio echo.you can make sure with examine it in MATLAB.
I hope below diagram make sense for you: #### barry Nope. Doesn't help.

Echo?

#### panda1234

##### Full Member level 2 yes,Echo _______

#### Audioguru In my entire audio career I never used only a bunch of numbers as an audio filter. Instead I used resistors, capacitors and opamps.
I also used a digital echo canceller product.

#### zorro Yes, echo.
The output adds to the input 3 delayed versions of it. Each one of them is delayed 3200 samples and multiplied k times from the previous one.

i know it's function is:H=(1+kR+k^2R^2+k^3R^3)
so invert function is:H'=1/(1+kR+k^2R^2+k^3R^3)

No. You should become familiar with transfer functions. The correct transfer function in z domain is (with R=3200):

H(z) = 1 + k*z^-R + k^2*z^-(2*R) + k^3* z^-(3*R)

Q2:how to use this filter in matlab?
is this correct?(y_new=filter(1,[1 k*3200 (3200)^2*k^2 (3200)^3*k^3],y))

No. A correct form is:

R = 3200;
echoVector = [1, zeros(1,R-1), k, zeros(1,R-1), k^2, zeros(1,R-1), k^3];
y_new = filter( 1, echoVector, y );

Regards

Z

• panda1234

Points: 2