This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

HOW TO ANALYSIS PDM DATA CONTINUOUSLY IN NRF52832

For my audio application, I need to convert pcm out from pdm module(nrf52832) to an audio format (mp3,wav) continuously. Is there any method or procedure for this??...or any sample example?? please help... Actually, MIC is outing pdm data, PDM_IRQHandler runs in code but i don't know whether data is correct or not...?? how can i process that data in buffers without storing data to internal flash.

void PDM_IRQHandler(void)
{
    if (nrf_pdm_event_check(NRF_PDM_EVENT_END))
    {
        nrf_pdm_event_clear(NRF_PDM_EVENT_END);      
        //Buffer is ready to process.
        if (nrf_pdm_buffer_get() == m_cb1.buffers[0])
        {
				//	printf("%d",*(m_cb1.buffers[1]));
			  //	printf("%d",*(m_cb1.buffers[1]));
           m_cb1.event_handler(m_cb1.buffers[1], m_cb1.buffer_length);
				//	drv_audio_pdm_event_handler(m_cb1.buffers[1], m_cb1.buffer_length);
        }
        else
        {
            m_cb1.event_handler(m_cb1.buffers[0], m_cb1.buffer_length);
        }
    }
    else if (nrf_pdm_event_check(NRF_PDM_EVENT_STARTED))
    {
        nrf_pdm_event_clear(NRF_PDM_EVENT_STARTED);
        m_cb1.status = NRF_PDM_STATE_RUNNING;
        
        //Swap buffer.
        if (nrf_pdm_buffer_get() == m_cb1.buffers[0])
        {
            nrf_pdm_buffer_set(m_cb1.buffers[1],m_cb1.buffer_length);
        }
        else
        {
            nrf_pdm_buffer_set(m_cb1.buffers[0],m_cb1.buffer_length);
        }
    }
    else if (nrf_pdm_event_check(NRF_PDM_EVENT_STOPPED))
    {
        nrf_pdm_event_clear(NRF_PDM_EVENT_STOPPED);
        nrf_pdm_disable();
        m_cb1.status = NRF_PDM_STATE_IDLE;
    }
}
Parents
  • The output of the PDM module is raw PCM data which is stored in buffers in RAM. The buffers can be as long as you want (as long as they fit in RAM of course). Nordic doesn't provide any solution for converting PCM to audio files, so I suggest you look for that somewhere else. Converting PCM to WAV seems to be a matter of generating a proper file header and place it before your raw PCM data: Link.

Reply
  • The output of the PDM module is raw PCM data which is stored in buffers in RAM. The buffers can be as long as you want (as long as they fit in RAM of course). Nordic doesn't provide any solution for converting PCM to audio files, so I suggest you look for that somewhere else. Converting PCM to WAV seems to be a matter of generating a proper file header and place it before your raw PCM data: Link.

Children
No Data
Related