22

I have an unused HTC Hero Android phone (running Android OS 2.1), I would like to connect it to audio amplifier and leave it connected for months, so I could use this android phone as remote pulseaudio server/receiver/etc.

There is "Remote Audio" application available on Android Market, that can grab stream from /dev/dsp. /dev/dsp has been disabled by mistake/whatever reason in ubuntu 10.10 and even after I enabled it as per this thread - after following these instructions it didn't help, so when I click Play/Pause button on my android - nothing really happens and mpg123 song.mp3 still uses my laptop speakers. last | head even doesn't show this new user logging in (I suppose it should appear here?)

Searching by "pulseaudio" I found Airbubble on Android market, but it says " does not work with RaopX on MacOS X and the raop module for pulseaudio on Linux." (c)

So is there a way to use Android phone as remote audio receiver, ideally not limited to playing mp3/music - but the Sound sub-system in general?

Surely I'm not the only man who wishes to broadcast audio to the android phone via wi-fi to listen it on proper speakers?

5 Answers 5

20

Two days ago I stumbled on this question and couldn't get it right. Eventually I read in AirBubble manual that RAOP is unsupported.

I finally solved it with DLNA/UPnP capabilities of pulseaudio. It works just like you would expect. You play sound with any app with pulseaudio output on your box and select the streaming output whenever you like to redirect it to your Android device.

First, install Rygel:

$ sudo apt-get install rygel rygel-preferences rygel-gst-launch

Then alter the file /etc/rygel.conf, so that the line with the parameter enable-transcoding looks like this:

enable-transcoding=false

Then load the DLNA and TCP modules and start rygel:

$ pactl load-module module-http-protocol-tcp
$ pactl load-module module-rygel-media-server 
$ pactl load-module module-null-sink sink_name=upnp format=s16be channels=2 rate=44100 sink_properties="device.description='DLNA/UPnP Streaming' device.bus='network' device.icon_name='network-server'"
$ rygel

On your Android device download the app BubbleUPnP. Your pulseaudio output devices will be listed under the server "Sound on %HOSTNAME%". Direct the output on your computer to the DLNA device in sound preferences. Select the same output in BubbleUPnP.

Bear in mind that BubbleUPnP streams the first 30 minutes for free. The full version is 3,49€, but I guess it's worth the price. I didn't get any other app to work for me.

Finally, you can disable the media browser if you don't like it using rygel-preferences:

$ rygel-preferences

One more heads-up: this directly streams raw LPCM data, which is constantly ~250 kB/s. Any spurious WLAN activity will induce stuttering if you're on anything but an 802.11 n network. If you plan to base your entertainment solutions on wireless streaming, consider buying a wireless n router.

FOLLOW UP: TRANSCODING

