NXP Sound Cards & Media Devices Driver

Posted By admin On 13/10/21
  1. Introduction
  2. NVIDIA Tegra Based Modules
  3. NXP/Freescale i.MX 6/7 Based Modules
  4. NXP/Freescale i.MX 8/8X Family Based Modules
  5. NXP/Freescale i.MX 8M Mini Based Modules
  6. NXP/Freescale Vybrid Based Modules
    1. WM9715L AC97 Capture

Jul 29, 2020 You generally want a sound card with signal-to-noise ratio over 100dB, but the best sound cards are in the 124dB range, which is a significant improvement. Channels - A lot of decent, budget-friendly sound cards typically support 5.1 channel audio, but you can spend a little more to get one that can handle 7.1 surround sound. Creative Sound Blaster Omni Surround 5.1 USB Sound Card with 600ohm Headphone Amp and Integrated Microphone. External Box: Yes System Requirements: On PC platform Intel Core 2 Duo or AMD equivalent processor at 2.2 GHz Microsoft Windows 8 / Windows 7 / Windows Vista 1GB RAM 600MB free hard disk space CDROM / DVDROM drive USB 2.0 port On Mac Platform Intel Core 2 Duo 2.8GHz Mac OS 10.6 & above. NXP Semiconductors is the co-inventor of NFC and we do not only provide services to professionals but we like to provide utilities and apps for the masses as well. We are keen to help you explore NFC features of your devices and to make you enjoy the technology.

Our Embedded Linux BSPs use the regular Linux audio subsystem Advanced Linux Sound Architecture (ALSA). The ALSA subsystem can be configured using amixer or alsamixer whereas playing and recording is possible using the ALSA utilities aplay and arecord. Higher-level frameworks such as GStreamer allow to convert audio streams (e.g. sample rate) and play/record encoded audio streams such as MP3, FLAC, or Ogg/Vorbis file formats. This article provides some example commands showing how to control and use audio with a Toradex Embedded Linux BSP.

First Steps

You can use the speaker-test to test audio, or alternatively aplay if you have an audio file deployed to the board. See a simple example below.

List the available audio devices:

In the example above, sgtl5000audio, the interface number 2, is the one connected to the headphone jack available on our carrier board. We'll use it. It may vary depending on your SoM; if you have questions, jump to the section specific to your SoM!

Sound Cards Creative

First, unmute the interface and adjust the volume:

Then, play a test sound:

Or, if you have a wave file on the board, for instance we'll use Gong.wav:

Audio Multi-channel Routing and Mixing Using alsalib

Bootlin has a great blog post on the topic, read Audio multi-channel routing and mixing using alsalib.

The Colibri T20 modules have a Wolfson WM9715L audio codec on board. To find pin assignment refer to the Hardware reference.

The Apalis T30, Apalis TK1 and Colibri T30 modules feature an on-module SGTL5000 audio codec:

HDA through HDMI

Please note that not all pixel clock frequencies allow for HDA being streamed through HDMI. E.g. at VESA VGA resolution you may get an error reported as follows:

Plus the number of available channels depends on the resp. HDMI device is connected to.

SGTL5000 Capture from Line-In

SGTL5000 Capture from Microphone

SGTL5000 Playback through Headphone

SPDIF through HDMI

The Colibri T20 provides SPDIF signals and Audio through HDMI.

Note that the HDMI sound card is only available if the video output is configured for HDMI and a monitor is attached.

Please note that not all pixel clock frequencies allow for SPDIF being streamed through HDMI. E.g. at VESA VGA resolution you may get an error reported as follows:

WM9715L AC97 Capture from Line-in

  • Colibri SODIMM pin 5 & 7 (LINEIN_L/R)
  • Iris: Audio header X9 pin 3 & 4 (Line IN R/L)
  • Colibri Evaluation Board: Audio jack X26 top blue
  • Orchid: Audio jack X11 top blue line in
  • MECS Tellurium: Audio jack X11 pin 1 & 2 (LINEIN_L/R)

First ALSA needs to be configured correctly using amixer.

Recording can then be done easily using GStreamer.

ALC898 HDA Capture from Line-in

  • Apalis Evaluation Board: HDA Audio jack X27 top blue

