odroid-n2:application_note:sound

ODROID-N2 Sound Card

ODROID-N2 has a onboard audio DAC and audio driver with Adjustable Gain.
HDMI output and SPDIF output are also available.
This section shows how to output sound card components and audio.

Do aplay -l shows sound card list.

target
odroid@odroid:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AMLAUGESOUND [AML-AUGESOUND], device 0: SPDIF-B-dit-hifi dit-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: AMLAUGESOUND [AML-AUGESOUND], device 1: TDM-C-T9015-audio-hifi T9015-audio-hifi-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: AMLAUGESOUND [AML-AUGESOUND], device 2: SPDIF-dit-hifi dit-hifi-2 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
odroid@odroid:~$ 

card 0: device 0: s922X spdif_B – hdmitx audio – HDMI out
card 0: device 1: s922X I2S – Internal audio DAC – audio driver(DIO2133) – 3.5pi audio jack
card 0: device 2: s922X spdif – spdif out – spdif out (GPIOA_11, ext_con J7-pin2)
Each device is output independently.


Ubuntu Minimal Image

Ubuntu minimal image does not include pulseaudio.
In this case, the way to set the sound output path is to set /etc/asound.conf
Default value is HDMI output.

root@odroid:~# cat /etc/asound.conf 
pcm.!default { 
        type plug
        slave {
        pcm "hw:0,0"
        }
}
root@odroid:~#

You can change the sound output path by edit /etc/asound.conf

 pcm "hw:0,0" // HDMI output
 pcm "hw:0,1" // Internal DAC(audio jack) output
 pcm "hw:0,2" // SPDIF output

Ex) After changing the default sound output path to audio jack.

root@odroid:~# cat /etc/asound.conf 
pcm.!default { 
        type plug
        slave {
        pcm "hw:0,1"
        }
}
root@odroid:~#

Ubuntu Mate Image

Ubuntu mate image does include pulseaudio.
In this case, the way to set the sound output path is to set /etc/pulse/default.pa

1. check your sound device number
The number “1” means the line-output on N2 Ubuntu 18.04 mate.

target
odroid@odroid:~$ pactl list short sources
0       hdmi_out.monitor        module-alsa-sink.c      s16le 2ch 44100Hz       SUSPENDED
1       line_out.monitor        module-alsa-sink.c      s16le 2ch 44100Hz       SUSPENDED
2       spdif_out.monitor       module-alsa-sink.c      s16le 2ch 44100Hz       SUSPENDED
3       alsa_output.platform-auge_sound.analog-stereo.monitor   module-alsa-card.c      s16le 2ch 44100Hz       SUSPENDED

2. Set the default with the device number

target
odroid@odroid64:~$ echo set-default-sink 1 | sudo tee -a /etc/pulse/default.pa

You can check the output with the 'aplay' command. testfile only supports wav format.

3.5pi audio jack
target
root@odroid:~# aplay -D hw:0,0 testfile.wav
HDMI Output

The HDMI display device must support audio output.

target
root@odroid:~# aplay -D hw:0,1 testfile.wav
SPDIF Output

A simple DIY is required to check spdif output.
The coaxial or optical output terminal must be connected to the GPIOA_11 pin.
It is the same as ODROID-C2. S/PDIF Audio Output

target
root@odroid:~# aplay -D hw:0,2 testfile.wav

ODROID-C2 is HDMI and SPDIF same output, but ODROID-N2 is HDMI and SPDIF independent output.

Volume control

Internal DAC (device 0) allows hardware volume control.
The initial value is 0.00dB, and the value set by amixer is saved and restored at reboot.

target
root@odroid:~# amixer sget 'DAC Digital'
Simple mixer control 'DAC Digital',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 254 [100%] [0.00dB]
  Front Right: Playback 254 [100%] [0.00dB]
root@odroid:~#
target
root@odroid:~# amixer sset 'DAC Digital' 95%
Simple mixer control 'DAC Digital',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 243 [95%] [-41.25dB]
  Front Right: Playback 243 [95%] [-41.25dB]
root@odroid:~# 
root@odroid:~# amixer sset 'DAC Digital' 250
Simple mixer control 'DAC Digital',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 250 [98%] [-15.00dB]
  Front Right: Playback 250 [98%] [-15.00dB]
root@odroid:~#
Line-out Mute

Disable the 3.5-pi audio jack output. Mute ON

target
root@odroid:~# amixer sset 'LINE_OUT mute' on 
Simple mixer control 'LINE_OUT mute',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
root@odroid:~# 

Enable the 3.5-pi audio jack output. Mute OFF

target
root@odroid:~# amixer sset 'LINE_OUT mute' off
Simple mixer control 'LINE_OUT mute',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
root@odroid:~#

There are several other mixers. You can check it by running alsamixer.

Our forum user @Amnezida found a good workaround to reduce the pop-noise significantly.
Popping sound from audio jack after silence

  • odroid-n2/application_note/sound.txt
  • Last modified: 2020/07/31 10:56
  • by ck.kim