To reduce network overhead and stuttering (which will happen unless you're on a 802.11 n network), it is possible to turn to transcoding the audio stream to mp3.

Paste this into ~/.config/rygel.conf

[GstLaunch]
enabled=true
launch-items=mypulseaudiosink
mypulseaudiosink-title=Sound on @HOSTNAME@
mypulseaudiosink-mime=audio/mpeg
mypulseaudiosink-launch=pulsesrc device=upnp.monitor ! lamemp3enc target=quality quality=6

Use the "Gst Launch" DLNA service which will now appear when you start rygel.

FOLLOW UP 2: FLAC

LAME can cause up to 2 minutes (!) of delay. FLAC on the other hand is pretty fast, normally clocking below one second. Change the lines in the above example to:

mypulseaudiosink-mime=audio/flac
mypulseaudiosink-launch=pulsesrc device=upnp.monitor ! flacenc quality=8

This reduces the stream to about 100 kB/s, allowing for smooth playback on most 802.11g networks with multiple users. I tested it while downloading a torrent. At full speed, there was some stuttering, but when I limited the download speed to around 200 kB/s below my maximum bandwidth, it was smooth again.

Plus, you have eliminated any loss in quality.


Couple of issues on the above - check and edit ~/.config/rygel.conf instead, the /etc/.config/rygel.conf if it isn't loaded by default (?).

The sink creation will not work on later Ubuntu versions.

What worked for me, however, is to follow all instructions (sans the sink creation). Then run paprefs, and on the "Network server" tab, select the bottom option "Make local sound devices available as uPnP server" (and maybe the suboption is required as well).

Start rygel, and select the new "DLNA/UPnP Streaming" option in PulseAudio settings.

On BubbleUPnP select "Gst Launch" as Library. In the app, select Library and there should now be an option on the top called "Sound on ".

4
  • 3
    To the poster regarding the use of rygel: the approach seems sound but module-null-sink doesn't take those arguments in the 11.10 version. You must mean another module but I can't locate it yet. Good idea, please help by correcting.
    – user46720
    Feb 16, 2012 at 21:29
  • After running pactl load-module module-null-sink sink_name=upnp......, I get this error: Failure: Module initalization failed. Any idea? Jan 27, 2013 at 13:54
  • @KhurshidAlam: Try my approach, it has no text editing and relies only on a working Wine being installed. May 3, 2013 at 20:01
  • @JanusTroelsen: While your approach does work, I would stress that other methods be attempted first. Wine is a great project, but should only be used as a last resort. It's unreliable.
    – dghodgson
    Dec 11, 2013 at 5:34
13

I think you're over-working the idea, trying to make your phone do something it was never intended to do (connect to PulseAudio or something even more low-level). Make your computer do the hard work.

I'd suggest going with something like Icecast (tutorial here) and using one of the 30-odd apps for Android that can stream it.

2
  • Thanks, but there are at least 2 applications on Android market that supposed to solve exactly my problem: "remote audio" and "AirBubble" (that is compatible with Apple AirportExpress).
    – user35834
    Nov 29, 2011 at 2:39
  • @user35834: after having set up an Icecast server on the Ubuntu side you will be independent on the receiver side. Anything(!) that can tune to an "Internet Radio" will also be able to receive your own stream. There are many additional advantages from Icecast vs. RAOP.
    – Takkat
    Nov 29, 2011 at 7:27
1

Shairplay doesn't support TCP and raop_play (I think pulseaudio-module-raop is based on this) doesn't support UDP. Why raop is TCP only is weird, UDP seems like an easier and more suited protocol on the face of it.

And if you're source is flac then icecast via MP3 is going to kill quality, plus it's more of a CPU hog. MPD natively supports pulseaudio output so you could "switch on and off" different rooms of the house using e.g. an android phone with mpdroid app. If you could use airplay docks as endpoints you'd have a fantastic setup. But you can't cos raop doesn't support the simpler UDP endpoints!

1

You might want to look outside the Pulseaudio community.

I'm trying out Subsonic to do this. It has worked well so far. I've installed it on my Ubuntu system, my living room Roku, on my primary Android phones and on my secondary Android phone which is wifi-only. All of these devices are connected via wifi. I'm planning to install it on a Windows machine as well, so that my wife can stream her iTunes collection to other devices.

I can now stream Audio and Video from my Ubuntu system to my Roku in the living room, or my Android which I can take to the kitchen or while folding laundry. I can also stream from any computer which has a web-browser. I stream music and podcasts while working on long, boring house maintenance projects.

So far it has worked out well.

0

You can use Foobar2000 on the server and BubbleUPnP (payware) on the client.

  1. get Wine
  2. get foobar_v1.2.5.exe
  3. $ wine foobar2000_v1.2.5.exe
  4. next, next, next... :)
  5. get foo_upnp
  6. extract in the components folder of foobar2000 (which probably is in ~/.wine/drive_c/Program Files/)
  7. launch foobar2000
  8. go to Library→Configure→Playback→Output→Device and select "Null output"
  9. make sure ufw is not blocking the relevant traffic
  10. in BubbleUPnP:
    1. go to Devices→Libraries and select the foobar2000 server
    2. in "Library", select "Playback Stream Capture"

This approach has the advantage that if you pause on the Android, it will accummulate a buffer (since the server is still sending).

Tested on Ubuntu (Wine version 1.5.28-0ubuntu1~ppa1, foobar2000 version 1.2.5 and foo_upnp version 0.99.46) and Windows.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .