Difference between revisions of "Pulseaudio"

From Blue-IT.org Wiki

(= Ubuntu 14.04)
(Script for connecting bluetooth headset)
 
(One intermediate revision by the same user not shown)
Line 12: Line 12:
 
* http://ubuntuforums.org/showthread.php?t=1132200
 
* http://ubuntuforums.org/showthread.php?t=1132200
  
Script for a simple bluetooth headset:
+
=== Script for auto-connecting a bluetooth headset ===
 +
The following script switches the default audio sink to the one of the headset, when the headset is switched on (checks every 10 seconds):
 +
 
 
  #!/bin/bash
 
  #!/bin/bash
 
  # switches automatically between bluetooth headset and loutspeaker
 
  # switches automatically between bluetooth headset and loutspeaker
Line 41: Line 43:
 
  fi
 
  fi
 
   
 
   
+
  sleep 10
  sleep 5
 
 
   
 
   
 
  done
 
  done

Latest revision as of 10:06, 22 February 2016

Connect bluetooth headset

Ubuntu 14.04

Add the following ppa:

sudo add-apt-repository ppa:blueman/ppa
sudo apt-get update
sudo apt-get upgrade blueman

Further reading:

Script for auto-connecting a bluetooth headset

The following script switches the default audio sink to the one of the headset, when the headset is switched on (checks every 10 seconds):

#!/bin/bash
# switches automatically between bluetooth headset and loutspeaker
# be sure you have checked that the device is enabled 
# in the "configurations" section of puvcontrol AND
# in /etc/bluetooth/audio.conf auncomment the line
# like this: "# AutoConnect=true"

###################################################
# EDIT
# use this command to find out:
# pacmd list-sinks | grep "name:"

myBTHeadSetSinkName="bluez_sink.xx_xx_xx_xx_xx"
myDefaultSinkName="alsa_output.usb-name_of_device.analog-stereo"
###################################################

while (true)
do

if pacmd list-sinks | grep "${myBTHeadSetSinkName}"
then
	pacmd set-default-sink "${myBTHeadSetSinkName}"

else
	pacmd set-default-sink "${myDefaultSinkName}"

fi

sleep 10

done