使用 Alsa 从两个应用程序录制线路音频

使用 Alsa 从两个应用程序录制线路音频

我目前正在开发一个在 cubieboard(ARMv7,类似 rasp-pi)上运行的小应用程序。

我真正需要做的是访问和记录来自两个不同应用程序的线路输入音频信号。

第一个是PyAudio第二个Darkice 媒体流光声卡使用 cubieboard 开发人员提供的内核驱动程序 sun4i-CODEC。音频层目前由ALSA 音频

目前,这两个应用程序都从 hw:0,0 开始记录,并且相互干扰。因此,如果我启动 Darkice Client,我的 Python 脚本将无权访问,反之亦然。

我的输出arecord -L

null
Discard all samples (playback) or generate zero samples (capture)
default
sysdefault:CARD=sun4icodec
    sun4i-CODEC, sun4i PCM
    Default Audio Device
dmix:CARD=sun4icodec,DEV=0
    sun4i-CODEC, sun4i PCM
    Direct sample mixing device
dsnoop:CARD=sun4icodec,DEV=0
    sun4i-CODEC, sun4i PCM
    Direct sample snooping device
hw:CARD=sun4icodec,DEV=0
    sun4i-CODEC, sun4i PCM
    Direct hardware device without any conversions
plughw:CARD=sun4icodec,DEV=0
    sun4i-CODEC, sun4i PCM
    Hardware device with all software conversions

这是我的amixer输出:

imple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined penum
  Playback channels: Mono
  Limits: Playback 0 - 63
  Mono: Playback 63 [100%]
Simple mixer control 'LineL',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'LineR',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Mic Input Mux',0
  Capabilities: volume volume-joined penum
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 15
  Mono: 15 [100%]
Simple mixer control 'MicL',0
  Capabilities: volume volume-joined penum
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 3
  Mono: 1 [33%]
Simple mixer control 'MicR',0
  Capabilities: volume volume-joined penum
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 3
  Mono: 3 [100%]
Simple mixer control 'Playback',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Capture',0
  Capabilities: cvolume cvolume-joined penum
  Capture channels: Mono
  Limits: Capture 0 - 7
  Mono: Capture 7 [100%]
Simple mixer control 'ADC Input Mux',0
  Capabilities: volume volume-joined penum
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 7 [100%]
Simple mixer control 'Fm',0
  Capabilities: volume volume-joined penum
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 7 [100%]
Simple mixer control 'FmL',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'FmR',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Ldac Left Mixer',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Ldac Right Mixer',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Rdac Right Mixer',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [off]

那么解决这个问题的最佳方案是什么?将立体声输入分成两个不同的设备?使用另一个音频层?我不知道!

先感谢您,

~MxAgent

相关内容