使用 ALSA 和 Pulseaudio 從多個設備錄製音頻
我想使用 ALSA 和 Pulseaudio 從多個輸入設備錄製音頻。更準確地說,我想玩 UltraStar Deluxe。這是一個使用 SDL 的遊戲。據我所知,它僅支持 ALSA。只要我簡單地使用虛擬 ALSA“脈衝”設備進行輸出和輸入,一切都執行良好。不幸的是,這只允許一個輸入設備,但我想從三個獨立的(USB)麥克風錄製。將三個源縮混為一個不是一種選擇。
https://wiki.archlinux.de/title/Pulseaudio#Mehrere_PulseAudio_ALSA_Ger.C3.A4te建議通過添加定義一個額外的 ALSA PCM
pcm.<pcmname> { type pulse device <devicename> }
到我的
~/.asoundrc
. 不幸的是,我無法確定pulseaudio 設備名稱的用途。我嘗試了我猜它的 pulseaudio 名稱alsa_card.usb-0d8c_C-Media_USB_Audio_Device-00-Device
。arecord -L
顯示了附加的虛擬 ALSA PCM,但未能從中記錄並給出錯誤消息ALSA lib pcm_pulse.c:752:(pulse_prepare) PulseAudio: Unable to create stream: Entität nicht vorhanden
(最後一個德語位轉換為 沿Entity not existant
)。UltraStar Deluxe 中不顯示虛擬 ALSA PCM。我怎樣才能做到這一點?有可能嗎?我將 Pulseaudio 用於其他所有內容,並且效果很好。如果沒有 Pulseaudio,與許多程序一起工作很麻煩,而且音頻很不穩定。
這是輸出
pacmd list-cards
:4 card(s) available. index: 0 ... (HDMI Output Device stripped) index: 1 name: <alsa_card.pci-0000_00_1b.0> driver: <module-alsa-card.c> owner module: 6 properties: alsa.card = "0" alsa.card_name = "HDA Intel PCH" alsa.long_card_name = "HDA Intel PCH at 0xf6130000 irq 48" 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/C210 Series Chipset Family High Definition Audio Controller" device.form_factor = "internal" device.string = "0" device.description = "Internes Audio" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" profiles: input:analog-stereo: Analog Stereo Eingang (priority 60, available: unknown) output:analog-stereo: Analog Stereo Ausgang (priority 6000, available: unknown) output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060, available: unknown) output:analog-surround-40: Analog Surround 4.0 Ausgang (priority 700, available: unknown) output:analog-surround-40+input:analog-stereo: Analog Surround 4.0 Ausgang + Analog Stereo Eingang (priority 760, available: unknown) output:analog-surround-41: Analog Surround 4.1 Ausgang (priority 800, available: unknown) output:analog-surround-41+input:analog-stereo: Analog Surround 4.1 Ausgang + Analog Stereo Eingang (priority 860, available: unknown) output:analog-surround-50: Analog Surround 5.0 Ausgang (priority 700, available: unknown) output:analog-surround-50+input:analog-stereo: Analog Surround 5.0 Ausgang + Analog Stereo Eingang (priority 760, available: unknown) output:analog-surround-51: Analog Surround 5.1 Ausgang (priority 800, available: unknown) output:analog-surround-51+input:analog-stereo: Analog Surround 5.1 Ausgang + Analog Stereo Eingang (priority 860, available: unknown) output:iec958-stereo: Digital Stereo (IEC958) Ausgang (priority 5500, available: unknown) output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Ausgang + Analog Stereo Eingang (priority 5560, available: unknown) off: Aus (priority 0, available: unknown) active profile: <output:analog-stereo> sinks: alsa_output.pci-0000_00_1b.0.analog-stereo/#0: Internes Audio Analog Stereo sources: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor/#0: Monitor of Internes Audio Analog Stereo ports: analog-input: Analoge Eingabe (priority 10000, latency offset 0 usec, available: unknown) properties: analog-input-microphone: Mikrofon (priority 8700, latency offset 0 usec, available: no) properties: device.icon_name = "audio-input-microphone" analog-input-linein: Line In (priority 8100, latency offset 0 usec, available: no) properties: analog-output: Analoge Ausgabe (priority 9900, latency offset 0 usec, available: unknown) properties: iec958-stereo-output: Digitaler Ausgang (S/PDIF) (priority 0, latency offset 0 usec, available: unknown) properties: index: 2 name: <alsa_card.usb-0d8c_C-Media_USB_Audio_Device-00-Device> driver: <module-alsa-card.c> owner module: 7 properties: alsa.card = "1" alsa.card_name = "C-Media USB Audio Device" alsa.long_card_name = "C-Media USB Audio Device at usb-0000:00:1d.0-1.5, full speed" alsa.driver_name = "snd_usb_audio" device.bus_path = "pci-0000:00:1d.0-usb-0:1.5:1.0" sysfs.path = "/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/sound/card1" udev.id = "usb-0d8c_C-Media_USB_Audio_Device-00-Device" device.bus = "usb" device.vendor.id = "0d8c" device.vendor.name = "C-Media Electronics, Inc." device.product.id = "0008" device.product.name = "C-Media USB Audio Device " device.serial = "0d8c_C-Media_USB_Audio_Device" device.string = "1" device.description = "C-Media USB Audio Device " module-udev-detect.discovered = "1" device.icon_name = "audio-card-usb" profiles: input:analog-mono: Analog Mono Eingang (priority 1, available: unknown) output:analog-stereo: Analog Stereo Ausgang (priority 6000, available: unknown) output:analog-stereo+input:analog-mono: Analog Stereo Ausgang + Analog Mono Eingang (priority 6001, available: unknown) output:iec958-stereo: Digital Stereo (IEC958) Ausgang (priority 5500, available: unknown) output:iec958-stereo+input:analog-mono: Digital Stereo (IEC958) Ausgang + Analog Mono Eingang (priority 5501, available: unknown) off: Aus (priority 0, available: unknown) active profile: <input:analog-mono> sources: alsa_input.usb-0d8c_C-Media_USB_Audio_Device-00-Device.analog-mono/#1: C-Media USB Audio Device Analog Mono ports: analog-input-microphone: Mikrofon (priority 8700, latency offset 0 usec, available: unknown) properties: device.icon_name = "audio-input-microphone" analog-output: Analoge Ausgabe (priority 9900, latency offset 0 usec, available: unknown) properties: iec958-stereo-output: Digitaler Ausgang (S/PDIF) (priority 0, latency offset 0 usec, available: unknown) properties: index: 3 name: <alsa_card.usb-0d8c_C-Media_USB_Audio_Device-00-Device_1> driver: <module-alsa-card.c> owner module: 8 properties: alsa.card = "2" alsa.card_name = "C-Media USB Audio Device" alsa.long_card_name = "C-Media USB Audio Device at usb-0000:00:1d.0-1.6, full speed" alsa.driver_name = "snd_usb_audio" device.bus_path = "pci-0000:00:1d.0-usb-0:1.6:1.0" sysfs.path = "/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/sound/card2" udev.id = "usb-0d8c_C-Media_USB_Audio_Device-00-Device_1" device.bus = "usb" device.vendor.id = "0d8c" device.vendor.name = "C-Media Electronics, Inc." device.product.id = "0008" device.product.name = "C-Media USB Audio Device " device.serial = "0d8c_C-Media_USB_Audio_Device" device.string = "2" device.description = "C-Media USB Audio Device " module-udev-detect.discovered = "1" device.icon_name = "audio-card-usb" profiles: input:analog-mono: Analog Mono Eingang (priority 1, available: unknown) output:analog-stereo: Analog Stereo Ausgang (priority 6000, available: unknown) output:analog-stereo+input:analog-mono: Analog Stereo Ausgang + Analog Mono Eingang (priority 6001, available: unknown) output:iec958-stereo: Digital Stereo (IEC958) Ausgang (priority 5500, available: unknown) output:iec958-stereo+input:analog-mono: Digital Stereo (IEC958) Ausgang + Analog Mono Eingang (priority 5501, available: unknown) off: Aus (priority 0, available: unknown) active profile: <input:analog-mono> sources: alsa_input.usb-0d8c_C-Media_USB_Audio_Device-00-Device_1.analog-mono/#2: C-Media USB Audio Device Analog Mono ports: analog-input-microphone: Mikrofon (priority 8700, latency offset 0 usec, available: unknown) properties: device.icon_name = "audio-input-microphone" analog-output: Analoge Ausgabe (priority 9900, latency offset 0 usec, available: unknown) properties: iec958-stereo-output: Digitaler Ausgang (S/PDIF) (priority 0, latency offset 0 usec, available: unknown) properties:
問候
赫爾曼
我自己想通了。我錯誤地認為“設備”選項需要設備名稱。相反,需要一個源(或接收器,取決於您要達到的目標)名稱。例如,這使我可以通過 ALSA 訪問由 pulseaudio 處理的單個麥克風:
pcm.pulse_mic1 { type pulse device alsa_input.usb-0d8c_C-Media_USB_Audio_Device-00-Device.analog-mono } ctl.pulse_mic1 { type pulse device alsa_input.usb-0d8c_C-Media_USB_Audio_Device-00-Device.analog-mono }