C PROGRAM TO IMPLEMENT NOISE CANCELLATION
#1

Code:
#include "xyzcfg.h"

#include "dsk6713.h"
#include "dsk6713_aic23.h"
#define beta 1E-12            //rate of convergence    
#define N 30
short int adaptive_filter(short int ,short int );
float delay[N];
float w[N];


//union{unsigned int uint; short channel[2];} AIC23_data;

DSK6713_AIC23_Config config = {\
    0x0017,  /* 0 DSK6713_AIC23_LEFTINVOL  Left line input channel volume */ \
    0x0017,  /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\
    0x00d8,  /* 2 DSK6713_AIC23_LEFTHPVOL  Left channel headphone volume */  \
    0x00d8,  /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */ \
    0x0011,  /* 4 DSK6713_AIC23_ANAPATH    Analog audio path control */      \
    0x0000,  /* 5 DSK6713_AIC23_DIGPATH    Digital audio path control */     \
    0x0000,  /* 6 DSK6713_AIC23_POWERDOWN  Power down control */             \
    0x0043,  /* 7 DSK6713_AIC23_DIGIF      Digital audio interface format */ \
    0x0081,  /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */            \
    0x0001   /* 9 DSK6713_AIC23_DIGACT     Digital interface activation */   \
};


/*
*  main() - Main code routine, initializes BSL and generates tone
*/
void main()
{
    DSK6713_AIC23_CodecHandle hCodec;
  
    int l_input, r_input;
    int l_output, r_output, T;
    
    /* Initialize the board support library, must be called first */
    DSK6713_init();
    
    /* Start the codec */
    hCodec = DSK6713_AIC23_openCodec(0, &config);
        
    DSK6713_AIC23_setFreq(hCodec, 1);

for (T = 0; T < 30; T++)
   {
       w[T] = 0;                  //init buffer for weights
       delay[T] = 0;              //init buffer for delay samples
   }  

        while(1)
        {
            
            /* Read a sample to the left channel */
            while (!DSK6713_AIC23_read(hCodec,&l_input));
            
            /* Read a sample to the right channel */
            while (!DSK6713_AIC23_read(hCodec, &r_input));          
                
            l_output=(short int)adaptive_filter(l_input,r_input);
            r_output=l_output;
            
            /* Send a sample to the left channel */
            while (!DSK6713_AIC23_write(hCodec, l_output));

            /* Send a sample to the right channel */
            while (!DSK6713_AIC23_write(hCodec, r_output));
        }
          
    /* Close the codec */
    DSK6713_AIC23_closeCodec(hCodec);
}
short int adaptive_filter(short l_input1,short r_input1)            //ISR
{                        
  short i,output,T;
  float yn=0, E=0, dplusn=0, desired=0, noise=0;    
  
  desired = l_input1;
  noise = r_input1;
  dplusn = desired + noise;         //desired+noise
  delay[0] = noise;                //noise as input to adapt FIR
    
  for (i = 0; i < N; i++)          //to calculate out of adapt FIR
    yn += (w[i] * delay[i]);       //output of adaptive filter
  E = (desired + noise) - yn;      //"error" signal=(d+n)-yn  
  for (i = N-1; i >= 0; i--)       //to update weights and delays
   {            
    w[i] = w[i] + beta*E*delay[i]; //update weights  
       delay[i] = delay[i-1];       //update delay samples  
   }  
         output=((short)E);    //error signal as overall output  
  
      //output=((short)dplusn);//output (desired+noise)
              //overall output result    
  return(output);
}

PROCEDURE :
 Switch on the DSP board.
 Open the Code Composer Studio.
 Create a new project
Project  New (File Name. pjt , Eg: noisecancellation.pjt)
 Initialize on board codec.
Note: “Kindly refer the Topic Configuration of 6713 Codec using BSL”
 Add the above ‘C’ source file to the current project (remove codec.c source file from the project if you have already added).
 Desired Signal  400 Hz
Noise  3.0 KHz
Input a desired sinusoidal signal into the Left channel and Noise signal of 3KHz into the Right channel
 Build the project.
 Load the generated object file(*.out) on to Target board.
 Run the program.
 Observe the waveform that appears on the CRO screen. Verify that the 3 KHz noise signal is being cancelled gradually
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: c program to implement dsa algorithm, reservation cancellation c requisition form download, implement dfa, acoustic noise cancellation usind, adaptive noise cancellation code using c, implement deadlock through simulation pdf, mobile shop brisbanee cancellation wikipedia,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  VHDL program for Booth’s Multiplier smart paper boy 2 5,652 20-04-2013, 11:59 AM
Last Post: T
  Program in “LEX” to count number of vowels and consonants seminar class 2 9,623 22-03-2013, 10:20 AM
Last Post: computer topic
  Program in “LEX” to count number of Identifiers and Keywords seminar class 1 4,841 28-01-2013, 03:21 PM
Last Post: Guest
  Implement DES Algorithm smart paper boy 1 3,921 16-02-2012, 12:34 PM
Last Post: seminar paper
  PROGRAM TO RECOGNIZE A STRING WITH THREE COSECUTIVE 0’s smart paper boy 0 1,663 10-08-2011, 11:44 AM
Last Post: smart paper boy
  : PROGRAM TO IDENTIFY VOWELS AND CONSONANTS GIVEN AS INPUT smart paper boy 0 2,404 10-08-2011, 11:44 AM
Last Post: smart paper boy
  Program to Encrypt and decrypt a text data using RSA algorithm smart paper boy 0 2,530 10-08-2011, 11:43 AM
Last Post: smart paper boy
  : Implement Diijkstra’s algorithm to compute the shortest path through a graph smart paper boy 0 1,358 10-08-2011, 11:42 AM
Last Post: smart paper boy
  Program the CRC 12 on a data set of characters smart paper boy 0 1,767 10-08-2011, 11:42 AM
Last Post: smart paper boy
  Program to implement the data link layer framing method character stuffing smart paper boy 0 7,954 10-08-2011, 11:41 AM
Last Post: smart paper boy

Forum Jump: