Pulseaudio
延遲不適用於 Linux 上的 PulseAudio
我有兩個揚聲器。第一個連接到 PCI 卡,第二個通過藍牙連接。聲音在 PCI 卡上播放得稍早一些,所以我想增加一些延遲。我下載了脈衝音頻 GUI,我有這個:
如您所見,我在“Audio Interne”(PCI 卡)上添加了 2 秒的偏移量。
我檢查了命令
pactl list cards
,我有這個用於內部卡:Card #1 Name: alsa_card.pci-0000_00_1b.0 Driver: module-alsa-card.c Owner Module: 8 Properties: alsa.card = "0" alsa.card_name = "HDA Intel PCH" alsa.long_card_name = "HDA Intel PCH at 0xf7f10000 irq 27" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:1b.0" sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.id = "1e20" device.product.name = "7 Series/C216 Chipset Family High Definition Audio Controller" device.form_factor = "internal" device.string = "0" device.description = "Audio interne" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" Profiles: input:analog-stereo: Entrée Stéréo analogique (sinks: 0, sources: 1, priority: 65, available: yes) output:analog-stereo: Sortie Stéréo analogique (sinks: 1, sources: 0, priority: 6500, available: yes) output:analog-stereo+input:analog-stereo: Duplex stéréo analogique (sinks: 1, sources: 1, priority: 6565, available: yes) output:analog-surround-21: Sortie Surround analogique 2.1 (sinks: 1, sources: 0, priority: 1300, available: yes) output:analog-surround-21+input:analog-stereo: Sortie Surround analogique 2.1 + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 1365, available: yes) output:analog-surround-40: Sortie Surround analogique 4.0 (sinks: 1, sources: 0, priority: 1200, available: yes) output:analog-surround-40+input:analog-stereo: Sortie Surround analogique 4.0 + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 1265, available: yes) output:analog-surround-41: Sortie Surround analogique 4.1 (sinks: 1, sources: 0, priority: 1300, available: yes) output:analog-surround-41+input:analog-stereo: Sortie Surround analogique 4.1 + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 1365, available: yes) output:analog-surround-50: Sortie Surround analogique 5.0 (sinks: 1, sources: 0, priority: 1200, available: yes) output:analog-surround-50+input:analog-stereo: Sortie Surround analogique 5.0 + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 1265, available: yes) output:analog-surround-51: Sortie Surround analogique 5.1 (sinks: 1, sources: 0, priority: 1300, available: yes) output:analog-surround-51+input:analog-stereo: Sortie Surround analogique 5.1 + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 1365, available: yes) output:iec958-stereo: Sortie Stéréo numérique (IEC958) (sinks: 1, sources: 0, priority: 5500, available: yes) output:iec958-stereo+input:analog-stereo: Sortie Stéréo numérique (IEC958) + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 5565, available: yes) off: Éteint (sinks: 0, sources: 0, priority: 0, available: yes) Active Profile: output:analog-stereo Ports: analog-input-front-mic: Microphone avant (priority: 8500, latency offset: 0 usec, available) Properties: device.icon_name = "audio-input-microphone" Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:analog-surround-41+input:analo g-stereo, output:analog-surround-50+input:analog-stereo, output:analog-surround-51+input:analog-stereo, output:iec958-stereo+input:analog-stereo analog-input-rear-mic: Microphone arrière (priority: 8200, latency offset: 0 usec, not available) Properties: device.icon_name = "audio-input-microphone" Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:analog-surround-41+input:analo g-stereo, output:analog-surround-50+input:analog-stereo, output:analog-surround-51+input:analog-stereo, output:iec958-stereo+input:analog-stereo analog-input-linein: Entrée ligne (priority: 8100, latency offset: 0 usec, available) Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:analog-surround-41+input:analo g-stereo, output:analog-surround-50+input:analog-stereo, output:analog-surround-51+input:analog-stereo, output:iec958-stereo+input:analog-stereo analog-output-lineout: Sortie ligne (priority: 9900, latency offset: 2000000 usec, available) Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21, output:analog-surround-21+input:analog-stereo, output:analog-surround-40, output:analog-surround-40+inp ut:analog-stereo, output:analog-surround-41, output:analog-surround-41+input:analog-stereo, output:analog-surround-50, output:analog-surround-50+input:analog-stereo, output:analog-surround-51, output:analog-surround-51+input:analog-stereo analog-output-headphones: Casque audio (priority: 9000, latency offset: 2000000 usec, not available) Properties: device.icon_name = "audio-headphones" Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo iec958-stereo-output: Sortie numérique (S/PDIF) (priority: 0, latency offset: 0 usec) Part of profile(s): output:iec958-stereo, output:iec958-stereo+input:analog-stereo
我試著去做
pactl play-sample bell.ogg alsa_output.pci-0000_00_1b.0.analog-stereo
。它似乎總是瞬間的。即使我播放音樂,我設置的延遲似乎也沒有改變任何東西。我能做些什麼?
編輯
隨著
pactl list sinks
,我看到這個:Latency: 2039815 usec, configured 40000 usec
所以似乎延遲設置正確,但是當我播放聲音時它似乎是瞬時的。我想應該有延遲。有什麼我不明白的嗎?
我猜您的螢幕截圖中的延遲偏移只是 Pulsaudio 計算給定採樣頻率的緩衝大小的時間,並嘗試使用 ALSA 安排這些參數。更改那裡的延遲偏移量而不顯示效果可能只是 ALSA 驅動程序不支持多種緩衝區大小。
要獲得額外的緩衝區,您可以添加一個空接收器來使用module-looppack
latency_msec
,如下所示:pactl load-module module-null-sink sink_name=delayed pactl load-module module-loopback latency_msec=2000 source=delayed.monitor sink=alsa_output.pci-0000_00_1b.0.analog-stereo
然後你必須將 null sink 與你的藍牙音頻結合起來。
在沒有module-combine-sink 的情況下測試這個簡單的設置時,我遇到了預期的巨大延遲,如下所示:
paplay someaudio.ext --device delayed