Project

General

Profile

Linux Audio Support

Audio support for linux is based on the Linux for Qualcomm Software support. Information included here can also be reviewed on Qualcomm's site:

https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-16/overview.html?vproduct=1601111740013072&version=1.5&facet=Audio#audio-overview

Hardware Overview

A hardware block diagram of the audio subsystem is shown below. The following components are involved on the MitySOM-QC6490 devkit:

  • Application processor – This is the ARM CPU complex and handles audio processing tasks, including:
    • Managing audio record and playback
    • Decoding audio formats
    • Using LPAI for postprocessing tasks
  • Low Power AI (LPAI) – Subsystem that runs audio playback/record and voice-activation (VA) algorithms. It integrates with a dedicated Qualcomm® Hexagon™ Processor (QDSP6) and a low power island (LPI).
  • Audio codec – For the devkit this is a SGTL5000 and it is connected to the LPAI via I2S0 connections. It provides:
    • Analog-to-Digital Converter (ADC) for capturing microphone / line-in signals and converting them to I2S
    • Digital-to-Analog Converter (DAC) for converting stereo I2S data to analog outptus for either the Headphones or line-out signals
  • Headphone / Mic Jack

Software Overview (linux)

Note: Audio support for the MitySOM-QC6490 Devkit is not available in the 1.0 release of the BSP.

Examples

This section covers some basic examples to checkout the audio functions on the Devkit J8 (CITA standard headphone+mic) audio jack.

Capture from microphone

Using gstreamer

The development kit includes a pulsesink gstreamer plugin to support capture from pulse audio capture channels.

To capture a WAV file using streamer commands from the microphone:

gst-launch-1.0 pulsesrc ! audioconvert ! audioresample ! wavenc ! filesink location=output.wav

The gstreamer tools in the reference filesystem image also include support for recording an mp3 file or a flac compressed file with the following example commands:

gst-launch-1.0 pulsesrc ! audioconvert ! audioresample ! lamemp3enc bitrate=192 ! id3v2mux ! filesink location=output.mp3
gst-launch-1.0 pulsesrc ! flacenc ! flacparse ! filesink location=capture.flac

Using pulseaudio tools

Use the following command to record a WAV file from the microphone. Hit CTRL-C to stop:

parec -v --rate=48000 --format=s16le --channels=1 --file-format=wav test.wav

Playback to headphones

Using gstreamer

The development kit includes a pulsesink plugin that will configure the back end output of a PCM stream to route to the pulseaudio framework.

To play a simple 400 Hz test tone to the headphones (in stereo), run the following command. Note: all gstreamer commands can be cancelled / terminated using CTRL-C.

gst-launch-1.0 audiotestsrc ! audioconvert ! audio/x-raw,channels=2 ! pulsesink

To play an mp3 file, the following command could be used:

gst-play-1.0 02-Jump.mp3

Using pulseaudio tools

You can play back a WAV file, such as the one attached on this page, with the following command:

paplay LRMonoPhase4.wav -v

SGTL5000 CODEC and Controls

The linux SGTL5000 codec driver includes several controls for the routing and data within the SGTL5000 chip (between the jacks and the I2S0 bus). A top level block diagram of the SGTL5000 is shown below:

From the picture, the 3 signal audio jack is connected to the Headphone outputs (stereo) and microphone inputs (mono) for use with a standard analog headset with microphone. The line in and line out signals are routed to the expansion header J23. By default, playback commands will be routed to the HeadPhone interface and capture commands will capture from the microphone input.

The available controls of the output SGTL5000 codec can be listed (along with their settings) with the tinymix command as shown below.

root@qcs6490-mitysom-devkit:~# tinymix contents
Number of controls: 28
ctl     type    num     name                                            device  value
0       INT     2       PCM Playback Volume                             0144, 144 (range 0->192)
1       INT     2       Capture Volume                                  012, 12 (range 0->15)
2       BOOL    1       Capture Attenuate Switch (-6dB)                 0Off
3       BOOL    1       Capture ZC Switch                               0On
4       BOOL    1       Capture Switch                                  0On
5       INT     2       Headphone Playback Volume                       0110, 110 (range 0->127)
6       BOOL    1       Headphone Playback Switch                       0On
7       BOOL    1       Headphone Playback ZC Switch                    0On
8       INT     1       Mic Volume                                      00 (range 0->3)
9       INT     2       Lineout Playback Volume                         016, 16 (range 0->31)
10      BOOL    1       Lineout Playback Switch                         0Off
11      INT     1       DAP Main channel                                032768 (range 0->65535)
12      INT     1       DAP Mix channel                                 00 (range 0->65535)
13      BOOL    1       AVC Switch                                      0Off
14      BOOL    1       AVC Hard Limiter Switch                         0Off
15      INT     1       AVC Max Gain Volume                             01 (range 0->2)
16      INT     1       AVC Integrator Response                         01 (range 0->3)
17      INT     1       AVC Threshold Volume                            012 (range 0->96)
18      INT     1       BASS 0                                          047 (range 0->95)
19      INT     1       BASS 1                                          047 (range 0->95)
20      INT     1       BASS 2                                          047 (range 0->95)
21      INT     1       BASS 3                                          047 (range 0->95)
22      INT     1       BASS 4                                          047 (range 0->95)
23      ENUM    1       Capture Mux                                     0> MIC_IN, LINE_IN,
24      ENUM    1       Headphone Mux                                   0> DAC, LINE_IN,
25      ENUM    1       Digital Input Mux                               0ADC, > I2S, Rsvrd, DAP,
26      ENUM    1       DAP Mux                                         0> ADC, I2S,
27      ENUM    1       DAP MIX Mux                                     0> ADC, I2S,

Note: the tinymix command does not put a space between the device number (always "0" in this case) and the settings.

In this case, the 'PCM Playback Volume' represents the digital DAC Volume Control, the 'Headphone Playback Volume' represents the analog gain on the Headphone volume control, the 'Capture Volume' represents the Analog Gain block entering the ADC, and the 'Mic Volume' represents the MIC GAIN block.

The tinymix tool can be used to adjust these settings. For example, to increase the analog output volume of the headphones channel:

tinymix set 'Headphone Playback Volume' 120 120

This will set both the left and right channel gain setting to be "120".

There are other features of the codec not discussed here (including routing the audio to the line-in and line-out and leveraging the CODEC audio signal processing blocks) but can be leveraged in a similar manner.

Go to top
Add picture from clipboard (Maximum size: 1 GB)