将声音从 Chromium 克隆到 ALSA Loopback 以及扬声器

将声音从 Chromium 克隆到 ALSA Loopback 以及扬声器

我已经在我的RPi3 B+使用 Raspbian,Chromium 浏览器的声音直接发送到ALSA 环回设备modprobe snd-aloop(作为内核模块启用)通过此 Chromium 的参数: --alsa-output-device='plug:front'。整个命令:

/usr/lib/chromium-browser/chromium-browser --ignore-autoplay-restrictions --disk-cache-size=50000000 --kiosk --disable-extensions --noerrdialogs --allow-insecure-localhost --enable-gpu-rasterization --enable-zero-copy --enable-native-gpu-memory-buffers --alsa-output-device='plug:front' https://youtu.be/nW--BbY6Z5E

PS:plug:front取自aplay -L输出。

此声音已成功通过 Loopback 捕获设备录制/hw:0,1捕获暗冰这是实时音频流媒体。以下只是相关部分/etc/darkice.cfg

[input]
device          = hw:0,1    # soundcard device for the audio input
sampleRate      = 44100     # other settings have crackling audo, esp. 44100
bitsPerSample   = 16        # bits per sample. try 16
channel         = 2         # channels. 1 = mono, 2 = stereo

但我还需要通过连接到线路输出(插孔)的外部扬声器播放此声音。
如何做到这一点?你能帮助我吗?我如何克隆声音输出?

# uname -a
Linux rpi3 4.19.114-v7+ #1303 SMP Tue Apr 7 15:44:16 BST 2020 armv7l GNU/Linux

# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
  Subdevices: 7/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 1: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/7
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
card 1: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

# cat /proc/asound/cards
 0 [Loopback       ]: Loopback - Loopback
                      Loopback 1
 1 [ALSA           ]: bcm2835_alsa - bcm2835 ALSA
                      bcm2835 ALSA

相关内容