[pulseaudio-discuss] remote source to local sink

Colin Guthrie gmane at colin.guthr.ie
Tue Jan 15 02:36:21 PST 2008


Colin Guthrie wrote:
> Ulf Behrens wrote:
>> Hi folks,
>>
>> I'm currently running two pulseaudio servers, one on my windows xp 
>> laptop and one on my linux desktop. I want to stream the audio oupput of 
>> for example itunes from my laptop to the speakers connected to my linux 
>> PC. What I've done up to now:
>>
>> - I'm running 'virtual audio cable' as a virtual soundcard on the 
>> laptop. This way the audio stream is available as a source stream to 
>> pulseaudio on the windows laptop.
> 
> Disclaimer: I've not used pulse on windows (been meaning to for a while
> - perhaps sometime soon!
> 
>> - I'm using module-tunnel-source to connect from my linux desktop to the 
>> windows PC. Why is the tunnel module deprecated? What do I loose using 
>> this module? And how do I establish this connection directly as it is 
>> recommended in the documentation?
> 
> Module tunnel is not deprecated. I use it all the time (linux->linux in
> my office and at home!).
> 
> So in your setup you have your audio source on your laptop/itunes and
> the actual sound card on your linux box.
> 
> Both should be running pulseaudio server. ON the itunes machine you
> should tell pulse to load module-tunnel-sink. This creates a local
> virtual audio device on your local machine which actually outputs to the
> network attached device.. You can then switch the stream played by
> itunes to this virtual device using pavucontrol (assuming this works in
> windows?)
> 
> You need to make sure that the server pulseaudio is configured to allow
> connections from the network (e.g. with authanonymous or and ip based
> ACL rule).
> 
> 
> Most of the information can be found on the pulse audio wiki, but I
> think there is probably call for some "Scenarios" to be put up there
> which give real step-by-step examples of how to achieve a given setup.
> I'll maybe try to do that sometime.
> 
> 
> FWIW, the best way to do this is to enable autodiscovery - this works
> great on Linux but again I'm not 100% sure how things work on windows.
> Essentially you need to make sure the server (or all pulseaudio daemons)
> have the zeroconf-publish module loaded. This uses
> Avahi/Bonjour/Rendevous/<insert new name here> to automatically
> broadcast the fact that the machine supports a "pulse audio sink". You
> can then use the zeroconf-discover module on the client to automatically
> load module-tunnel-sink when it detects these broadcasts. These settings
> can be configured via paprefs.
> 
>> - finally I have the stream I want to listen to as a source in my 
>> pulseaudio server on my linux PC. How to forward to the sink? I've tried 
>> to use rtp-send with option loop=1 and rtp-rcv on the same pulseaudio 
>> instance. It works, but it is not very elegant and I'm flooding the 
>> network with data which is not really needed anywhere. So I'm looking 
>> for something like the 'virtual audio cable' for internal use in 
>> pulseaudio. Any hints? Anyone already working on a solution?
> 
> What you want to do is possible now so no need to worry about it. I
> think you may be getting your sources and sinks mixed up. You're stream
> on your itunes machine should go something like:
> 
> itunes -> win-pa -> tunnel ---> lin-pa -> soundcard -> speakers -> ears
> 
> Hope that helps. Swing by #pulseaudio if you're stuck.
> 
> /me really needs to play with windows at some point.....


I've just realised that I kinda changed round what you asked because
it's how I think about it.

If you were wanting to play something in itunes and have it coming out
your windows speakers etc., then walk over to your linux box and somehow
access this stream also (e.g. keep it playing out of the windows
speakers), then this too is possible (this scenario is what is described
by the title "remote source to local sink" - what I described above was
a "local source/stream to a remote sink" i.e. I was considering the
windows PC to be local). It may be that what I described is what you
mean but hey....

You can on the linux box hook into the "monitor source" of the windows
pulseaudio daemon. You can, in theory, just play this remote stream
using e.g. pacat but in the short time I have to test I couldn't make it
do this... no doubt some brain dead thing I'm doing.... ;)

However, to illustate the point, you can use gstreamer. Here in this
example below is a gstreamer pipeline that will display music-matched
visualisations on linux from the sound playing on a remote machine.

In this example my remote machine is called "plateau". The stream
playing on that currently is actually the result of a tunnel from a
colleagues machine but that doesn't matter!


PULSE_SERVER=plateau gst-launch-0.10 pulsesrc
device=alsa_output.pci_10de_6a_alsa_playback_0.monitor ! audioconvert !
libvisual_bumpscope ! ffmpegcolorspace ! videoscale ! video/x-raw-yuv,
width=640, height=480 ! ffmpegcolorspace ! ximagesink

To explain:

# Name of the server
PULSE_SERVER=plateau

# The gstreamer pulsesrc to grab the audio. The device name is the name
# of the monitor source on the server - you can get this from pacmd and
# "list-sources" command on the server.
gst-launch-0.10 pulsesrc
device=alsa_output.pci_10de_6a_alsa_playback_0.monitor


# The rest of it is just some general gstreamer pipeline magic to take
# the audio, push it through a bumpscope visualisation then do some
# video conversion on it and finally display it.
audioconvert ! libvisual_bumpscope ! ffmpegcolorspace ! videoscale !
video/x-raw-yuv, width=640, height=480 ! ffmpegcolorspace ! ximagesink

HTH in some way :)

Col




More information about the pulseaudio-discuss mailing list