Grave áudio de vários dispositivos com ALSA e Pulseaudio

3

Eu quero gravar áudio de vários dispositivos de entrada usando ALSA e Pulseaudio. Mais precisamente, eu quero jogar UltraStar Deluxe. É um jogo usando o SDL. Tanto quanto eu posso dizer, ele suporta apenas ALSA. Tudo está funcionando bem, desde que eu simplesmente use o dispositivo virtual de pulso "ALSA" para saída e entrada. Infelizmente, isso só permite um dispositivo de entrada, mas eu quero gravar de três microfones independentes (USB). Misturar as três fontes em uma não é uma opção.

link sugere que você defina um PCM adicional do ALSA adicionando

pcm.<pcmname> {
  type pulse
  device <devicename>
}

para o meu ~/.asoundrc . Infelizmente, não consigo descobrir o que usar para o nome do dispositivo pulseaudio. Eu tentei com o que eu acho que o nome pulseaudio alsa_card.usb-0d8c_C-Media_USB_Audio_Device-00-Device . arecord -L mostra o ALSA PCM virtual adicional, mas não grava dele dando a mensagem de erro ALSA lib pcm_pulse.c:752:(pulse_prepare) PulseAudio: Unable to create stream: Entität nicht vorhanden (esse último bit alemão traduz em algo ao longo de Entity not existant ). O PCM ALSA virtual não é exibido no UltraStar Deluxe.

Como posso conseguir isso? É possível de alguma forma? Eu uso o Pulseaudio para todo o resto e funciona bem. Sem o Pulseaudio, trabalhar com muitos programas é trabalhoso e o áudio é escamoso.

Aqui está a saída de 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:

Atenciosamente

Hermann

    
por Hermann 13.05.2014 / 12:02

1 resposta

1

Eu mesmo descobri. Eu estava errado em assumir que a opção "dispositivo" precisaria de um nome de dispositivo. Em vez disso, é necessário um nome de origem (ou coletor, dependendo do que você está tentando obter). Isso, por exemplo, me dá acesso da ALSA a um microfone individual manipulado pelo 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
}
    
por 15.05.2014 / 13:26