Audio

音頻在幾秒鐘內衰減到靜音

  • September 7, 2021

每當我在ALC294執行snd-hda-intel驅動程序的設備上播放聲音時,它都會在 2 秒內消失。問題與此處描述的完全相同。在 Windows 下一切都很好,並且通過 ChromeCast 鏡像 Chrome 選項卡也會發出聲音。我也能聽到跑步的聲音aplay -D plughw:0,1 /usr/share/sounds/alsa/Front_Center.wav

我嘗試了/etc/modprobe.d/alsa-base.conf諸如此類的各種選項

options snd-hda-intel vid=8086 pid=8ca0 snoop=0

和這個

options snd-hda-intel power_save=10 power_save_controller=N model=ref

並且還禁用了 pulseaudio 中基於計時器的調度,但都沒有成功。

這是我係統的一些輸出:

$ inxi -Fxz
System:    Kernel: 5.4.0-48-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Cinnamon 4.6.7 
          Distro: Linux Mint 20 Ulyana base: Ubuntu 20.04 focal 
Machine:   Type: Laptop System: ASUSTeK product: ZenBook UX434FAC_UX433FAC v: 1.0 serial: <filter> 
          Mobo: ASUSTeK model: UX434FAC v: 1.0 serial: <filter> UEFI: American Megatrends v: UX434FAC.303 date: 12/18/2019 
Battery:   ID-1: BAT0 charge: 36.1 Wh condition: 47.2/50.0 Wh (94%) model: ASUSTeK ASUS Battery status: Discharging 
CPU:       Topology: Quad Core model: Intel Core i7-10510U bits: 64 type: MT MCP arch: Kaby Lake rev: C L2 cache: 8192 KiB 
          flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 36799 
          Speed: 892 MHz min/max: 400/4900 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 802 
Graphics:  Device-1: Intel UHD Graphics vendor: ASUSTeK driver: i915 v: kernel bus ID: 00:02.0 
          Display: x11 server: X.Org 1.20.8 driver: modesetting unloaded: fbdev,vesa resolution: 1920x1080~60Hz 
          OpenGL: renderer: Mesa Intel UHD Graphics (CML GT2) v: 4.6 Mesa 20.0.8 direct render: Yes 
Audio:     Device-1: Intel vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 00:1f.3 
          Sound Server: ALSA v: k5.4.0-48-generic 
Network:   Device-1: Intel Wireless-AC 9462 driver: iwlwifi v: kernel port: 3000 bus ID: 00:14.3 
          IF: wlo1 state: up mac: <filter> 
Drives:    Local Storage: total: 476.94 GiB used: 10.15 GiB (2.1%) 
          ID-1: /dev/nvme0n1 vendor: Samsung model: MZVLQ512HALU-00000 size: 476.94 GiB 
Partition: ID-1: / size: 41.48 GiB used: 10.12 GiB (24.4%) fs: ext4 dev: /dev/nvme0n1p7 
          ID-2: swap-1 size: 7.63 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/nvme0n1p5 
Sensors:   System Temperatures: cpu: 45.0 C mobo: N/A 
          Fan Speeds (RPM): cpu: 0 
Info:      Processes: 251 Uptime: 23m Memory: 15.44 GiB used: 1.36 GiB (8.8%) Init: systemd runlevel: 5 Compilers: gcc: 9.3.0 
          Shell: bash v: 5.0.17 inxi: 3.0.38

$ hwinfo --sound
14: PCI 1f.3: 0403 Audio device                                 
 [Created at pci.386]
 Unique ID: nS1_.vs3HRr7P0uA
 SysFS ID: /devices/pci0000:00/0000:00:1f.3
 SysFS BusID: 0000:00:1f.3
 Hardware Class: sound
 Model: "Intel Audio device"
 Vendor: pci 0x8086 "Intel Corporation"
 Device: pci 0x02c8 
 SubVendor: pci 0x1043 "ASUSTeK Computer Inc."
 SubDevice: pci 0x1a11 
 Driver: "snd_hda_intel"
 Driver Modules: "snd_hda_intel"
 Memory Range: 0xb1218000-0xb121bfff (rw,non-prefetchable)
 Memory Range: 0xb1000000-0xb10fffff (rw,non-prefetchable)
 IRQ: 145 (11884 events)
 Module Alias: "pci:v00008086d000002C8sv00001043sd00001A11bc04sc03i80"
 Driver Info #0:
   Driver Status: snd_hda_intel is active
   Driver Activation Cmd: "modprobe snd_hda_intel"
 Driver Info #1:
   Driver Status: snd_sof_pci is active
   Driver Activation Cmd: "modprobe snd_sof_pci"
 Config Status: cfg=new, avail=yes, need=no, active=unknown

