Hi All,
With reference to the mcaspPlayBk.c module for audio playback, i'm trying to plug in a filter routine to filter data before being transmitted. Im able to see expected filter outputs both time and frequecy domain on a DSO. However, when i listen to the filtered audio, along with audio there is constant periodic bleeps. It could be a buffering issue, could you please have a look at the code snippet below and give me your suggestions/feedback.
Further details regarding code and code snippet are below:
- input, filter taps and output buffer are 8 byte aligned based on the documentation
- input, filter taps and output buffer are floating point
-buffer "buftemp" is of type short and is used to receive and transmit to the DMA buffers (i'm able to get monochannel data via this method, basically in the receive buffer pointer "rxBufPtr[lastFullRxBuf" there are 2 valid bytes followed by 2 zero bytes (and the pattern repeats)
- NUM_SAMPLES_PER_AUDIO_BUF has been set to 2048
-Sampling frequency: 8000
(Also the filter routine works fine in non-real time)
memcpy((short *)buftemp,(void *)rxBufPtr[lastFullRxBuf], AUDIO_BUF_SIZE); for(idx1=0;idx1<NUM_SAMPLES_PER_AUDIO_BUF;idx1++) { inputDemoSignal[idx1+NUM_OF_TAPS-1]=(float)(buftemp[idx1*2]); } //Filter blockprocessing DSPF_sp_fir_gen(inputDemoSignal,coeffsFilter,outputDemoSignal,NUM_OF_TAPS, NUM_SAMPLES_PER_AUDIO_BUF); //Copy buffer for trasmit for(idx1=0;idx1<NUM_SAMPLES_PER_AUDIO_BUF;idx1++){ buftemp[idx1*2]= _spint(outputDemoSignal[idx1] * 65536) >> 16; //inputDemoSignal[idx1+NUM_OF_TAPS]; //=<<6 dataOutBufferFull[(idx%6144)++]=buftemp[idx1*2]; } //Re-initialize filter state for next buffer processing for(idx1=0;idx1<NUM_OF_TAPS-1;idx1++)//idx1<NUM_OF_TAPS inputDemoSignal[idx1] = inputDemoSignal[NUM_SAMPLES_PER_AUDIO_BUF + idx1]; //Copy data to transmit DMA buffer memcpy((void *)txBufPtr[lastSentTxBuf],(void *)buftemp, AUDIO_BUF_SIZE);
Thanks and regards,
Smita