我有一台带有 USB 音频设备的 AlsaLinux 9 主机。声卡设备驱动程序加载,aplay 显示设备,但是当我尝试播放音频时,什么也听不到。
我怀疑问题是缺少接收器/卡,如 pactl 所示!
以非 root 用户身份运行:
pw-play -v /data/sounds/intruder_alert.wav
sndfile: opened file "/data/sounds/intruder_alert.wav" format 00010002 channels:1 rate:22050
sndfile: using default channel map: MONO
PCM: fmt:s16 rate:22050 channels:1 width:2
rate:22050 latency:2205 (0.100s)
connecting playback stream; target=(null)
stream state changed unconnected -> connecting
stream param change: Spa:Enum:ParamId:Props
stream properties:
application.name = "pw-play"
node.name = "pw-play"
media.type = "Audio"
media.category = "Playback"
media.role = "Music"
media.filename = "/data/sounds/intruder_alert.wav"
media.name = "/data/sounds/intruder_alert.wav"
media.format = "WAV (Microsoft)"
node.rate = "1/22050"
node.latency = "2205/22050"
stream.is-live = "true"
node.autoconnect = "true"
node.want-driver = "true"
media.class = "Stream/Output/Audio"
remote 0 is named "pipewire-0"
stream state changed connecting -> paused
stream param change: Spa:Enum:ParamId:Props
stream state changed paused -> error
stream node 35 error: no node available
remote error: id=2 seq:7 res:-2 (No such file or directory): no node available
我如果发出命令“pw-cli info 35”(基于上面的“node 35”),它会报告未知的全局“35”,但我怀疑节点是动态创建的。 wpctl 命令显示了一些有趣的内容:
wpctl status
PipeWire 'pipewire-0' [0.3.67, admin@myhost, cookie:1009027964]
└─ Clients:
31. wpctl [0.3.67, admin@myhost, pid:3833]
33. WirePlumber [0.3.67, admin@myhost, pid:3090]
34. WirePlumber [export] [0.3.67, admin@myhost, pid:3090]
Audio
├─ Devices:
│
├─ Sinks:
│
├─ Sink endpoints:
│
├─ Sources:
│
├─ Source endpoints:
│
└─ Streams:
Video
├─ Devices:
│
├─ Sinks:
│
├─ Sink endpoints:
│
├─ Sources:
│
├─ Source endpoints:
│
└─ Streams:
Settings
└─ Default Configured Node Names:
似乎没有音频接收器!应该有吗?我需要手动将音频设备添加为接收器吗? aplay 显示的我的音频设备是:
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
sysdefault
Default Audio Device
oss
Open Sound System
pipewire
PipeWire Sound Server
default
Default ALSA Output (currently PipeWire Media Server)
sysdefault:CARD=CODEC
USB Audio CODEC, USB Audio
Default Audio Device
front:CARD=CODEC,DEV=0
USB Audio CODEC, USB Audio
Front output / input
surround21:CARD=CODEC,DEV=0
USB Audio CODEC, USB Audio
2.1 Surround output to Front and Subwoofer 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
如何添加/重新创建丢失的水槽?如果我尝试列出接收器(pactl list sinks),我只会看到一个虚拟设备,并且由于某种原因它被挂起。
Sink #46
State: SUSPENDED
Name: auto_null
Description: Dummy Output
Driver: PipeWire
Sample Specification: float32le 2ch 48000Hz
Channel Map: front-left,front-right
Owner Module: 4294967295
Mute: no
Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
Base Volume: 65536 / 100% / 0.00 dB
Monitor Source: auto_null.monitor
Latency: 0 usec, configured 0 usec
Flags: DECIBEL_VOLUME LATENCY
Properties:
node.name = "auto_null"
device.description = "Dummy Output"
audio.rate = "48000"
audio.channels = "2"
audio.position = "FL,FR"
media.class = "Audio/Sink"
factory.name = "support.null-audio-sink"
node.virtual = "true"
monitor.channel-volumes = "true"
factory.id = "18"
clock.quantum-limit = "8192"
client.id = "31"
node.driver = "true"
factory.mode = "merge"
audio.adapt.follower = ""
library.name = "audioconvert/libspa-audioconvert"
object.id = "32"
object.serial = "46"
Formats:
pcm
pactl 报告没有卡,也没有接收器。所以我尝试添加它们但失败了:
pactl load-module module-alsa-card device=hw:0,0 sink_name=usb_audio sink_properties=device.description=analog
Failure: No such entity
pactl load-module module-alsa-sink device=hw:0,0 sink_name=usb_audio sink_properties=device.description=analog
Failure: No such entity
如何添加缺少的卡/接收器? (管道线或脉冲音频,如果更合适的话)