Skip to content

iMX Audio How To

vraevsky edited this page Sep 22, 2019 · 15 revisions

CompuLab iMX Audio

Available audio devices

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: imxaudiohdmi [imx-audio-hdmi], device 0: imx8 hdmi i2s-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 3: compulabimx8mq [compulab-imx8mq], device 0: 308b0000.sai-wm8731-hifi wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Unmute wm8731 and save the card settings

  • wm8731 'Output Mixer HiFi Playback Switch' on
card=$(aplay -l | awk '(/compulab/)&&($0=$2)&&(gsub(/:/,""))')
amixer -c ${card} cset numid=13 1
alsactl store ${card}

Audio Test

  • Left/Right Channel test
card=$(aplay -L | awk '/sysdefault.*compulab/')
speaker-test -D ${card} -c 2 -t syn -l 1

Switching between available audio sinks

  • Configure the compulabimx8mq card as the default audio sink:
pactl set-default-sink $(pactl list sinks | awk '/wm8731-hifi/' RS="" | awk -F":" '(/Name/)&&($0=$NF)')
pactl info
  • Configure the imx-audio-hdmi card as the default audio sink:
pactl set-default-sink $(pactl list sinks | awk '/imx-audio-hdmi/' RS="" | awk -F":" '(/Name/)&&($0=$NF)')
pactl info
wget https://raw.githubusercontent.com/compulab-yokneam/Documentation/master/audio/sink-switch.sh
  • Run is this way:
bash /path/to/sink-switch.sh