$ fuser -v /dev/snd/*
                    USER        PID ACCESS COMMAND
/dev/snd/controlC0:  frederik   5250 F.... pulseaudio

$ pacmd list-cards
1 card(s) available.
   index: 0
   name: <alsa_card.pci-0000_00_1f.3>
   driver: <module-alsa-card.c>
   owner module: 7
   properties:
       alsa.card = "0"
       alsa.card_name = "HDA Intel PCH"
       alsa.long_card_name = "HDA Intel PCH at 0xb1218000 irq 145"
       alsa.driver_name = "snd_hda_intel"
       device.bus_path = "pci-0000:00:1f.3"
       sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
       device.bus = "pci"
       device.vendor.id = "8086"
       device.vendor.name = "Intel Corporation"
       device.product.id = "02c8"
       device.form_factor = "internal"
       device.string = "0"
       device.description = "Built-in Audio"
       module-udev-detect.discovered = "1"
       device.icon_name = "audio-card-pci"
   profiles:
       input:analog-stereo: Analog Stereo Input (priority 65, available: unknown)
       output:analog-stereo: Analog Stereo Output (priority 6500, available: unknown)
       output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6565, available: unknown)
       output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5900, available: no)
       output:hdmi-stereo+input:analog-stereo: Digital Stereo (HDMI) Output + Analog Stereo Input (priority 5965, available: no)
       output:hdmi-surround: Digital Surround 5.1 (HDMI) Output (priority 800, available: no)
       output:hdmi-surround+input:analog-stereo: Digital Surround 5.1 (HDMI) Output + Analog Stereo Input (priority 865, available: no)
       output:hdmi-surround71: Digital Surround 7.1 (HDMI) Output (priority 800, available: no)
       output:hdmi-surround71+input:analog-stereo: Digital Surround 7.1 (HDMI) Output + Analog Stereo Input (priority 865, available: no)
       output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (priority 5700, available: no)
       output:hdmi-stereo-extra1+input:analog-stereo: Digital Stereo (HDMI 2) Output + Analog Stereo Input (priority 5765, available: no)
       output:hdmi-surround-extra1: Digital Surround 5.1 (HDMI 2) Output (priority 600, available: no)
       output:hdmi-surround-extra1+input:analog-stereo: Digital Surround 5.1 (HDMI 2) Output + Analog Stereo Input (priority 665, available: no)
       output:hdmi-surround71-extra1: Digital Surround 7.1 (HDMI 2) Output (priority 600, available: no)
       output:hdmi-surround71-extra1+input:analog-stereo: Digital Surround 7.1 (HDMI 2) Output + Analog Stereo Input (priority 665, available: no)
       output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (priority 5700, available: no)
       output:hdmi-stereo-extra2+input:analog-stereo: Digital Stereo (HDMI 3) Output + Analog Stereo Input (priority 5765, available: no)
       output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (priority 600, available: no)
       output:hdmi-surround-extra2+input:analog-stereo: Digital Surround 5.1 (HDMI 3) Output + Analog Stereo Input (priority 665, available: no)
       output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (priority 600, available: no)
       output:hdmi-surround71-extra2+input:analog-stereo: Digital Surround 7.1 (HDMI 3) Output + Analog Stereo Input (priority 665, available: no)
       output:hdmi-stereo-extra3: Digital Stereo (HDMI 4) Output (priority 5700, available: no)
       output:hdmi-stereo-extra3+input:analog-stereo: Digital Stereo (HDMI 4) Output + Analog Stereo Input (priority 5765, available: no)
       output:hdmi-surround-extra3: Digital Surround 5.1 (HDMI 4) Output (priority 600, available: no)
       output:hdmi-surround-extra3+input:analog-stereo: Digital Surround 5.1 (HDMI 4) Output + Analog Stereo Input (priority 665, available: no)
       output:hdmi-surround71-extra3: Digital Surround 7.1 (HDMI 4) Output (priority 600, available: no)
       output:hdmi-surround71-extra3+input:analog-stereo: Digital Surround 7.1 (HDMI 4) Output + Analog Stereo Input (priority 665, available: no)
       output:hdmi-stereo-extra4: Digital Stereo (HDMI 5) Output (priority 5700, available: no)
       output:hdmi-stereo-extra4+input:analog-stereo: Digital Stereo (HDMI 5) Output + Analog Stereo Input (priority 5765, available: no)
       output:hdmi-surround-extra4: Digital Surround 5.1 (HDMI 5) Output (priority 600, available: no)
       output:hdmi-surround-extra4+input:analog-stereo: Digital Surround 5.1 (HDMI 5) Output + Analog Stereo Input (priority 665, available: no)
       output:hdmi-surround71-extra4: Digital Surround 7.1 (HDMI 5) Output (priority 600, available: no)
       output:hdmi-surround71-extra4+input:analog-stereo: Digital Surround 7.1 (HDMI 5) Output + Analog Stereo Input (priority 665, available: no)
       off: Off (priority 0, available: unknown)
   active profile: <output:analog-stereo+input:analog-stereo>
   sinks:
       alsa_output.pci-0000_00_1f.3.analog-stereo/#0: Built-in Audio Analog Stereo
   sources:
       alsa_output.pci-0000_00_1f.3.analog-stereo.monitor/#0: Monitor of Built-in Audio Analog Stereo
       alsa_input.pci-0000_00_1f.3.analog-stereo/#1: Built-in Audio Analog Stereo
   ports:
       analog-input-internal-mic: Internal Microphone (priority 8900, latency offset 0 usec, available: unknown)
           properties:
               device.icon_name = "audio-input-microphone"
       analog-input-headset-mic: Headset Microphone (priority 8800, latency offset 0 usec, available: no)
           properties:
               device.icon_name = "audio-input-microphone"
       analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
           properties:
               device.icon_name = "audio-speakers"
       analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: no)
           properties:
               device.icon_name = "audio-headphones"
       hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: no)
           properties:
               device.icon_name = "video-display"
       hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: no)
           properties:
               device.icon_name = "video-display"
       hdmi-output-2: HDMI / DisplayPort 3 (priority 5700, latency offset 0 usec, available: no)
           properties:
               device.icon_name = "video-display"
       hdmi-output-3: HDMI / DisplayPort 4 (priority 5600, latency offset 0 usec, available: no)
           properties:
               device.icon_name = "video-display"
       hdmi-output-4: HDMI / DisplayPort 5 (priority 5500, latency offset 0 usec, available: no)
           properties:
               device.icon_name = "video-display"

播放音頻時:

$ pacmd list-sinks
1 sink(s) available.
 * index: 0
   name: <alsa_output.pci-0000_00_1f.3.analog-stereo>
   driver: <module-alsa-card.c>
   flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
   state: RUNNING
   suspend cause: (none)
   priority: 9039
   volume: front-left: 35389 /  54% / -16,06 dB,   front-right: 35389 /  54% / -16,06 dB
           balance 0,00
   base volume: 65536 / 100% / 0,00 dB
   volume steps: 65537
   muted: no
   current latency: 100,75 ms
   max request: 17 KiB
   max rewind: 17 KiB
   monitor source: 0
   sample spec: s16le 2ch 44100Hz
   channel map: front-left,front-right
                Stereo
   used by: 1
   linked by: 1
   fixed latency: 99,95 ms
   card: 0 <alsa_card.pci-0000_00_1f.3>
   module: 7
   properties:
       alsa.resolution_bits = "16"
       device.api = "alsa"
       device.class = "sound"
       alsa.class = "generic"
       alsa.subclass = "generic-mix"
       alsa.name = "ALC294 Analog"
       alsa.id = "ALC294 Analog"
       alsa.subdevice = "0"
       alsa.subdevice_name = "subdevice #0"
       alsa.device = "0"
       alsa.card = "0"
       alsa.card_name = "HDA Intel PCH"
       alsa.long_card_name = "HDA Intel PCH at 0xb1218000 irq 145"
       alsa.driver_name = "snd_hda_intel"
       device.bus_path = "pci-0000:00:1f.3"
       sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
       device.bus = "pci"
       device.vendor.id = "8086"
       device.vendor.name = "Intel Corporation"
       device.product.id = "02c8"
       device.form_factor = "internal"
       device.string = "front:0"
       device.buffering.buffer_size = "17632"
       device.buffering.fragment_size = "4408"
       device.access_mode = "mmap"
       device.profile.name = "analog-stereo"
       device.profile.description = "Analog Stereo"
       device.description = "Built-in Audio Analog Stereo"
       module-udev-detect.discovered = "1"
       device.icon_name = "audio-card-pci"
   ports:
       analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
           properties:
               device.icon_name = "audio-speakers"
       analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: no)
           properties:
               device.icon_name = "audio-headphones"
   active port: <analog-output-speaker>

這是一個問題alsa還是一個pulseaudio問題?

不是解決方案,但我在這裡找到了問題的解釋和解決方法:問題僅在從 Windows 10 中重新啟動啟動到 Linux 後發生。Windows 似乎將揚聲器置於睡眠模式,Linux 從中無法正確喚醒它們。解決方法是從 Windows 完全關閉,然後啟動到 Linux。

引用自:https://unix.stackexchange.com/questions/612847