Tutorials Linux Pulseaudio redirect

From WebOS Internals
Jump to navigation Jump to search

Abstract

This tutorial will explain how to redirect the regular sounds (except telephony) to an external pulseaudio server. This will allow you to directly play sound from your Palm Pre on your Desktop/Mediacenter PC. Notifications and the Ringtone will also be played via PA while an actual call will be routed through the Handset speakers/mic.

PC Configuration

I am running pulseaudio as system service because it needs to run even if noone is logged into the computer. You might be able to configure pulseaudio the same way if you're not running in system mode, but I never tried that. Feedback is appreciated.

First you need to allow network connections to pulseaudio. Edit /etc/pulse/system.pa and define the IP ranges that you want to allow.

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24;::1;2001:638:602:af01::/64

then you need to remap the sinks the Pre uses to your default output. If the Pre can't find these sinks sound wont work.

load-module module-remap-sink sink_name=palerts master=alsa_output.default channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right

You will need multiple lines like this with all the sink_names. They are palerts, pmedia, pnotifications, pfeedback, pringtones, pflash, pnavigation, pvoicedial, pdefaultapp, peffects, pDTMF, pcalendar, palarm

Palm Pre Configuration

In order to switch sound output you only need to create a /var/root/.pulse/client.conf with the following content:

default-server=ip-address

where ip-address is the IP address of your PA server.

Possibilities and Issues

  • An application would be nice that can switch servers and automatically resets to the internal server if the external is no longer available. Could also integrate with avahi and show possible servers
  • If you have periodic stalls of the sound your (WiFi) connection is probably too flaky. Try moving closer to the AP.
  • Some soundeffects seem to use whatever server was the default at boot time (i.e. the "shh" sound when you close an app)
  • If you forget to delete the client.conf and just go you wont be able to hear any audio signals
  • The volume keys on the Pre will not work