问题:音频失真
当我从我的录制音频罗技 H111 有线耳机,音频因 Linux 的 ALSA 架构而失真(声卡驱动程序出现问题或 ALSA 内部设置出现问题)。请参阅图片“有问题的录音”- 语音信号以极不寻常的方式扭曲。此“正常录音”显示录音内容应该看起来像,但实际上不是。
设置:
我的电脑(Rog Strix G17 RTX 3060,带 Windows 11)双启动,系统是 Ubuntu 22.04,后来升级到 23.04。
在同一台 Windows 11 机器上运行相同的 Python 代码并使用相同的麦克风时,不会出现此问题。这意味着问题出在 Ubuntu 23.04 处理音频的方式上 - 具体来说,该问题与 ALSA 架构有关。
相关信息:
(0)uname -r返回 6.2.0-35-generic
(1)aplay -l 的输出 **** 播放硬件设备列表 **** (其他卡)卡 2:Generic_1 [HD-Audio Generic],设备 0:ALC285 Analog [ALC285 Analog] 子设备:1/1 子设备 #0:子设备 #0
这最后一张卡/编解码器似乎是我的系统用于数字化有线麦克风信号的卡/编解码器。
(2)Pavucontrol 配置
我附上截图我当前的配置。
(3)dmesg | grep -i audio 的输出
[ 3.370747] snd_hda_intel 0000:01:00.1: Handle vga_switcheroo audio client
[ 3.370943] snd_hda_intel 0000:05:00.1: Handle vga_switcheroo audio client
[ 3.437596] input: HD-Audio Generic HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:08.1/0000:05:00.1/sound/card1/input27
[ 3.513484] snd_hda_codec_realtek hdaudioC2D0: autoconfig for ALC285: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
[ 3.513493] snd_hda_codec_realtek hdaudioC2D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[ 3.513495] snd_hda_codec_realtek hdaudioC2D0: hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[ 3.513498] snd_hda_codec_realtek hdaudioC2D0: mono: mono_out=0x0
[ 3.513500] snd_hda_codec_realtek hdaudioC2D0: inputs:
[ 3.513501] snd_hda_codec_realtek hdaudioC2D0: Mic=0x19
[ 3.513504] snd_hda_codec_realtek hdaudioC2D0: Internal Mic=0x12
[ 5.420200] input: HD-Audio Generic Mic as /devices/pci0000:00/0000:00:08.1/0000:05:00.6/sound/card2/input32
[ 5.420268] input: HD-Audio Generic Headphone as /devices/pci0000:00/0000:00:08.1/0000:05:00.6/sound/card2/input33
[ 6.245138] snd_hda_intel 0000:05:00.1: bound 0000:05:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu])
(4)pactl 源的输出 这很长:
Source #47
State: SUSPENDED
Name: alsa_output.pci-0000_05_00.6.analog-stereo.monitor
Description: Monitor of Family 17h/19h HD Audio Controller Analog Stereo
Driver: PipeWire
Sample Specification: s32le 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 of Sink: alsa_output.pci-0000_05_00.6.analog-stereo
Latency: 0 usec, configured 0 usec
Flags: HARDWARE DECIBEL_VOLUME LATENCY
Properties:
alsa.card = "2"
alsa.card_name = "HD-Audio Generic"
alsa.class = "generic"
alsa.device = "0"
alsa.driver_name = "snd_hda_intel"
alsa.id = "ALC285 Analog"
alsa.long_card_name = "HD-Audio Generic at 0xfc5c0000 irq 84"
alsa.name = "ALC285 Analog"
alsa.resolution_bits = "16"
alsa.subclass = "generic-mix"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
api.alsa.card.longname = "HD-Audio Generic at 0xfc5c0000 irq 84"
api.alsa.card.name = "HD-Audio Generic"
api.alsa.path = "front:2"
api.alsa.pcm.card = "2"
api.alsa.pcm.stream = "playback"
audio.channels = "2"
audio.position = "FL,FR"
card.profile.device = "3"
device.api = "alsa"
device.class = "monitor"
device.id = "42"
device.profile.description = "Analog Stereo"
device.profile.name = "analog-stereo"
device.routes = "2"
factory.name = "api.alsa.pcm.sink"
media.class = "Audio/Sink"
device.description = "Family 17h/19h HD Audio Controller"
node.name = "alsa_output.pci-0000_05_00.6.analog-stereo"
node.nick = "ALC285 Analog"
node.pause-on-idle = "false"
object.path = "alsa:pcm:2:front:2:playback"
priority.driver = "1009"
priority.session = "1009"
factory.id = "18"
clock.quantum-limit = "8192"
client.id = "34"
node.driver = "true"
factory.mode = "merge"
audio.adapt.follower = ""
library.name = "audioconvert/libspa-audioconvert"
object.id = "47"
object.serial = "47"
node.max-latency = "16384/48000"
api.alsa.period-size = "1024"
api.alsa.period-num = "32"
api.alsa.headroom = "0"
api.acp.auto-port = "false"
api.acp.auto-profile = "false"
api.alsa.card = "2"
api.alsa.use-acp = "true"
api.dbus.ReserveDevice1 = "Audio2"
device.bus = "pci"
device.bus_path = "pci-0000:05:00.6"
device.enum.api = "udev"
device.icon_name = "audio-card-analog-pci"
device.name = "alsa_card.pci-0000_05_00.6"
device.nick = "HD-Audio Generic"
device.plugged.usec = "5422245"
device.product.id = "0x15e3"
device.product.name = "Family 17h/19h HD Audio Controller"
device.subsystem = "sound"
sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:05:00.6/sound/card2"
device.vendor.id = "0x1022"
device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
device.string = "2"
Formats:
pcm
Source #48
State: SUSPENDED
Name: alsa_input.pci-0000_05_00.6.analog-stereo
Description: Family 17h/19h HD Audio Controller Analog Stereo
Driver: PipeWire
Sample Specification: s32le 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: 6554 / 10% / -60.00 dB
Monitor of Sink: n/a
Latency: 0 usec, configured 0 usec
Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY
Properties:
alsa.card = "2"
alsa.card_name = "HD-Audio Generic"
alsa.class = "generic"
alsa.device = "0"
alsa.driver_name = "snd_hda_intel"
alsa.id = "ALC285 Analog"
alsa.long_card_name = "HD-Audio Generic at 0xfc5c0000 irq 84"
alsa.name = "ALC285 Analog"
alsa.resolution_bits = "16"
alsa.subclass = "generic-mix"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
api.alsa.card.longname = "HD-Audio Generic at 0xfc5c0000 irq 84"
api.alsa.card.name = "HD-Audio Generic"
api.alsa.path = "front:2"
api.alsa.pcm.card = "2"
api.alsa.pcm.stream = "capture"
audio.channels = "2"
audio.position = "FL,FR"
card.profile.device = "0"
device.api = "alsa"
device.class = "sound"
device.id = "42"
device.profile.description = "Analog Stereo"
device.profile.name = "analog-stereo"
device.routes = "2"
factory.name = "api.alsa.pcm.source"
media.class = "Audio/Source"
device.description = "Family 17h/19h HD Audio Controller"
node.name = "alsa_input.pci-0000_05_00.6.analog-stereo"
node.nick = "ALC285 Analog"
node.pause-on-idle = "false"
object.path = "alsa:pcm:2:front:2:capture"
priority.driver = "2009"
priority.session = "2009"
factory.id = "18"
clock.quantum-limit = "8192"
client.id = "34"
node.driver = "true"
factory.mode = "split"
audio.adapt.follower = ""
library.name = "audioconvert/libspa-audioconvert"
object.id = "48"
object.serial = "48"
node.max-latency = "16384/48000"
api.alsa.period-size = "1024"
api.alsa.period-num = "32"
api.alsa.headroom = "0"
api.acp.auto-port = "false"
api.acp.auto-profile = "false"
api.alsa.card = "2"
api.alsa.use-acp = "true"
api.dbus.ReserveDevice1 = "Audio2"
device.bus = "pci"
device.bus_path = "pci-0000:05:00.6"
device.enum.api = "udev"
device.icon_name = "audio-card-analog-pci"
device.name = "alsa_card.pci-0000_05_00.6"
device.nick = "HD-Audio Generic"
device.plugged.usec = "5422245"
device.product.id = "0x15e3"
device.product.name = "Family 17h/19h HD Audio Controller"
device.subsystem = "sound"
sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:05:00.6/sound/card2"
device.vendor.id = "0x1022"
device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
device.string = "2"
Ports:
analog-input-internal-mic: Internal Microphone (type: Mic, priority: 8900, availability group: Legacy 1, not available)
analog-input-mic: Microphone (type: Mic, priority: 8700, availability group: Legacy 2, available)
Active Port: analog-input-mic
Formats:
pcm
我尝试过的方法
-> sudo apt-get install --reinstall alsa-base pulseaudio; sudo alsa force-reload
-> 我已尝试按照各种指南使用 hdajackretask 更换引脚,但失真仍然存在。
-> 我从 22.04 LTS 更新到了 23.04。
-> 我尝试了这个(相同的硬件),但是没有用:https://www.reddit.com/r/ASUSROG/comments/nvzsdw/asus_rog_g17_no_audio_speakers_are_working_in_any/
-> 哭泣
答案1
当我解释我的设置时,一位非常乐于助人的 discord 用户提到了以下内容:
“99% 的时间里,内核中的驱动程序已经是您所得到的,而一些设备,特别是笔记本电脑/迷你电脑上常见的设备,往往是相当垃圾的硬件,可能没有以通用 ALC285 驱动程序支持的完全标准方式实现,它们可能在 Windows 驱动程序中执行奇怪的操作,尽管使用的是标准芯片。我可能完全错了,也许这张卡可以通过一些调整等方式很好地工作。尽管如此,尤其是考虑到这款耳机本来就很低端,我还是会借此机会购买一款不错的 USB 耳机或一款优质的外部 USB DAC。”
我出去买了一个带有外部 USB 声卡的 Razer Blackshark V2 耳机(这可能有点过头了),修复了扭曲。
振幅仍然出奇的低,但这并不重要。