How to configure, record and play audio using an i.MX 8MIC-RPI-MX8 Board.

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure, record and play audio using an i.MX 8MIC-RPI-MX8 Board.

No ratings

How to configure, record and play audio using an i.MX 8MIC-RPI-MX8 Board.

Hello, here Jorge. On this post I will explain how to configure, record and play audio using an i.MX 8MIC-RPI-MX8 Board.

Requirements:

The 8MIC-RPI-MX8 accessory board is designed for voice enabled application prototyping and development on the i.MX 8M family. The board plugs directly into the 40-pin expansion connector on the i.MX 8M Mini and Nano EVK’s.

Some features about this board are:

  • 8 PDM Microphones
  • 8 monochrome LEDs
  • 4 multi-color LEDs
  • 2 status LEDs
  • 4 pushbuttons
  • Microphone Mute Switch
  • Microphone geometry switch

Connecting the i.MX 8MIC-RPI-MX8 Board.

The i.MX 8MIC-RPI-MX8 Board has a 40-pin expansion connector that you can plug it directly to the EVK board. Ensure that pin 1 of the 8MIC-RPI-MX8 is aligned with pin 1 on the EVK J1001 as is showed on the next figure:

Jorge7u7_0-1670005208140.png

 Selecting the device tree on the board.

Once the pre-compiled image is flashed on the board (Flashing Linux BSP using UUU) and you connected the 8MIC-RPI-MX8 it is necessary to select the correct device tree to handle 8MIC board. On U-boot check the available .dtb files on the BSP using the next command:

u-boot=> fatls mmc 2:1

And you will get the corresponding list of .dbt files:

Jorge7u7_1-1670005485949.png

 On this case we are working with an I.MX 8M Mini EVK and the corresponding .dtb file is:

imx8mm-evk-8mic-revE.dtb

To select it you need to set the environment variable and save it with:

u-boot=> setenv fdtfile imx8mm-evk-8mic-revE.dtb		
u-boot=> saveenv

Doble check it using:

u-boot=> printenv fdtfile
Jorge7u7_2-1670005606208.png

 

Now it is time to boot Linux using the next command:

u-boot=> boot 

Recording audio with the i.MX 8MIC-RPI-MX8 Board.

The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI functionality to the Linux operating system. ALSA has the following significant features:

  • Efficient support for all types of audio interfaces, from consumer sound cards to professional multichannel audio interfaces.
  • Fully modularized sound drivers.
  • SMP and thread-safe design.
  • User space library (alsa-lib) to simplify application programming and provide higher level functionality.
  • Support for the older Open Sound System (OSS) API, providing binary compatibility for most OSS programs.

Once we are on Linux, we can check our audio codecs detected on the board using:

arecord -l
Jorge7u7_3-1670005796126.png

 

Now, to record audio we need to use the ALSA arecord command to start recording with IMX8 boards, there are different options that you can check on the next link. On this case we are going to use the next:

arecord -D hw:imxaudiomicfil -c8 -f s16_le -r48000 -d10 sample.wav

-D: selects the device.

-c: selects the number of channels on the recording.

-f: selects the format.

-r: selects the sample rate.

-d: determinate the duration recording time in seconds.

sample.wav: Is the name of the resulting audio file.

Running the last command, we started to record audio. It is time to make some noise and record it!

Jorge7u7_4-1670005841083.png

 

Playing audio from IMX8 boards.

Now it is time to connect our headphones or speakers to the jack.

Jorge7u7_5-1670005931730.png

 

Also, as on arecord command you can check the devices where you can play audio from the board using the next command:

aplay -l

And you will get all the codecs to play audio:

Jorge7u7_6-1670005960006.png

 

To play our recordings we need to use the ALSA aplay command, it is important to select the correct audio codec to hear the audio from the jack on the board:

aplay -Dplughw:3,0 sample.wav

-D: selects the device.

sample.wav: Is the name of audio file to play

Jorge7u7_7-1670006012397.png

 

Hope this will helpful for people who wants to record audio using PDM microphones and playing audio from IMX8 boards.

Best regards.

Version history
Revision #:
1 of 1
Last update:
‎12-02-2022 11:38 AM
Updated by: