我在 Ubuntu 机器上运行 MPD (v0.21.20),并在同一台机器上使用 ncmpcpp 客户端。机器有工作声音,因为我正在将其用于其他 GUI 应用程序。
以下是 mpd.conf 的摘录,对我来说似乎有问题:
audio_output {
type "alsa"
name "My ALSA Device"
# device "hw:0,0" # optional
# device "iec958:CARD=Intel,DEV=0"
mixer_type "software" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
}
#
#audio_output {
# type "pulse"
# name "My Pulse Output"
# server "127.0.0.1" # optional
# mixer_type "software"
# device "iec958:CARD=1,DEV=1"
# mixer_control "PCM"
# sink "remote_server_sink" # optional
#}
当我选择 ALSA 时,WAV 文件开始在 ncmpcpp 中播放,但没有声音。
Nov 10 17:51 : avahi: Service 'Music Player @ mServer' successfully established.
Nov 10 17:51 : client: [0] opened from 127.0.0.1:44676
Nov 10 17:52 : player: played "1.wav"
但是当我选择 PULSE 时,ncmpcpp 只是一直保持暂停状态:
Nov 10 17:50 : client: [0] opened from 127.0.0.1:44670
Nov 10 17:50 : avahi: Service 'Music Player @ mServer' successfully established.
Nov 10 17:50 : exception: Failed to open "My Pulse Output" (pulse)
Nov 10 17:50 : exception: nested: failed to connect: Connection refused
Nov 10 17:50 : exception: Failed to open "My Pulse Output" (pulse)
Nov 10 17:50 : exception: nested: failed to connect: Connection refused
以下是 aplay -l 命令的输出,显示所有播放硬件设备:
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: AD1984A Analog [AD1984A Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: AD1984A Alt Analog [AD1984A Alt Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: AUDIO [USB AUDIO], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: NVidia [HDA NVidia], device 7: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: NVidia [HDA NVidia], device 8: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: NVidia [HDA NVidia], device 9: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
这是 mpd --stderr --no-daemon --verbose 命令的输出,它似乎没有显示任何可能解释声音缺失的错误:
config_file: loading file /etc/mpd.conf
path: SetFSCharset: fs charset is:
libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator'
vorbis: Xiph.Org libVorbis 1.3.6
opus: libopus 1.3.1
sndfile: libsndfile-1.0.28
adplug: adplug 2.3.1
simple_db: reading DB
curl: version 7.68.0
curl: with GnuTLS/3.6.13
avahi: Initializing interface
exception: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
avahi: Client changed to state 2
avahi: Client is RUNNING
avahi: Registering service _mpd._tcp/Music Player @ mServer
avahi: Service group changed to state 0
avahi: Service group is UNCOMMITED
state_file: Loading state file /var/lib/mpd/state
playlist: play 0:"1.wav"
decoder_thread: probing plugin sndfile
inotify: initializing inotify
decoder: audio_format=8000:16:2, seekable=true
inotify: watching music directory
exception: OutputThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
avahi: Service group changed to state 1
avahi: Service group is REGISTERING
playlist: queue song 0:"1.wav"
decoder_thread: probing plugin sndfile
decoder: audio_format=8000:16:2, seekable=true
client: [0] opened from 127.0.0.1:44658
client: [0] process command "status"
client: [0] command returned 0
client: [0] process command "plchanges "0""
client: [0] command returned 0
client: [0] process command "outputs"
client: [0] command returned 0
client: [0] process command "decoders"
client: [0] command returned 0
client: [0] process command "outputs"
client: [0] command returned 0
client: [0] process command "outputs"
client: [0] command returned 0
client: [0] process command "idle"
client: [0] command returned 1
avahi: Service group changed to state 2
avahi: Service 'Music Player @ mServer' successfully established.
在这个阶段,我真的不知道去哪里寻找进一步的故障排除,以使声音与 MPD 一起工作,所以任何指点都会有帮助!
答案1
解决了这个问题!
查看 aplay -l 的输出时发现 USB 扬声器位于卡#1上,因此将行
设备“hw:0,0”
到设备“hw:1,0”
现在它开始工作了!!!