Beispiel #1
0
/********************************** Main routine ************************************/
void main(){ 
  buf= (double*)calloc(N+1, sizeof(double)); 
	// initialize board and the audio port
  init_hardware();
	
  /* initialize hardware interrupts */
  init_HWI();
  	 		
  /* loop indefinitely, waiting for interrupts */  					
  while(1) 
  {};
  
}
Beispiel #2
0
/********************************** Main routine ************************************/
void main(){      

	// initialize board and the audio port
  init_hardware();
	
  /* initialize hardware interrupts */
  init_HWI();
  	 		
  /* loop indefinitely, waiting for interrupts */  					
  while(1) 
  {};
  
}
Beispiel #3
0
/********************************** Main routine ************************************/
void main()
{      

  	int k, j; // used in various for loops
  	
  
/*  Initialize and zero fill arrays */  

	inbuffer	= (float *) calloc(CIRCBUF, sizeof(float));	/* Input array */
    outbuffer	= (float *) calloc(CIRCBUF, sizeof(float));	/* Output array */
	inframe		= (float *) calloc(FFTLEN, sizeof(float));	/* Array for processing*/
    outframe	= (float *) calloc(FFTLEN, sizeof(float));	/* Array for processing*/
    inwin		= (float *) calloc(FFTLEN, sizeof(float));	/* Input window */
    outwin		= (float *) calloc(FFTLEN, sizeof(float));	/* Output window */

    intermediate_frame = (complex *) calloc(FFTLEN, sizeof(complex));	/* Processing window */
    intermediate_frame_cpy  = (complex *) calloc(FFTLEN, sizeof(complex));
	prevFrame  = (complex *) calloc(FFTLEN, sizeof(complex));
	nextFrame  = (complex *) calloc(FFTLEN, sizeof(complex));
    noise_est = (float *) calloc(OVERSAMP*FFTLEN, sizeof(float));	//Noise estimate. 2D array
	min_noise_est = (float *) calloc(FFTLEN, sizeof(float));
	/* initialize board and the audio port */
  	init_hardware();
  
  	/* initialize hardware interrupts */
  	init_HWI();    
  
/* initialize algorithm constants */  
                       
  	for (k=0;k<FFTLEN;k++)
	{                           
	inwin[k] = sqrt((1.0-WINCONST*cos(PI*(2*k+1)/FFTLEN))/OVERSAMP);
	outwin[k] = inwin[k]; 
	} 
  	ingain=INGAIN;
  	outgain=OUTGAIN;        

  	//Initialise the M bins
	for (k=0; k<OVERSAMP; k++)
		for (j=0; j<FFTLEN; j++)
			noise_est[k*FFTLEN+k] = 9999999999999999;				

	//Initialise K for enhancement1

	K_pole = exp(-TFRAME/time_const);
	K_pole_enh3 = exp(-TFRAME/time_const_enh3);

  	/* main loop, wait for interrupt */  
  	while(1) 	process_frame();
}
/********************************** Main routine ************************************/
void main(){      
  root=(node*)malloc(sizeof(node));
  root->next=NULL;
  create_buffer();
	// initialize board and the audio port
  init_hardware();
	
  /* initialize hardware interrupts */
  init_HWI();		
  /* loop indefinitely, waiting for interrupts */  					
  while(1) 
  {};
  
}
Beispiel #5
0
/********************************** Main routine ************************************/
void main()
{      

  /* setup arrays */
  init_arrays();  

	/* initialize board and the audio port */
  init_hardware();
	
  /* initialize hardware interrupts */
  init_HWI();

    
  /* loop indefinitely, waiting for interrupts */  					
  while(1) 
  {
  	  	wait_buffer();
  };
  
}
/********************************** Main routine ************************************/
void main()
{      

  	int k; // used in various for loops
  	
/*  Initialize and zero fill arrays */  

	inbuffer	= (float *) calloc(CIRCBUF, sizeof(float));	/* Input array */
    outbuffer	= (float *) calloc(CIRCBUF, sizeof(float));	/* Output array */
	inframe		= (float *) calloc(FFTLEN, sizeof(float));	/* Array for processing*/
    outframe	= (float *) calloc(FFTLEN, sizeof(float));	/* Array for processing*/
    inwin		= (float *) calloc(FFTLEN, sizeof(float));	/* Input window */
    outwin		= (float *) calloc(FFTLEN, sizeof(float));	/* Output window */
	M1			= (float *) calloc(FFTLEN, sizeof(float));	
	M2			= (float *) calloc(FFTLEN, sizeof(float));	
	M3			= (float *) calloc(FFTLEN, sizeof(float));	
	M4			= (float *) calloc(FFTLEN, sizeof(float));	
	N_i			= (float *) calloc(FFTLEN, sizeof(float));	
	N			= (float *) calloc(FFTLEN, sizeof(float));
	P			= (float *) calloc(FFTLEN, sizeof(float));
	buffer		= (complex *) calloc(FFTLEN, sizeof(complex));	
	/* initialize board and the audio port */
  	init_hardware();
  
  	/* initialize hardware interrupts */
  	init_HWI();    
  
	/* initialize algorithm constants */  
                       
  	for (k=0;k<FFTLEN;k++)
	{                           
	inwin[k] = sqrt((1.0-WINCONST*cos(PI*(2*k+1)/FFTLEN))/OVERSAMP);
	outwin[k] = inwin[k]; 
	} 
  	ingain=INGAIN;
  	outgain=OUTGAIN;        

 							
  	/* main loop, wait for interrupt */  
  	while(1) 	process_frame();
}
Beispiel #7
0
/********************************** Main routine ************************************/
void main()
{

    int k; // used in various for loops
    int ii; //used in 2d array init
    //int tau = TAU;  //time constant for input low pass filter --enhancement 1
    
/*  Initialize and zero fill arrays */  

    inBuffer    = (float *) calloc(CIRCBUFFLEN, sizeof(float)); /* Input array */
    outBuffer   = (float *) calloc(CIRCBUFFLEN, sizeof(float)); /* Output array */
    inFrame     = (float *) calloc(FFTLEN, sizeof(float));  /* Array for processing*/
    outFrame    = (float *) calloc(FFTLEN, sizeof(float));  /* Array for processing*/
    inWin       = (float *) calloc(FFTLEN, sizeof(float));  /* Input window */
    outWin      = (float *) calloc(FFTLEN, sizeof(float));  /* Output window */
    
    fft_input = (complex*)calloc(FFTLEN, sizeof(complex));  //Freq components of input
    lowPass = (float*)calloc(FFTLEN, sizeof(float));      //Low passed of freq components of input
    
  //  fftMag_noise = (float*)calloc(FFTLEN, sizeof(float));   //Mag of Freq components of best noise guess
    fft_gain = (float*)calloc(FFTLEN, sizeof(float));       //What we multiply input with to subtract noise
    
    /* intialise 2D array */
    /*noiseBuffers = (noiseBufferStruct*)calloc(NBUFFLEN, sizeof(noiseBufferStruct*));  //an array of noiseBuffer struct

    for(ii = 0; ii<NBUFFLEN; ii++){
        noiseBuffers[ii].fSpectrum = (float*) calloc(NFREQ, sizeof(float));
        noiseBuffers[ii].power = 0;
    }*/
    recentThreeFrames = (complex**)calloc(FFTLEN, sizeof(complex*));  //an array of compelex struct
    for(ii = 0; ii<3; ii++){
        recentThreeFrames[ii] = (complex*) calloc(FFTLEN, sizeof(complex));
    }

    inputLPF_k = exp(-TFRAME/tau); 
    noiseLPF_k = exp(-TFRAME/tau);
    inputLPF4_k = exp(-TFRAME/tau4); 
    noiseLPF4_k = exp(-TFRAME/tau4);
    M1  = (float *) calloc(FFTLEN, sizeof(float));
    M2  = (float *) calloc(FFTLEN, sizeof(float));
    M3  = (float *) calloc(FFTLEN, sizeof(float));
    M4  = (float *) calloc(FFTLEN, sizeof(float));
    minM= (float *) calloc(FFTLEN, sizeof(float));
    /*  noiseBuffer = calloc(OVERSAMP, sizeof(float *));
    for(ii = 0; ii < NFREQ; ii++) { 
        noiseBuffer[ii] = calloc(NFREQ, sizeof(float));
    }   */   
 
    /* initialize board and the audio port */
    init_hardware();
  
    /* initialize hardware interrupts */
    init_HWI();    
  
/* initialize algorithm constants */  
                       
    for (k=0;k<FFTLEN;k++){                           
        inWin[k] = sqrt((1.0-WINCONST*cos(PI*(2*k+1)/FFTLEN))/OVERSAMP);
        outWin[k] = inWin[k]; 
    } 
    inGain=INGAIN;
    outGain=OUTGAIN;        

                            
    /* main loop, wait for interrupt */  
    while(1)    process_frame();
}