First ALSA needs to be configured correctly using amixer.

Recording can then be done easily using GStreamer.

WM9715L AC97 Capture from Microphone

  • Colibri SODIMM pin 1 (MIC_IN)
  • Iris: Audio header X9 pin 2 (requires biasing)
  • Colibri Evaluation Board: Audio jack X26 bottom pink
  • Orchid: Audio jack X11 bottom pink MIC in

ALC898 HDA Capture from Microphone

  • Apalis Evaluation Board: Audio jack X27 bottom pink

WM9715L AC97 Playback through Headphone

  • Colibri SODIMM pin 15 & 17 (HEADPHONE_L/R)
  • Iris: Audio jack X8
  • Colibri Evaluation Board: Audio jack X26 middle green
  • Orchid: Audio jack X11 middle green line out
  • Protea: Audio jack X53 line out
  • MECS Tellurium: Audio jack X11 pin 4 & 5 (HEADPHONE_LF/RF)

ALC898 HDA Playback through Headphone

  • Apalis Evaluation Board: Audio jack X27 middle green

MP3 Playback

The following example shows how to playback MP3 audio via GStreamer using hardware-accelerated MP3 decoding. Please note that the two numbers at the end specify which ALSA card and device to use for audio (e.g. alsasink device=hw:0,0 for WM9715L AC97 through headphones and alsasink device=hw:1,0 for SPDIF through HDMI).

All modules based on the NXP/Freescale i.MX 6 SoC or i.MX 7 SoC provides an on-module NXP/Freescale SGTL5000 audio codec. The SPDIF signals and Audio through HDMI are available only on modules based on i.MX 6 Soc.

HW accelerated decoding and encoding are provided by GStreamer plugins.

Note that the HDMI sound card is only available if the video output is configured for HDMI and a monitor is attached.

SGTL5000 Playback

The SGTL5000 is the default sound device, thus one does not need to specify it explicitly on the command line.

Playback of a wave file:

SGTL5000 Capture from Line-in

Stereo capture can be achieved using Line-in functionality. First, 'Capture Select' needs to be selected correctly in ALSA mixer:

Then recording in various sample rates is natively possible:

SGTL5000 Capture from Microphone

Change the input channel to MIC_IN:

Nxp sound cards redeem

In contrast to Line-in, Microphone capture is mono anyway, hence we can save some space by only recording one channel. The argument -V offers a VU meter which helps to see whether there is any input and if its volume is at a reasonable level.

SPDIF Playback

Apalis features dedicated SPDIF pins and the Apalis Evaluation board provides an Optical Transmitter. Thus the Apalis iMX6 image has the SPDIF feature enabled in our default device tree, while for the Colibri iMX6 and Colibri iMX7 it is not enabled.

HDMI Playback

In addition to the video data stream, HDMI is able to carry audio data as well.Note that depending on the video resolution/framerate used, that feature might not be available.HDMI Playback is currently unavailable for Colibri i.MX7.

MP3 Playback

The following example shows how to playback MP3 audio via GStreamer using hardware-accelerated MP3 decoding. Please note that the two numbers at the end specify which ALSA card and device to use for audio (e.g. alsasink device=hw:0,0 for SGTL5000, alsasink device=hw:1,0 for SPDIF and, alsasink device=hw:2,0 for audio through HDMI, compare with /proc/asound/cards).

Additional GStreamer pipelines can be found on the Freescale community website here.

Additional encoders and decoders can be verified with GStreamer command gst-inspect.

Alternatively, using the playbin plugin, which sets up the pipeline automatically:

Recording MP3

To record and encode to MP3, the following GStreamer command can be used:

The Colibri iMX6ULL does not feature an audio codec on the module. However, it is possible to access all three audio interfaces placing an external audio codec.

However, the Colibri iMX6ULL features a Medium Quality Sound (MQS) interface that can be used to generate medium quality audio via a standard GPIO. Please refer to the module datasheet for more information.

Note: This section currently only applies to Apalis iMX8

SGTL5000 Playback

SGTL5000 Capture from Line-in

SGTL5000 Capture from Microphone

