School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,485 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,780 people online right now. Registration is fast and FREE... Join Now!




Digital Filter to Audio Input

 

Digital Filter to Audio Input

replenish

10 May, 2009 - 08:36 PM
Post #1

New D.I.C Head
*

Joined: 10 May, 2009
Posts: 3


My Contributions
I'm using Fixed-Point 32bit processor to process the audio file and I want to make Low-Pass Filter.
I've used MATLAB to simulate and get the filter coefficients and the filter works on MATLAB but doesn't work on my program.

here's the filter equation I'm using (From MATLAB M-File)

CODE


    x =wavread(in_file);                      
    [B,A] = butter(5,0.25,'low');
    N= length(x);
    y(1) = B(1)*x(1);
    y(2) = B(1)*x(2) + B(2)*x(1) - A(2)*y(1);
    y(3) = B(1)*x(3) + B(2)*x(2) + B(3)*x(1) - A(2)*y(2) - A(3)*y(1);
    y(4) = B(1)*x(4) + B(2)*x(3) + B(3)*x(2) + B(4)*x(1) - A(2)*y(3) - A(3)*y(2) - A(4)*y(1);
    y(5) = B(1)*x(5) + B(2)*x(4) + B(3)*x(3) + B(4)*x(2) + B(5)*x(1) - A(2)*y(4) - A(3)*y(3) - A(4)*y(2) - A(5)*y(1);
    for n=6 : N
       y(n) = B(1)*x(n) + B(2)*x(n-1) + B(3)*x(n-2) + B(4)*x(n-3) + B(5)*x(n-4) + B(6)*x(n-5) - A(2)*y(n-1) - A(3)*y(n-2)- A(4)*y(n-3) - A(5)*y(n-4) - A(6)*y(n-5);
    end    
              


the output's sound quality is bad like it's has noise I think it's because the output is overflow.
I've try to scale down the coefficients but it's still the same.

User is offlineProfile CardPM
+Quote Post


JackOfAllTrades

RE: Digital Filter To Audio Input

11 May, 2009 - 04:15 AM
Post #2

I exist to Google your problems.
Group Icon

Joined: 23 Aug, 2008
Posts: 4,948



Thanked: 424 times
Dream Kudos: 50
Expert In: Being annoyed with lazy people.

My Contributions
Think I'll move this to the Other Languages forum.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 04:09AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month