How to access recorded audio using SAI interface of MIMXRT1050_EVK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to access recorded audio using SAI interface of MIMXRT1050_EVK

569 Views
ajith_kumars
Contributor I

I want to process the recorded audio, using SAI interface.

The source of the example code I am using is attached.

Below is the part of code I am interested in

    while(1)
    {
        if(emptyBlock > 0)
        {
            xfer.data = Buffer + rx_index * BUFFER_SIZE;
            xfer.dataSize = BUFFER_SIZE;
            if(kStatus_Success == SAI_TransferReceiveNonBlocking(DEMO_SAI, &rxHandle, &xfer))
            {
                rx_index++;
            }
            if(rx_index == BUFFER_NUMBER)
            {
                rx_index = 0U;
            }
        }
        if(emptyBlock < BUFFER_NUMBER)
        {
            xfer.data = Buffer + tx_index * BUFFER_SIZE;
            xfer.dataSize = BUFFER_SIZE;
            if(kStatus_Success == SAI_TransferSendNonBlocking(DEMO_SAI, &txHandle, &xfer))
            {
                tx_index++;
            }
            if(tx_index == BUFFER_NUMBER)
            {
                tx_index = 0U;
            }
        }

Does xfer.data contain the audio data?
If I just want to record the data and do not want to play it back is it safe to assume that I can comment out the

if(emptyBlock < BUFFER_NUMBER) block?

Note: I want to feed the audio data into another function which does further processing.

Labels (1)
0 Kudos
1 Reply

433 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi, Ajith,

   See below, please!

(1)Does xfer.data contain the audio data?

Yes.

(2)if(emptyBlock < BUFFER_NUMBER) block?

Yes , the statement and those behind it are all for playback, you can comment them if you don't want to play back at the same time.

Try it ,please!

Have a nice day!

TIC Weidong Sun

0 Kudos