1

I have created a script file ( approximately 3-4 months before) capturing the live audio and it worked fine we are able to capture the live audio and also can hear from the headphone.

Here is my script file

#!/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

Today I again ran this hand, but I didn't catch any live audio. I get "Failure: Module initialization failed" error. I tried to resolve this error but no luck.

Here is my output of pactl list short sources command (with bluetooth on)

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

So how can I resolve this error.

1

Run

pulseaudio -k
sudo pactl load-module module-alsa-sink device=bluetooth
  • 7
    Can you please explain how these commands work and what they do to fix the problem? – Kaz Wolfe Jul 17 '15 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.