[pulseaudio-discuss] alsa plugin vs. pulse

Jim Carter jimc at math.ucla.edu
Tue Oct 9 13:27:04 PDT 2007


On Mon, 8 Oct 2007, Brad Midgley wrote:

> Is there any way at all to route the pulse audio stream to an alsa
> plugin like bluetooth? 

I'm doing what I think you want -- default output from PulseAudio is 
bluetooth (name is a2dpd on my system).  Although my ALSA default is still 
hw:0,0, but doesn't have to be.  I'm appending my default.pa and .asoundrc 
files.  (I'm not suggesting these as best practices...)  Bluez-utils 
version 3.19, PulseAudio 0.9.6 (still haven't been able to get 0.9.7 to 
configure; I've been concentrating on bluez-utils.)

Unfortunately for me, this setup hasn't been very successful, talking to a 
Motorola HT-820 headset sent from a Dell type 355 (Broadcom BCM2045) 
builtin HCI (Bluetooth 2.0).  In the most recent test, about 70% of the 
music was just lost, as if the packets were trashed beyond the ability of 
the 2nd layer protocol to retransmit them.  Maybe the neighbor was using 
the microwave oven :-) (not really, it's at least 30 meters to the nearest 
one), but it works almost perfectly minus PulseAudio, the player (xmms) 
writing directly on the ALSA device.

Somehow I think the problem isn't trashed packets, it's problems sending 
them out.  Since I've sort of figured out how to use bluez-utils-3.19 (just 
in time for 3.20 to come out), I'm going to be working on PulseAudio in the 
next few days.

I'm really interested in news of other people's experience with PulseAudio 
and the current bluez-utils -- does it work for you?

James F. Carter          Voice 310 825 2897    FAX 310 206 6673
UCLA-Mathnet;  6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Email: jimc at math.ucla.edu  http://www.math.ucla.edu/~jimc (q.v. for PGP key)

=------ /usr/local/etc/pulse/default.pa

#!/usr/local/bin/pulseaudio -nF 
# Set up for Xena by jimc, 2007-07-28
# Hints from sample conf file in 
# http://wm161.net/2007/06/24/how-pulseaudio-made-my-openhouse-awesome/

### Load protocols
load-module module-esound-protocol-unix
load-module module-native-protocol-unix

# jimc hack: activate runtime reconfiguration, localhost only.  Default port
# is 4712.  Later I discovered that "pacmd" does the same thing over the
# UNIX domain socket, so I stopped using this.
# load-module module-cli-protocol-tcp listen=127.0.0.1

### Automatically restore the volume of playback streams
load-module module-volume-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

# Preload modules using human-friendly names.
load-module module-alsa-sink sink_name=speaker device=hw:0
load-module module-alsa-source source_name=capture device=hw:0
load-module module-alsa-sink sink_name=a2dpd device=a2dpd

### Detect hardware on the machine, pick 1 or none
#load-module module-hal-detect
#load-module module-detect

### Make some devices default
# set-default-sink speaker
set-default-sink a2dpd
set-default-source capture

### Load audio drivers automatically on access
add-autoload-sink output module-alsa-sink sink_name=a2dpd device=a2dpd
add-autoload-sink output module-oss device="/dev/dsp" sink_name=ossout source_name=ossin
add-autoload-source input module-oss device="/dev/dsp" sink_name=ossout source_name=ossin

.nofail

### Load something to the sample cache
# (jimc hack: wrong dir on SuSE and I don't like this sound anyway)
#load-sample x11-bell /usr/share/sounds/gtk-events/activate.wav
load-sample x11-bell /opt/gnome/share/sounds/gtk-events/toggled.wav
#load-sample-dir-lazy /usr/share/sounds/*.wav

### Load X11 bell module
load-module module-x11-bell sample=x11-bell

### Publish connection data in the X11 root window
load-module module-x11-publish

=------- ~/.asoundrc

# Alsa sound configuration, used with arecord and aplay.
# Set up manually by jimc, 2004-08-25
# 2007-03-15	Add Bluetooth devices
# 2007-09-25	Try again to make the software volume control work

# The internal audio bus (I think), used for sound output
pcm.line {
	type	hw
	card	0
	device	0
}

# The microphone ADC
pcm.mic {
	type	hw
	card	0
	device	1
}

# Bluetooth A2DP and SCO device and corresponding mixer
# A2DP is stereo output at 44100 Hz; SCO is mono input-output at 8000 Hz.
#pcm.a2dpd {
#	type	plug
#	slave.pcm	"a2dpdsoftvol"
#}
#pcm.a2dpdsoftvol {
#	type	softvol
#	slave {
#		pcm "a2dpdplug"
#	}
#	control {
#		name "Bluetooth Headset"
#		card	0
#		count	1
#	}
#}
#pcm.a2dpdplug {
#	type a2dpd
#}
pcm.a2dpd {
	type	bluetooth
	device	00:07:A4:F1:C8:E9
	profile	a2dp
}
# The library that implements ctl.a2dpd is no longer built, as of CVS 2007-08-04
# It's back in bluez-utils-3.19



# For the HSP/HFP telephony headset
pcm.sco {
	type	sco
#	device	00:07:A4:F1:C8:E9
}
ctl.sco {
	type	sco
}

pcm.default pcm.a2dpd




More information about the pulseaudio-discuss mailing list