SPDIF Playback

SPDIF Recording

NXP Sound Cards & Media Devices Driver

This was done with an optical to electronic medium converter and the signalhooked up to MXM3_217

HDMI Playback

The Verdin iMX8M Mini does not feature an audio codec on the module. However, it is possible to access all Synchronous Audio Interfaces (SAI) placing an external audio codec. The SAI interfaces can beused as I2S (Recommended) or AC97. An I2S is connected to the Wi-Fi module for Bluetooth audio features. Please refer to the module datasheet for more information.

WM8904 Audio Codec

Verdin Development Board and Dahlia Carrier Board features an analog audio interface based on the WM8904CGEFL/RV audio codec IC from Cirrus Logic.

To check the available sound cards, use the cat /proc/asound/cards command. The expected result on a Verdin iMX8MM:

To record audio, you might need to run the following command to unmute the capture device:

WM8904 Capture from Microphone

WM8904 Capture from Line-in

WM8904 Playback

WM8904 (MP3) Playback

Within the Vybrid module family, only Colibri VF61 supports analog audio. Audio is handled by the onboard Wolfson WM9715L audio codec connected via a AC97 audio link to the Vybrid SoC. The audio codec driver is called wm9712-codec, since it was initially created for the almost identical WM9712L codec.

WM9715L AC97 Playback

Playback of a WAVE file:

Note: Some parts of the AC97 protocol are realized in software. To make Software AC97 efficient, a rather large buffer is used to prepare several AC97 frames in a batch. However, using buffering does not allow the use of the variable sample rate (VRA) feature of the AC97 link during playback since that would require a response that depends on the request flag of the last received frame. Therefore, the hardware is only able to transfer 48kHz sample rate PCM streams. The ALSA audio stack is able to re-sample the sample rate dynamically, the only difference is that a file with a sample rate other than 48kHz requires somewhat more CPU resources while playback (<1% vs ~3%). Implementing the AC97 protocol without buffering would lead to a much higher CPU load than relying on ALSA's re-sampling feature.

The hardware parameter of the PCM stream during playback can be seen via the proc file system:

Playback of encoded audio formats can be achieved using GStreamer. The Colibri VF61 root filesystem does not provide GStreamer by default, however it is installable via Angstrom feeds:

The following GStreamer pipeline allows to playback Ogg Vorbis encoded audio files:

WM9715L AC97 Capture

Nxp Sound Cards For Kids

The WM9715L has two audio ADCs hence allowing stereo audio capture. The input to these capture ADCS can be individually selected through the ALSA Capture Select controls. Capture volume and boost are handled after the channel selection, hence the volume applies for the Microphone as well as for Line-In capturing.

Two record volume modes can be selected, a standard AC97 1.5dB gain steps and an extended mode using 0.75dB gain steps. The extended mode (0.75dB gain steps) has also a larger gain range (-17.25-+30db), so we recommend using the extended mode.

The record volume can then be set to a value between 0-63 (which mappings linearly to the gain ranges above).

Depending on the input (e.g. microphones) a boost might be necessary to increase the ADC signal by +20dB.

Line-in

Stereo capture can be achieved using Line-in functionality. First, the 'Capture Select' needs to be selected correctly in ALSA mixer:

Then recording in various sample rates is natively possible:

To record the Ogg Vorbis audio format, the following GStreamer command can be used

Microphone

The Colibri standard has only one microphone input, which is connected to Mic 1 of the audio codec. The codec internally samples the same signal with both ADCs, hence the ALSA stack receives a stereo signal. However, since the signals are the same, we can save some space by only recording one channel. The argument -V offers a VU meter which helps to see whether there is any input and if its volume is on a reasonable level.

Sound Cards 7.1

Note: The volume controls 'Mic 1' and 'Mic 2' do not change the volume when capturing from the microphone. Those volume controls are only active if the sidetone path is enabled (e.g. direct path from microphone to headphone). Use the main capture volume to control the microphone volume.

CONFIG_SND_USB_AUDIO is enabled, so you may use USB audio hardware.
If you get the following error when recording from USB, enable the CONFIG_USB_EHCI_TT_NEWSCHED kernel configuration.