gro*_*mal 11 arch-linux alsa audio
我多年来一直archlinux
在笔记本电脑上运行,从不需要麦克风。现在我需要它,但找不到正确配置它的方法。
我使用alsa
和pulseadio
。
alsamixer
作为用户运行我有两个仪表:
|| ||
Master Capture
Run Code Online (Sandbox Code Playgroud)
我将它们都取消静音并启用了合理的 (~50%) 值。
alsamixer
以 root 身份运行我有几个仪表:
|| || || || || ||
Master Headphones Speaker PCM Microphone MIC Boot
|| || || || ||
Beep Loopback Internal Internal Capture
Run Code Online (Sandbox Code Playgroud)
如果我Loopback
以 root 身份启用,我可以通过扬声器听到麦克风的声音。
如果我alsamixer
以用户身份明确选择我的声卡,我会得到与以 root 身份运行相同的命令(如果我Loopback
在这里启用,我也会听到来自扬声器的麦克风)。我得到以下信息:
(右边是另外两个Internal
仪表,Loopback
(enable/disable) 和 mutable Off-hook
)
然而,无论我做什么,无论我如何干预 alsa 仪表,我都无法将麦克风传递给用户应用程序。本质上,每次运行时,arecord
我都会得到以下输出:
$ arecord -vv -f dat /dev/null
Recording WAVE '/dev/null' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
ALSA <-> PulseAudio PCM I/O Plugin
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 24000
period_size : 6000
period_time : 125000
tstamp_mode : NONE
tstamp_type : GETTIMEOFDAY
period_step : 1
avail_min : 6000
period_event : 0
start_threshold : 1
stop_threshold : 24000
silence_threshold: 0
silence_size : 0
boundary : 6755399441055744000
#+ | 00%
Run Code Online (Sandbox Code Playgroud)
aplay
,另一方面,工作完美。
我的声卡是(lspci
):
# lspci| grep -i audio
00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA)
Run Code Online (Sandbox Code Playgroud)
我查看了arch wiki并尝试在/etc/modprobe.d/modprobe.conf
(并重新启动机器)中设置以下内容:
options snd-hda-intel model=dell-m6-dmic
Run Code Online (Sandbox Code Playgroud)
(无论是否有该配置,我都无法让麦克风向用户应用程序发送数据。)
我目前的hda
模块是:
# lsmod |grep hda
snd_hda_codec_si3054 16384 1
snd_hda_codec_realtek 69632 1
snd_hda_codec_generic 69632 1 snd_hda_codec_realtek
snd_hda_intel 32768 5
snd_hda_codec 106496 4 snd_hda_codec_realtek,snd_hda_codec_si3054,snd_hda_codec_generic,snd_hda_intel
snd_hda_core 61440 5 snd_hda_codec_realtek,snd_hda_codec_si3054,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
snd_hwdep 16384 1 snd_hda_codec
snd_pcm 86016 4 snd_hda_codec_si3054,snd_hda_codec,snd_hda_intel,snd_hda_core
snd 65536 18 snd_hda_codec_realtek,snd_hda_codec_si3054,snd_hwdep,snd_timer,snd_pcm,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
Run Code Online (Sandbox Code Playgroud)
为了完整起见,这是我的pulseaudio
配置(我没有尝试过干预它):
$ pulseaudio --dump-conf
### Read from configuration file: /etc/pulse/daemon.conf ###
daemonize = no
fail = yes
high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5
allow-module-loading = yes
allow-exit = yes
use-pid-file = yes
system-instance = no
local-server-type = user
cpu-limit = no
enable-shm = yes
flat-volumes = no
lock-memory = no
exit-idle-time = 20
scache-idle-time = 20
dl-search-path = /usr/lib/pulse-9.0/modules
default-script-file = /etc/pulse/default.pa
load-default-script-file = yes
log-target =
log-level = notice
resample-method = auto
enable-remixing = yes
enable-lfe-remixing = no
lfe-crossover-freq = 0
default-sample-format = s16le
default-sample-rate = 44100
alternate-sample-rate = 48000
default-sample-channels = 2
default-channel-map = front-left,front-right
default-fragments = 4
default-fragment-size-msec = 25
enable-deferred-volume = yes
deferred-volume-safety-margin-usec = 8000
deferred-volume-extra-delay-usec = 0
shm-size-bytes = 0
log-meta = no
log-time = no
log-backtrace = 0
rlimit-fsize = -1
rlimit-data = -1
rlimit-stack = -1
rlimit-core = -1
rlimit-rss = -1
rlimit-as = -1
rlimit-nproc = -1
rlimit-nofile = 256
rlimit-memlock = -1
rlimit-locks = -1
rlimit-sigpending = -1
rlimit-msgqueue = -1
rlimit-nice = 31
rlimit-rtprio = 9
rlimit-rttime = 200000
Run Code Online (Sandbox Code Playgroud)
根据 Faheem Mitha 的评论,我相信它pulseaudio
tmpfs
具有正确的权限:
# ls -la /run/user/861213/pulse/
total 4
drwx------ 2 grochmal users 80 Jul 4 21:44 .
drwx------ 5 grochmal users 120 Jul 4 21:46 ..
srw-rw-rw- 1 grochmal users 0 Jul 4 21:44 native
-rw------- 1 grochmal users 4 Jul 4 21:44 pid
Run Code Online (Sandbox Code Playgroud)
而pavucontrol
被静音。我首先不知道是pavucontrol
哪个导致了这个问题:
我没有想法了。我相信的是,Loopback
在存在音频接口内核空间,所以我的问题是,我不能把麦克风数据到用户空间。然而,我不是 100% 确定。
我可以为snd-hda-intel
(或其他模块)提供哪些其他选项,这些选项可能与在环回接口上工作但不传播到应用程序层的麦克风相关?
我可能做错了pulseaudio
什么吗?但话又说回来,pulseaudio
一直正常工作(与 一起alsa
),我audacity
经常使用。