Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:edge2:applications:es8316

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:edge2:applications:es8316 [2022/12/06 03:49]
nick
products:sbc:edge2:applications:es8316 [2023/03/09 19:58] (current)
nick [Edge2 and ES8316 Audio Usage]
Line 1: Line 1:
-====== Edge2 ES8316 Codec ======+====== Edge2 and ES8316 Audio Usage ======
  
-===== Introduction =====+<WRAP important > 
 +ES8316 codec usage require [[https://www.khadas.com/product-page/edge2-io-module|Edge2 IO extension board]]. 
 +</WRAP>
  
-This documentation will introduce the usage of ES8316 codec on the Edge2 IO board. 
  
 +===== Alsa audio device HW name =====
  
-<WRAP important > +Access to **ES8316** codec will be available by ''hw:CARD=rockchipes8316c'' alsa audio device HW namefor example: ''aplay -D **hw:CARD=rockchipes8316c** ..''
-For Edge2, in order to use the ES8316 Codecyou need to attach the Edge2 IO extension board. +
-</WRAP>+
  
 +```shell print ES8316 hw name 
 +~# aplay -L | grep rockchipes8316c -m1
 +hw:CARD=rockchipes8316c,DEV=0
  
-===== Record from ES8316 =====+~# arecord -L | grep rockchipes8316c -m1 
 +hw:CARD=rockchipes8316c,DEV=
 +```
  
-Get record devices:+===== Alsa audio device HW index =====
  
-```shell +```shell print ES8316 hw index 
-arecord -l +~# arecord -l | grep es8316-codec -A2 
-**** List of CAPTURE Hardware Devices **** +card 3rockchipes8316c [rockchip,es8316-codec], device 0: fe470000.i2s-ES8316 HiFi ES8316 HiFi-0 [fe470000.i2s-ES8316 HiFi ES8316 HiFi-0]
-card 2rockchipsoundmi [rockchip,sound-micarray], device 0: fe4b0000.pdm-dummy_codec dummy-codec-0 [fe4b0000.pdm-dummy_codec dummy-codec-0]+
   Subdevices: 1/1   Subdevices: 1/1
   Subdevice #0: subdevice #0   Subdevice #0: subdevice #0
 +
 +~# aplay -l | grep es8316-codec -A2
 card 3: rockchipes8316c [rockchip,es8316-codec], device 0: fe470000.i2s-ES8316 HiFi ES8316 HiFi-0 [fe470000.i2s-ES8316 HiFi ES8316 HiFi-0] card 3: rockchipes8316c [rockchip,es8316-codec], device 0: fe470000.i2s-ES8316 HiFi ES8316 HiFi-0 [fe470000.i2s-ES8316 HiFi ES8316 HiFi-0]
   Subdevices: 1/1   Subdevices: 1/1
   Subdevice #0: subdevice #0   Subdevice #0: subdevice #0
 +
 ``` ```
  
-The sound **card 3** is the ES8316 device.+The sound **card 3** is the ES8316 device and audio device HW index is ''3''.
  
 +===== Record from ES8316 =====
  
-==== Record from Headphone Mic ==== 
- 
-```shell 
-amixer -c 3 cset numid=18,iface=MIXER,name='ALC Capture Switch' 
-amixer -c 3 cset numid=35,iface=MIXER,name='Right Headphone Mixer RLIN Switch' 1 
-amixer -c 3 cset numid=35,iface=MIXER,name='Left Headphone Mixer LLIN Switch' 1 
-amixer -c 3 cset numid=28,iface=MIXER,name='Differential Mux' 1 
-arecord -D hw:3,0 -f cd -d 20 record.wav 
 ``` ```
- +arecord -D hw:CARD=rockchipes8316c -f cd -d 20 record.wav
-==== Record from AMIC ==== +
- +
-```shell +
-amixer -c 3 cset numid=18,iface=MIXER,name='ALC Capture Switch' 1  +
-amixer -c 3 cset numid=35,iface=MIXER,name='Right Headphone Mixer RLIN Switch'+
-amixer -c 3 cset numid=35,iface=MIXER,name='Left Headphone Mixer LLIN Switch'+
-amixer -c 3 cset numid=28,iface=MIXER,name='Differential Mux' 0 +
-arecord -D hw:3,0 -f cd -d 20 record.wav+
 ``` ```
  
-===== Playback from ES8316 ===== +or by audio device HW index (will be ''3'' for this example)
- +
-Get playback devices:+
  
 ```shell ```shell
-$ aplay -+arecord -D hw:3 -f cd -d 20 record.wav
-**** List of PLAYBACK Hardware Devices **** +
-card 0rockchipdp0 [rockchip,dp0], device 0: rockchip,dp0 spdif-hifi-0 [rockchip,dp0 spdif-hifi-0] +
-  Subdevices: 1/1 +
-  Subdevice #0: subdevice #0 +
-card 1: rockchiphdmi0 [rockchip,hdmi0], device 0: fddf0000.i2s-i2s-hifi i2s-hifi-0 [fddf0000.i2s-i2s-hifi i2s-hifi-0] +
-  Subdevices: 1/1 +
-  Subdevice #0: subdevice #0 +
-card 3: rockchipes8316c [rockchip,es8316-codec], device 0: fe470000.i2s-ES8316 HiFi ES8316 HiFi-0 [fe470000.i2s-ES8316 HiFi ES8316 HiFi-0] +
-  Subdevices: 1/1 +
-  Subdevice #0: subdevice #0 +
 ``` ```
  
-The sound **card 3** is the ES8316 device.+<WRAP info > 
 +The headphone mic has the higher priority than the AMIC, which means if you connect the headphone then will record from the headphone mic, otherwise record from the AMIC. 
 +</WRAP>
  
  
-Configure the codec:+===== Playback from ES8316 =====
  
 ```shell ```shell
-amixer -c 3 cset numid=36,iface=MIXER,name='Mixer Right DAC Switch'+aplay -D hw:CARD=rockchipes8316c xxx.wav
-amixer -c 3 cset numid=34,iface=MIXER,name='Left Mixer Left DAC Switch'+
-amixer -c 3 cset numid=5,iface=MIXER,name='DAC playback Volume' 192,192 +
-amixer -c 3 cset numid=2,iface=MIXER,name='Headphone Playback Voulume' 1,1 +
-amixer -c 3 cset numid=3,iface=MIXER,name='Headphone Mixer Volume' 11+
 ``` ```
  
-Play audio from ES8316:+or by audio device HW index (will be ''3'' for this example) 
  
 ```shell ```shell
-aplay -D hw:3,0 xxx.wav+aplay -D hw:3 xxx.wav
 ``` ```
-<WRAP tip + 
-The headphone has the higher priority than the speaker.+<WRAP info 
 +The headphone has the higher priority than the speaker, which means if you connect the headphone then will play from the headphone, otherwise play from the speaker.
 </WRAP> </WRAP>
  
  
Last modified: 2022/12/06 03:49 by nick