MPD 无法连接到我的声卡

MPD 无法连接到我的声卡

以下是我可用的卡片(为了便于阅读,在命令之间添加了额外的换行符):

audiohub@DYM-Portable-AudioHub:~$ sudo aplay -l
[sudo] password for audiohub: 
**** List of PLAYBACK Hardware Devices ****
card 0: sunxicodec [sunxi-CODEC], device 0: M1 PCM [sunxi PCM]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: X18XR18 [X18/XR18], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

audiohub@DYM-Portable-AudioHub:~$ arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=sunxicodec
    sunxi-CODEC, sunxi PCM
    Default Audio Device
dmix:CARD=sunxicodec,DEV=0
    sunxi-CODEC, sunxi PCM
    Direct sample mixing device
dsnoop:CARD=sunxicodec,DEV=0
    sunxi-CODEC, sunxi PCM
    Direct sample snooping device
hw:CARD=sunxicodec,DEV=0
    sunxi-CODEC, sunxi PCM
    Direct hardware device without any conversions
plughw:CARD=sunxicodec,DEV=0
    sunxi-CODEC, sunxi PCM
    Hardware device with all software conversions
sysdefault:CARD=CODEC
    USB Audio CODEC, USB Audio
    Default Audio Device
front:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    Front speakers
surround40:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    Direct sample mixing device
dsnoop:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    Direct sample snooping device
hw:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    Direct hardware device without any conversions
plughw:CARD=CODEC,DEV=0
    USB Audio CODEC, USB Audio
    Hardware device with all software conversions
sysdefault:CARD=X18XR18
    X18/XR18, USB Audio
    Default Audio Device
front:CARD=X18XR18,DEV=0
    X18/XR18, USB Audio
    Front speakers
surround40:CARD=X18XR18,DEV=0
    X18/XR18, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=X18XR18,DEV=0
    X18/XR18, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=X18XR18,DEV=0
    X18/XR18, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=X18XR18,DEV=0
    X18/XR18, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=X18XR18,DEV=0
    X18/XR18, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=X18XR18,DEV=0
    X18/XR18, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=X18XR18,DEV=0
    X18/XR18, USB Audio
    Direct sample mixing device
dsnoop:CARD=X18XR18,DEV=0
    X18/XR18, USB Audio
    Direct sample snooping device
hw:CARD=X18XR18,DEV=0
    X18/XR18, USB Audio
    Direct hardware device without any conversions
plughw:CARD=X18XR18,DEV=0
    X18/XR18, USB Audio
    Hardware device with all software conversions

audiohub@DYM-Portable-AudioHub:~$ 

板载sunxicodec没有使用,USBCODEC完全被其他功能占用,我想mpd在 USB 上播放X18XR18。无论我输入什么/etc/mpd.confgmpc总是说:

在此处输入图片描述

我现在有这个:

audio_output {
       type            "alsa"
       name            "XR18"
       device          "hw:2,0"
#       format          "48000:32:2"
}

它对"hw:1,0"( CODEC) 执行相同的操作,但确实可以播放"hw:0,0"( sunxicodec)。不幸的是,该卡需要一些额外的配置才能使其使用模拟而不是 HDMI,所以我实际上还没有听过它,看看它听起来是否不错。

我知道这两张 USB 卡可以工作,因为CODEC的功能在使用其软件时可以完美运行,因为audacious可以在 上播放X18XR18,而且因为我可以同时arecord X18XR18

#!/bin/sh

REC_PATH=/home/audiohub/Recordings

arecord --device=hw:CARD=X18XR18,DEV=0 --channels=18 --file-type=wav --format=S32_LE --rate=48000 --buffer-time=20000000 --max-file-time 300 "$REC_PATH/all_tracks.wav" &

# Force a filesystem sync every 1 second to keep the buffer small enough to write without missing samples
while true
do
    sleep 1
    sync
done

我也尝试了"hw:CARD=X18XR18,DEV=0"格式/etc/mpd.conf,而不是"hw:2,0",但结果是一样的。

aplay做这个:

audiohub@DYM-Portable-AudioHub:~$ aplay --device=hw:CARD=X18XR18,DEV=0 --format=S32_LE --rate=48000 "/home/audiohub/Music/Waterlines/05 - Take Your Time.wav"
Playing WAVE '/home/audiohub/Music/Waterlines/05 - Take Your Time.wav' : Float 32 bit Little Endian, Rate 44100 Hz, Stereo
aplay: set_params:1233: Sample format non available
Available formats:
- S32_LE

audiohub@DYM-Portable-AudioHub:~$ 

不坚持使用 的原因audacious在于,尽管它可以工作,但它依赖 VNC 进行控制(此播放器/录音机是无头的),并且 VNC 服务器会在一段时间后挂断并需要重新启动。由于点唱机是唯一真正需要 GUI 控制的东西,而且mpd似乎可以满足我的所有需求,所以我宁愿使用它而不是audacious

除了我目前尝试过的方法之外,还有什么方法可以让它发挥作用吗?

答案1

该设备支持的唯一格式是 S32_LE。如果 mpd 无法将文件的样本格式转换为该格式,则您必须使用可以进行转换的 ALSA 设备(如果需要);即替换hwplughw

相关内容