This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

McaspPlayBk OMAPL138 LCDK, C6748 LCDK filter routine

Other Parts Discussed in Thread: OMAPL138

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

  •  Also, data buffers are placed in L2 IRAM. Also, have noticed that this noise starts even before anything is fed into the mic of the OMAPL138. Any suggestions would be helpful. Thanks!

  • Will check with experts and get back to you. Thank you.
  • ok, thanks. Also, these are the plots of filtering a composite 500Hz and 2kHz signal using 1kHz highpass filter. As expected, the 2kHz signal is seen in the output buffer after filtering. The plots are as shown below. However, the periodic bleeping sound continues in background and strangely i've noticed it starts even before feeding input at the microphone. 

  • Can you kindly confirm the format in which data is dumped from DMA in the location pointed to rxBufPtr[lastFullRxBuf] ?

    Based on the code comments from the audio playback starterware example, i presume, each sample is 32 bits (containing 16 bits each left and right channel data) and total number of samples is defined by: NUM_SAMPLES_PER_AUDIO_BUF. So using a union to access each 32-bit data word from DMA Rx buffer, my code now looks something like this:

    volatile union {
    unsigned int UINT;
    short Channel[2];
    } CodecIn, CodecOut;


    for(idx1=0; idx1<NUM_SAMPLES_PER_AUDIO_BUF; idx1++)
    {
    CodecIn.UINT = (unsigned int) (*(dummy+(idx1*4)));
    inputDataRight[idx1+NUM_OF_TAPS-1] = (float)CodecIn.Channel[RIGHT];
    inputDataLeft[idx1+NUM_OF_TAPS-1] = (float)CodecIn.Channel[LEFT];
    }


    where each of the floating point buffers "inputDataRight" and "inputDataLeft" are of size NUM_SAMPLES_PER_AUDIO_BUF.


    Kindly confirm if the input data access format is correct. I'm under stringent timelines.

    Thanks and Regards
    Smita

  • Hi Raja, Is there any update on this? Thank you!