收到“失败:模块初始化失败”错误

收到“失败:模块初始化失败”错误

我已经创建了一个脚本文件(大约 3-4 个月前)来捕捉现场音频,它运行良好,我们能够捕捉现场音频,也可以从耳机听到声音。

这是我的脚本文件

#!/bin/bash

function set_live_audio {
        #get the sink name
        sink=$(pactl list short sinks | grep "alsa_output" | awk '{ print $2 }' | head -n1)

        #get bluetooth sources
        pactl list short sources | grep "bluez_source" | awk '{ print $2 }' | while read bluetooth_source
        do
                if [ ! "$(pactl list short modules | grep source=${bluetooth_source} | head -n1)" ]; then
                        index=`pactl load-module module-loopback source=${bluetooth_source} sink=${sink} latency_msec=1 source_dont_move=yes`
                fi
        done

        #get alsa sources
        pactl list short sources | grep "alsa_input.usb" | awk '{ print $2 }' | while read alsa_source
        do
                echo $alsa_source
                if [ ! "$(pactl list short modules | grep source=${alsa_source} | head -n1)" ]; then
                        index=`pactl load-module module-loopback source=${alsa_source} sink=${sink} latency_msec=1 source_dont_move=yes`
                fi
        done
}

while true; do
        set_live_audio
done

今天我又玩了这手牌,但我没有听到任何现场音频。我得到了“失败:模块初始化失败“错误。我尝试解决此错误,但没有成功。

这是我的输出pactl 列出简短来源命令(蓝牙开启)

0   alsa_input.usb-046d_0823_D81A0330-00-U0x46d0x823_1.analog-stereo    module-alsa-card.c  s16le 2ch 32000Hz   RUNNING
6   alsa_input.usb-046d_0823_4B709030-00-U0x46d0x823.analog-stereo  module-alsa-card.c  s16le 2ch 32000Hz   RUNNING
10  bluez_sink.00_1D_DF_44_DB_A6.monitor    module-bluetooth-device.c   s16le 1ch 8000Hz    RUNNING
11  bluez_source.00_1D_DF_44_DB_A6  module-bluetooth-device.c   s16le 1ch 8000Hz    RUNNING

那么我该如何解决这个错误呢?

答案1

重新启动 PulseAudio(如果需要,可以终止现有的守护进程):

pulseaudio -k

加载PulseAudio 模块为蓝牙设备提供 ALSA 接收器:

sudo pactl load-module module-alsa-sink device=bluetooth

相关内容