AnsweredAssumed Answered

How to access recorded audio using SAI interface of MIMXRT1050_EVK

Question asked by Ajith Kumar on Sep 9, 2018
Latest reply on Sep 17, 2018 by Wigros Sun

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.

Outcomes