mpdでs/pdif

Ubuntu 18.10上のmpdでs/pdifを使いたくなったのでメモ。

端末上でaplay -Lを実行する

default
Playback/recording through the PulseAudio sound server
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
hdmi:CARD=Generic,DEV=0
HD-Audio Generic, HDMI 0
HDMI Audio Output
hdmi:CARD=Generic,DEV=1
HD-Audio Generic, HDMI 1
HDMI Audio Output
hdmi:CARD=Generic,DEV=2
HD-Audio Generic, HDMI 2
HDMI Audio Output
hdmi:CARD=Generic,DEV=3
HD-Audio Generic, HDMI 3
HDMI Audio Output
hdmi:CARD=Generic,DEV=4
HD-Audio Generic, HDMI 4
HDMI Audio Output
hdmi:CARD=Generic,DEV=5
HD-Audio Generic, HDMI 5
HDMI Audio Output
dmix:CARD=Generic,DEV=3
HD-Audio Generic, HDMI 0
Direct sample mixing device
dmix:CARD=Generic,DEV=7
HD-Audio Generic, HDMI 1
Direct sample mixing device
dmix:CARD=Generic,DEV=8
HD-Audio Generic, HDMI 2
Direct sample mixing device
dmix:CARD=Generic,DEV=9
HD-Audio Generic, HDMI 3
Direct sample mixing device
dmix:CARD=Generic,DEV=10
HD-Audio Generic, HDMI 4
Direct sample mixing device
dmix:CARD=Generic,DEV=11
HD-Audio Generic, HDMI 5
Direct sample mixing device
dsnoop:CARD=Generic,DEV=3
HD-Audio Generic, HDMI 0
Direct sample snooping device
dsnoop:CARD=Generic,DEV=7
HD-Audio Generic, HDMI 1
Direct sample snooping device
dsnoop:CARD=Generic,DEV=8
HD-Audio Generic, HDMI 2
Direct sample snooping device
dsnoop:CARD=Generic,DEV=9
HD-Audio Generic, HDMI 3
Direct sample snooping device
dsnoop:CARD=Generic,DEV=10
HD-Audio Generic, HDMI 4
Direct sample snooping device
dsnoop:CARD=Generic,DEV=11
HD-Audio Generic, HDMI 5
Direct sample snooping device
hw:CARD=Generic,DEV=3
HD-Audio Generic, HDMI 0
Direct hardware device without any conversions
hw:CARD=Generic,DEV=7
HD-Audio Generic, HDMI 1
Direct hardware device without any conversions
hw:CARD=Generic,DEV=8
HD-Audio Generic, HDMI 2
Direct hardware device without any conversions
hw:CARD=Generic,DEV=9
HD-Audio Generic, HDMI 3
Direct hardware device without any conversions
hw:CARD=Generic,DEV=10
HD-Audio Generic, HDMI 4
Direct hardware device without any conversions
hw:CARD=Generic,DEV=11
HD-Audio Generic, HDMI 5
Direct hardware device without any conversions
plughw:CARD=Generic,DEV=3
HD-Audio Generic, HDMI 0
Hardware device with all software conversions
plughw:CARD=Generic,DEV=7
HD-Audio Generic, HDMI 1
Hardware device with all software conversions
plughw:CARD=Generic,DEV=8
HD-Audio Generic, HDMI 2
Hardware device with all software conversions
plughw:CARD=Generic,DEV=9
HD-Audio Generic, HDMI 3
Hardware device with all software conversions
plughw:CARD=Generic,DEV=10
HD-Audio Generic, HDMI 4
Hardware device with all software conversions
plughw:CARD=Generic,DEV=11
HD-Audio Generic, HDMI 5
Hardware device with all software conversions
sysdefault:CARD=Generic_1
HD-Audio Generic, ALC1220 Analog
Default Audio Device
front:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Analog
Front speakers
surround21:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Analog
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Digital

IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Analog
Direct sample mixing device
dmix:CARD=Generic_1,DEV=1
HD-Audio Generic, ALC1220 Digital
Direct sample mixing device
dsnoop:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Analog
Direct sample snooping device
dsnoop:CARD=Generic_1,DEV=1
HD-Audio Generic, ALC1220 Digital
Direct sample snooping device
hw:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Analog
Direct hardware device without any conversions
hw:CARD=Generic_1,DEV=1
HD-Audio Generic, ALC1220 Digital
Direct hardware device without any conversions
plughw:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC1220 Analog
Hardware device with all software conversions
plughw:CARD=Generic_1,DEV=1
HD-Audio Generic, ALC1220 Digital
Hardware device with all software conversions

上の段落の太字になっているところを参考にして、mpd.confのoutputを編集する。

audio_output {
type "alsa"
name "ALC1220 Digital"
device "iec958:CARD=Generic_1,DEV=0"

auto_resample "no"
auto_channels "no"
auto_format "no"
use_mmap "yes"
mixer_type "disabled"
}