Get Mic recording in SLN-LOCAL2-IOT

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Mic recording in SLN-LOCAL2-IOT

582 Views
dashdwan
Contributor III

Hi,

I'm working on SLN-LOCAL2-IOT board.

The use case is as follows:

  • The audio from the mic should be captured first and then send to another device via I2S interface.

My queries are below:

  1. How is it possible to capture the input audio from this board? Is there any sample code available for reference?
  2. I tried the usb-aec alignment tool to check the audio quality. I find that there are some missing parts in the input audio (as shown in the image below). What could be it's cause and how can i get a clear audio?

Screenshot from 2022-01-04 13-00-20.png

Here I have played a sine tone with 1kHz frequency.

 

Labels (1)
0 Kudos
8 Replies

563 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @dashdwan ,

   Happy New Year!

  My colleague transfer your question case to me, so I check it now.

  Please also give me your 1kHz frequency audio source, I will also try to test it on my side, just to check whether I also meet your issues or not.

  About the mic record, usb-aec alignment tool should can help to record it. This project should can capture the dmic directly:

\SDK_2_8_0_SLN-LOCAL2-IOT\boards\sln_local2_iot\sln_voice_examples\usb_aec_alignment_tool

 Do you meet the capture issues?

  Please give me details about your issues.

Best Regards,

kerry

 

0 Kudos

558 Views
dashdwan
Contributor III

Hi @kerryzhou 

Happy New Year!!

I gave the sine tone from one of those available on YouTube, which I played directly from another device.

Yes I meet capture issues in usb_aec_alignment tool.

0 Kudos

553 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @dashdwan 

   Except the 1HZ wave, do you try to play the continuous music? Then use the Audacity record it, and play it, whether you still meet the interrupt issues?

  BTW, which detail mic you meet issues, as the usb_aec_alignment_tool can record the different mic with the following steps:

----------------

1. The device will enumerate as a VCOM device. Locate the COM Port of the device
2. In the Scripts folder of the code, there is a python script called parse_audio_streams.py
3. Ensure Python 3.7 is installed
4. Ensure all python dependencies are resolved via pip (pyserial, wave, threaded)
5. Run the script "python parse_audio_streams.py"
6. Enter the name of the test which will subsequently be the name of the folder and the audio captures inside this folder
7. Enter the number of microphones that have neen configured in the code (acceptable values: '2' and '3')
8. Enter the COM number (3/4/5) to which the device is connected
9. Press Enter to start capturing the data
10. The device will then start capturing audio real time and outputting the data into the files within the <test_name> directory
11. Once captured, type 'q' and press Enter or press 'CTRL + C' to terminate the process

---------------

So, now just with the SLN-LOCAL2-IOT original board, tell me your used record command. Then I will use my SLN-LOCAL2-IOT board to test it.

PS: In the prevous time, I get the internal information that our solution already provide the support for you about this DMIC and SAI issues, just check with you, do you get the support except the community?

Best Regards,

Kerry

0 Kudos

539 Views
dashdwan
Contributor III

Hi @kerryzhou 

Was able to solve this problem. Actually there were multiple pdm_pcm_definitions.h file and the change in the macro USE_SAI2_MIC was not getting reflected. Now that's working fine!

 

The query that's left is regarding sending data from DMIC to processor.

We were able to send stereo audio through the SAI3 interface to the host processor.

Then we recorded this audio (“LED demo”, “can i help you”) from the host processor with arecord command at 48kHz sampling rate. The audio seemed to be a high pitch one and very fast. Then we tried recording with lower sampling rates and at 22050Hz, the audio was sampled properly. But I couldn't see any configuration changes in the local-demo project.

Then we tried recording the mic audio from the host processor with arecord command at 22050 Hz sampling rate. A similar issue popped up. Then on reducing the sampling rate to 8000 Hz, a more better audio was recorded.

We are using the SLN_AMP_Write() API to write the mic data from audio_processing_task function inside audio_processing.c file
Case.1:
SLN_AMP_Write(cleanAudioBuff, PCM_SINGLE_CH_SMPL_COUNT * 2);

Case.2:
SLN_AMP_Write(pcmIn, PCM_SINGLE_CH_SMPL_COUNT * PCM_AMP_SAMPLE_RATE_HZ / PCM_SAMPLE_RATE_HZ);

These arrays were sent to the host processor and in each case the data obtained is as shown below when recorded at 8000Hz sampling rate. As you can see, there are some noise present in both cases.

What could be causing the audio to be sampled at 8000Hz? Can it be altered?
Which of these arrays (or any other alternatives) would you recommend to get a proper audio?

0 Kudos

521 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @dashdwan ,

  Seems you miss to add the issue array, as you mentioned:

These arrays were sent to the host processor and in each case the data obtained is as shown below when recorded at 8000Hz sampling rate. As you can see, there are some noise present in both cases.

 But I didn't find your mentioned data.

 Could you please add it again.

  Please also tell me how to test it, if you use the 48kHz sampling to the wave file, whether the play is normal or not? I mean record directly, not use the RT chip another SAI send to your PC.

 

Best Regards,

Kerry

0 Kudos

517 Views
dashdwan
Contributor III

Hi @kerryzhou 

Those arrays are pcmIn & cleanAudioBuff.

I have missed to add the files before, so i have added them below.

For testing, i have made the hardware setup for I2S communication (SAI3) between host processor and SLN-LOCAL2-IOT board. Then the SLN_AMP_Write() API was used to send these arrays to host processor. From host processor this was recorded using the "arecord" command

0 Kudos

471 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @dashdwan ,

  I am so sorry for my later reply, as these days, really a lot of cases in the queue, a little overflow to test.

  Today, I help you test it.

  Let's talk from begining, I am testing the SDK original code:

sln_local2_iot_usb_aec_alignment_tool

Then use the parse_audio_streams.py run it to record 3 mic, I can hear the voice clearly, please check my attached record .wav, 

command.jpg

As the code defines:

#define USE_SAI2_MIC (1U)

So, in fact, it is 3 mic.

You can hear the voice is very clear.

I didn't modify the code, when you test it the same as me, do you also have no noisy?

If yes, then your noisy is only happen after your code modification, please also tell me which detail area you modified in our SDK sln_local2_iot_usb_aec_alignment_tool.

Any updated information, kindly let me know.

Best Regards,

Kerry

0 Kudos

569 Views
dashdwan
Contributor III

Hi @kerryzhou 

Do you have any idea regarding this?

0 Kudos