Difference between revisions of "Transclusion: Debian: CL-SOM-iMX7: Analog Audio"

From Compulab Mediawiki
Jump to: navigation, search
(USB On-The-Go (OTG))
 
imported>Uri.mashiach
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
CL-SOM-iMX7 provides an analog audio interface, which is registered as a standard ALSA sound card.
+
Use {{cmd|aplay -l}} to list all sound cards and digital audio devices registered on the system:
Use {{cmd|aplay -l}} to list all soundcards and digital audio devices registered on the system:
 
 
<pre>
 
<pre>
root@cl-som-imx7-sid:~# aplay -l
+
root@cl-rootfs:~# aplay -l
 
**** List of PLAYBACK Hardware Devices ****
 
**** List of PLAYBACK Hardware Devices ****
 
card 0: clsomimx7 [cl-som-imx7], device 0: 308a0000.sai-wm8731-hifi wm8731-hifi-0 []
 
card 0: clsomimx7 [cl-som-imx7], device 0: 308a0000.sai-wm8731-hifi wm8731-hifi-0 []
 
   Subdevices: 1/1
 
   Subdevices: 1/1
 
   Subdevice #0: subdevice #0
 
   Subdevice #0: subdevice #0
</pre>
 
 
==== Analog Audio Settings ====
 
To enable the Analog audio playback, {{cmd|alsamixer}} or {{cmd|amixer}} applications can be used.
 
* {{cmd|alsamixer}} - set the “''Output Mixer HiFi''” control on.
 
or
 
* {{cmd|amixer}} - set the “''Output Mixer HiFi Playback Switch''” control on using command line interface:
 
<pre>
 
root@cl-som-imx7-sid:~# amixer cset numid=14 1
 
numid=14,iface=MIXER,name='Output Mixer HiFi Playback Switch'
 
  ; type=BOOLEAN,access=rw------,values=1
 
  : values=on
 
 
</pre>
 
</pre>
  
Line 28: Line 15:
 
Here is a sample output of {{cmd|aplay -L}} command:
 
Here is a sample output of {{cmd|aplay -L}} command:
 
<pre>
 
<pre>
root@cl-som-imx7-sid:~# aplay -L
+
root@cl-rootfs:~# aplay -L
 
null
 
null
 
     Discard all samples (playback) or generate zero samples (capture)
 
     Discard all samples (playback) or generate zero samples (capture)
Line 53: Line 40:
 
The next command can be used for audio play back:
 
The next command can be used for audio play back:
 
<pre>
 
<pre>
root@cl-som-imx7-sid:~# aplay <wav-file>
+
root@cl-rootfs:~# aplay -D sysdefault <wav-file>
 
</pre>
 
</pre>
  
Line 67: Line 54:
 
* {{cmd|amixer}}
 
* {{cmd|amixer}}
 
<pre>
 
<pre>
amixer cset numid=3 31
+
amixer cset numid=1 65536
amixer cset numid=4 0
+
amixer -c 0 cset numid=3 31,31
amixer cset numid=6 1
+
amixer -c 0 cset numid=4 0
amixer cset numid=11 1
+
amixer -c 0 cset numid=6 1
 +
amixer -c 0 cset numid=14 1
 
</pre>
 
</pre>
 
===== Line In =====
 
===== Line In =====
Line 80: Line 68:
 
* {{cmd|amixer}}
 
* {{cmd|amixer}}
 
<pre>
 
<pre>
amixer cset numid=3 31
+
amixer cset numid=1 65536
amixer cset numid=4 1
+
amixer -c 0 cset numid=3 31
amixer cset numid=6 0
+
amixer -c 0 cset numid=4 1
amixer cset numid=11 0
+
amixer -c 0 cset numid=6 0
 +
amixer -c 0 cset numid=14 0
 
</pre>
 
</pre>
  
Line 90: Line 79:
 
Here is a sample command that shows the {{cmd|arecord}} usage for capturing audio signal from the selected input line.
 
Here is a sample command that shows the {{cmd|arecord}} usage for capturing audio signal from the selected input line.
 
<pre>
 
<pre>
root@cl-som-imx7-sid:~# arecord -f dat -t wav /tmp/out.wav
+
root@cl-rootfs:~# arecord -D sysdefault -d 10 -f dat -t wav /tmp/out.wav
 
</pre>
 
</pre>

Latest revision as of 14:42, 4 December 2018

Use aplay -l to list all sound cards and digital audio devices registered on the system:

root@cl-rootfs:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: clsomimx7 [cl-som-imx7], device 0: 308a0000.sai-wm8731-hifi wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Analog Audio Playback

In order to play back a sound file make use of the aplay application.

  • aplay -L can be used for listing of all pcm devices.

Here is a sample output of aplay -L command:

root@cl-rootfs:~# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=clsomimx7
    cl-som-imx7, 
    Default Audio Device
sysdefault:CARD=clsomimx7
    cl-som-imx7, 
    Default Audio Device
dmix:CARD=clsomimx7,DEV=0
    cl-som-imx7, 
    Direct sample mixing device
dsnoop:CARD=clsomimx7,DEV=0
    cl-som-imx7, 
    Direct sample snooping device
hw:CARD=clsomimx7,DEV=0
    cl-som-imx7, 
    Direct hardware device without any conversions
plughw:CARD=clsomimx7,DEV=0
    cl-som-imx7, 
    Hardware device with all software conversions

The next command can be used for audio play back:

root@cl-rootfs:~# aplay -D sysdefault <wav-file>

Audio Input Settings

CL-SOM-iMX7 provides an audio capturing feature from either Mic or Line In input sources. alsamixer or amixer can be used in order to switch between these inputs.

Mic
  • alsamixer
Capture Volume => 100
Line Capture Switch => off
Mic Capture Switch => on
Input Mux => Mic
  • amixer
amixer cset numid=1 65536
amixer -c 0 cset numid=3 31,31
amixer -c 0 cset numid=4 0
amixer -c 0 cset numid=6 1
amixer -c 0 cset numid=14 1
Line In
  • alsamixer
Capture Volume => 100
Line Capture Switch => on
Mic Capture Switch => off
Input Mux => Line In
  • amixer
amixer cset numid=1 65536
amixer -c 0 cset numid=3 31
amixer -c 0 cset numid=4 1
amixer -c 0 cset numid=6 0
amixer -c 0 cset numid=14 0

Sample Audio Recording

As soon as the correct input values have been set, audio signal can be captured. Here is a sample command that shows the arecord usage for capturing audio signal from the selected input line.

root@cl-rootfs:~# arecord -D sysdefault -d 10 -f dat -t wav /tmp/out.wav