maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Why is pulseaudio crippled on the n900? (https://talk.maemo.org/showthread.php?t=36936)

go1dfish 2009-12-13 00:20

Why is pulseaudio crippled on the n900?
 
PulseAudio is used for the audio system/mixing/routing on the n900.

Compared to other solutions for mixing/routing, PA is quite CPU heavy. The n900 is a beast of a machine, so this isn't as much of an issue, but I have to wonder why for the life of me I cannot get PulseAudio's "killer app" working.

I'm speaking of course of network-transparency, the ability to route audio in PulseAudio over a TCP connection. I've spent many hours banging my head against the device trying to find a way to get pulseaudio-native-tcp working, but to no avail.

Is this intentional? Is there a reason why I shouldn't be able route audio to the n900 from other hosts on my LAN? The module appears to be included, and the config even appears to attempt to load it, but I can't even connect from 127.0.0.1


Getting TCP PulseAudio streams working would also provide a path to get sound working from inside of chroot's like qole's

Without network transparency, what good is PulseAudio? I would be happy to part with a few cpu cycles to gain this added flexibility, but in it's current state the use of PulseAudio on the n900 feels wasteful.

Has anyone made any headway on this?

dmj726 2009-12-13 01:24

Re: Why is pulseaudio crippled on the n900?
 
I don't have a device to try this out on, but I'd like to see this too. Pulseaudio's ability to route audio over the network hasn't felt all that useful on my desktop, but it would be perfect for a mobile phone. Hopefully we can find a way to do this.

Flandry 2010-01-07 16:06

Re: Why is pulseaudio crippled on the n900?
 
Did you file a bug report?

Laughing Man 2010-01-07 16:37

Re: Why is pulseaudio crippled on the n900?
 
That's dissapointing, this is one of the things I wanted to try with pulseaudio on the N900. :(

Hopefully a community fix or an official fix will come for this (and I have to choose a distribution that actually implemented pulseaudio correctly.. ie: not Ubuntu).

benny1967 2010-01-07 23:04

Re: Why is pulseaudio crippled on the n900?
 
The wiki on
http://wiki.maemo.org/Documentation/...ain#PulseAudio
advertises PA's network-transparency, so at least it doesn't seem to be a well-known restriction. Either it's intentional and wasn't yet communicated, or it's a bug (which you please must report, describing exactly what you did to get it working) - or it's just something you forgot when you tried.

I don't know much about PA other than the few buzzwords floating around. My main computer is a gentoo box and doesn't have PA installed (yet?). My laptop runs Ubuntu with PA, and I did notice how easy it was to switch audio output to a A2DP headset.

Now if this works with the N900... and works across devices in my network... what could I do?

Like, in theory, could I answer a call on my laptop when the phone rings in the other room? With a command line script I could run via SSH to make the phone part of the N900 answer the call and re-route everything sound related to my Ubuntu laptop. Would that be possible, given PA does really work without restrictions on the N900? Or am I getting too excited here? ;)

Laughing Man 2010-01-07 23:10

Re: Why is pulseaudio crippled on the n900?
 
Well you probably couldn't answer the N900 while on the laptop unless you had some SSH or VNC connection setup to the SSH to remote control it. But what PulseAudio's networking lets you do is pipe the audio to whereever you want.

E.g. if you wanted to play whatever sound that was coming from the N900 (music, podcast, and ideally a phone call) you could direct it over to your desktop's speakers or laptop's speakers). Not sure how it works with input sources but I believe it could be the same (if it is you could use say your headset or laptop's microphone instead of the N900's microphone).

benny1967 2010-01-07 23:26

Re: Why is pulseaudio crippled on the n900?
 
Quote:

Originally Posted by Laughing Man (Post 458363)
Well you probably couldn't answer the N900 while on the laptop unless you had some SSH or VNC connection setup to the SSH to remote control it.

Of course I need a way to remote-control the N900 from my laptop the moment I hear it ring. This would be done via a script (on the N900) I call via SSH. (I an ideal world, it would be a fancy app on both sides with GUI and some options and settings :D )

Funny idea, actually. Not really useful, I'm afraid, but funny.

Laughing Man 2010-01-07 23:31

Re: Why is pulseaudio crippled on the n900?
 
Likewise you can think of it the other way around.

Imagine using the N900 as an additional speaker. You could put your PC speakers to your side and the N900 behind you. =P

Shanezlar 2010-01-07 23:52

Re: Why is pulseaudio crippled on the n900?
 
I had to install the package pulseaudio-module-extra in order to have pulseaudio-native-tcp actually loaded.
Alas, I still can't connect from/to other machines as the connection is always terminated prematurely.

Local connections to the N900 itself over tcp DO work however (tested with paplay and pactl). Maybe some part is implemented in a non-standard way.

Needs some more looking into.

javispedro 2010-01-08 00:02

Re: Why is pulseaudio crippled on the n900?
 
Quote:

Originally Posted by go1dfish (Post 425041)
Getting TCP PulseAudio streams working would also provide a path to get sound working from inside of chroot's like qole's

Wouldn't reusing the same client libraries as shipped with the N900 and binding whatever directories those use work?

qole 2010-01-08 00:17

Re: Why is pulseaudio crippled on the n900?
 
Quote:

Originally Posted by javispedro (Post 458435)
Wouldn't reusing the same client libraries as shipped with the N900 and binding whatever directories those use work?

Yeah, you would THINK so, wouldn't you? :mad:

Tried copying all the pulseaudio modules to Debian, and even mounting every possible pulse-related directory, without any success whatsoever. The chroot client simply gets unceremoniously disconnected.

I wish go1dfish would file the bug, so at least we can get Nokia to tell us if it is WORKSFORME or actually valid.

Emanuel 2010-01-15 09:36

Re: Why is pulseaudio crippled on the n900?
 
I was able to get TCP-streaming to work in the scratchbox, though I've yet to try on the device itself.

It seems that on my computer, pulse audio 0.9.15 is unable to stream to newer versions of itself. On Ubuntu, I have 0.9.19, so I compiled that version inside of scratchbox, set it up, and then everything worked like a charm.

Hopefully this helps someone. :-)

javispedro 2010-01-26 01:12

Re: Why is pulseaudio crippled on the n900?
 
Well, tcp streaming works.

N900:
Code:

load-module module-native-protocol-tcp auth-anonymous=1 port=6000 listen=192.168.1.5
Desktop (Debian Lenny, 0.9.10 PA client library):
Code:

export PULSE_SERVER=192.168.1.5:6000
mplayer -ao pulse Moby-In_My_Heart.mp3

N900:
(incredibly loud* piano)

Anything else? :)


* EDIT: WARNING This seems to bypass the volume control, so don't use headphones to try. media.role is "x-maemo" so I don't know why it bypasses system volume. mplayer's own volume control (which actually sets PulseAudio's stream properties) works.

Laughing Man 2010-01-26 01:20

Re: Why is pulseaudio crippled on the n900?
 
Test it the other way around? Then test what we can do (for example, what happens when someone calls you).

What about the FM Transmitter. Can you do that + use the FM transmitter?

javispedro 2010-01-26 01:28

Re: Why is pulseaudio crippled on the n900?
 
Quote:

Originally Posted by Laughing Man (Post 494751)
Test it the other way around? Then test what we can do (for example, what happens when someone calls you).

I don't know how to redirect running applications, but I am pretty sure redirecting started applications works

N900:
Code:

export PULSE_SERVER=192.168.1.3
drnoksnes test.smc

Gets me some cheesy tunes on the PC.

EDIT: module-rtp-recv & module-rtp-send work; with them I can hear both the fmradio, media player AND phone calls, but audio is very choppy.

javispedro 2010-01-26 01:35

Re: Why is pulseaudio crippled on the n900?
 
I am not able to redirect fmradio; a connection is made to my server but all I get is silence and n900-fmrx-enabler using 100% CPU.

Pycage might be able to explain that though.

EDIT Ah, I see that FMRadio opens two streams on my server. I guess it's just feed backing whatever is recorded in hw:0 to hw:0 , and thus is just replaying my own sounds back to me. This explains the high CPU+network usage. Actually, if it were to record from hw:1 it would find my desktop's fm tuner there :)

Pretoriano 2010-02-06 10:46

Re: Why is pulseaudio crippled on the n900?
 
Quote:

Originally Posted by javispedro (Post 494741)
Well, tcp streaming works.

N900:
Code:

load-module module-native-protocol-tcp auth-anonymous=1 port=6000 listen=192.168.1.5
Desktop (Debian Lenny, 0.9.10 PA client library):
Code:

export PULSE_SERVER=192.168.1.5:6000
mplayer -ao pulse Moby-In_My_Heart.mp3

N900:
(incredibly loud* piano)

Anything else? :)


* EDIT: WARNING This seems to bypass the volume control, so don't use headphones to try. media.role is "x-maemo" so I don't know why it bypasses system volume. mplayer's own volume control (which actually sets PulseAudio's stream properties) works.

I've not the "load-module" command

javispedro 2010-02-06 16:58

Re: Why is pulseaudio crippled on the n900?
 
Quote:

Originally Posted by Pretoriano (Post 512961)
I've not the "load-module" command

It is not a binary in PATH, but a pulseaudio CLI command. I find that the easiest way to get access to it is to just kill pulseaudio ("stop pulseaudio") then restart it with "pulseaudio -C" (after installing the extra modules, of course).

qole 2010-02-06 18:31

Re: Why is pulseaudio crippled on the n900?
 
I am trying to use javispedro's technique to connect pulseaudio clients in the chroot to the Maemo pulseaudio server.

Some stuff I'm seeing:
- The /usr/bin/pulseaudio binary is marked as executable for root only, yet executing it as root generates all sorts of warnings. How should I be doing this?
- I replaced the tcp module line in the /etc/pulse/default.pa file with javispedro's line (using 127.0.0.1 as the IP address, keeping port 6000), rebooted, and then tried the "export PULSE_SERVER=127.0.0.1:6000" line in the chroot. Still getting "connection refused" from the clients...

EDIT: I needed to install the extra modules. Now I'm getting a different error in the chroot, "connection terminated".

rdwrig0ceo 2010-02-06 18:56

Re: Why is pulseaudio crippled on the n900?
 
off topic but question is there a way to use camera buttons to control audio when phone is locked. Example playing music without headphones and screen goes black. 2 minutes go by and you quickly wanted to turn down the volume for whatever reason. Is this possible? Thanks in advance.

qole 2010-02-06 19:19

Re: Why is pulseaudio crippled on the n900?
 
Interesting.

I tried the interactive method suggested by javispedro:
- gain root
Code:

stop pulseaudio
pulseaudio --system --high-priority -C
load-module module-native-protocol-tcp auth-anonymous=1 port=6000 listen=127.0.0.1

and now I can see the error messages when my chroot client tries to connect:

Code:

E: client-ext.c: client-ext.c: Can't obtain command line
E: protocol-native.c: protocol error, kicking client

So what's the protocol error? Something incompatible between Maemo version of PA and the one I have installed in my chroot (purposely installed only 0.9.10 from lenny, should I try 0.9.21 from squeeze)?

EDIT: can confirm that it happens with 0.9.21 as well.

javispedro 2010-02-06 23:29

Re: Why is pulseaudio crippled on the n900?
 
Quote:

Originally Posted by qole (Post 513375)
- The /usr/bin/pulseaudio binary is marked as executable for root only, yet executing it as root generates all sorts of warnings. How should I be doing this?

I get a load of warnings too -- I wouldn't exactly call the pulseaudio daemon "quiet". It generates loads of warnings on my desktop too.
Quote:

Originally Posted by qole (Post 513375)
- I replaced the tcp module line in the /etc/pulse/default.pa file with javispedro's line (using 127.0.0.1 as the IP address, keeping port 6000), rebooted, and then tried the "export PULSE_SERVER=127.0.0.1:6000" line in the chroot. Still getting "connection refused" from the clients...

Can't you get to the CLI? Just boot it with "pulseaudio -C" and press intro a few times (so that it echoes the prompt). It may help you see why connections are being rejected. Also see if all parameters (including auth_anonymous=1) were parsed.


EDIT (sorry, missed a post).

So, did you try copying the maemo PA client libraries to the chroot? Though lenny amd64's are working here. :P

qole 2010-02-07 22:20

Re: Why is pulseaudio crippled on the n900?
 
OK, very interesting news. I noticed that I was actually using the squeeze version of pulseaudio in the chroot, version 0.9.21 instead of 0.9.10.

So I started with a fresh image (no pulseaudio installed) and disabled all the squeeze and sid repositories, and then installed the lenny version (0.9.10) of pulseaudio. I then closed the chroot and reopened it (so that /var/run/pulse would get mounted from Maemo correctly) and set the PULSE_SERVER variable like so:

Code:

PULSE_SERVER=unix:/var/run/pulse/native
(I stole the syntax from my Ubuntu box) and then I ran "paman".

Woot! Pulseaudio in the chroot connects to Maemo! I can see all of the devices and server information! A quick test of

Code:

mplayer -ao pulse musicfile.mp3
works as expected! Volume levels are correct and everything!

So the secret is to use version 0.9.10 not 0.9.21 because something gets broken in the protocol between 0.9.15 (Maemo version) and 0.9.21 (Debian Squeeze version)...

aechelon 2010-02-12 06:45

Re: Why is pulseaudio crippled on the n900?
 
Hi qole,

Does the latest image include pulseaudio 0.9.10? If not, will it be included in the next image?

If I already have the squeeze version installed, is there an easy way to back out to 0.9.10?

Keep up the good work!

opax 2010-10-30 17:05

Re: Why is pulseaudio crippled on the n900?
 
is there a way to change the server of pulseaudio?

In Ubuntu thanks to papref It's really easy:but a i cant find how to do it in command line!

If we find this it ll be so easy to stream the desktop to the phone!

fuminori 2011-01-03 18:40

Re: Why is pulseaudio crippled on the n900?
 
It looks as though pr1.5 is using pulseaudio 0.9.15 which is still unable to communicate with 0.9.21.

0.9.15 is in lenny-backports so I'll see if I can get sound out of the chroot when I have time.

I don't know if it is interesting but I tried installing mpd in the chroot and could get sound out by selecting alsa output on hw:0,0 but there was no way for me to control the volume through mpd or maemo.

mr id 2011-01-03 18:56

Re: Why is pulseaudio crippled on the n900?
 
Quote:

Originally Posted by fuminori (Post 910807)
I don't know if it is interesting but I tried installing mpd in the chroot and could get sound out by selecting alsa output on hw:0,0 but there was no way for me to control the volume through mpd or maemo.

Apologies if this is just noise but is this link of any interest to you - alsa / mpd volume related?
http://mpd.wikia.com/wiki/Alsa

I found it earlier as I was looking for something else alsa volume related. I've been playing with gstreamer and the alsa plugins in maemo and suffering from from very low volume on the hw devices :(

rajil.s 2011-01-03 19:47

Re: Why is pulseaudio crippled on the n900?
 
Please excuse me if the following question doesnt make sense.

Is it possible to setup PA so that mediaplayer/mplayer streams audio via head-phone jack, but the Phone app sends audio out over bluetooth.

The usecase is for an N900 connected to a Sat Nav (like TomTom) via bluetooth.With the above scenario all the phone calls will be routed to the SatNav, however all the music will be played through 3.5mm jack connected to the car stereo.

Bananusm 2011-03-13 00:50

Re: Why is pulseaudio crippled on the n900?
 
i've found a better way to get to pulseaudio cli.

First edit /etc/pulse/system.pa

add a following line at the end:

load-module module-cli-protocol-unix socket=/tmp/pulsecli

and restart pulseaudio (or phone).
That will create /tmp/pulsecli linux socket

you can connect to it using socat:

socat stdin /tmp/pulsecli

and you have pulseaudio cli.



There is another way (less safe) where you can open a port and telnet to it. All you have to do is to uncomment last line in the file mentioned above.

That is less safe for obvious reason, that anyone on local network can connect to this port without authentication unless you specify some iptables rules.

leetnoob 2011-03-13 05:15

Re: Why is pulseaudio crippled on the n900?
 
1 Attachment(s)
pulse audio manager works consistently for me on the highest version of the easy debian pulse libraries. i have a very vague memory of it not working the first time i tried it, so i did:

sudo /etc/init.d/pulseaudio start

from within easy debian, and it seems to have worked ever since.

i ran the mplayer command qole gave above and it worked fine.

as i said, this is all with the most recent version of everything in easy debian.

edit: also i didnt need to set any environment variables within easy debian

edit: also i don't have to run that command everytime, it's like when you run it once it sorts out it's configuration and remembers it. as a result i think i've been living in blissful ignorance that others have been having easy debian audio 'issues'

TiagoTiago 2011-03-13 05:55

Re: Why is pulseaudio crippled on the n900?
 
Quote:

Originally Posted by rdwrig0ceo (Post 513399)
off topic but question is there a way to use camera buttons to control audio when phone is locked. Example playing music without headphones and screen goes black. 2 minutes go by and you quickly wanted to turn down the volume for whatever reason. Is this possible? Thanks in advance.

Some media players already let you control the volume while the screen is locked like what you describe.

thomasjfox 2012-01-11 20:34

Re: Why is pulseaudio crippled on the n900?
 
I wanted to use my second N900 as a mpd streaming client in the kitchen.

Well, I faced the same issues as described before, looks like the native pulseaudio network protocol on maemo 5 and f.e. Fedora 16 is not compatible. Luckily there's another network sound protocol: esd.

Here's how it works:

On the n900:
Code:

- Install the pulseaudio-module-extra package.
- Edit /etc/pulse/system.pa and add these lines:

.ifexists module-esound-protocol-tcp.so
    load-module module-esound-protocol-tcp port=6000 auth-cookie-enabled=0 auth-anonymous=1 sink=1
.endif

- Restart pulseaudio/phone

On the mpd side, use this in the mpd.conf file:
Code:

audio_output {
    type "ao"
    driver "esd"
    options "host=devel-n900:6000"
    name "esd"
}

More help on mpd and pulseaudio can be found here: http://mpd.wikia.com/wiki/PulseAudio

thomasjfox 2012-01-11 21:00

Re: Why is pulseaudio crippled on the n900?
 
Ok, here's an explanation of the protocol format incompatibility:
http://www.mail-archive.com/pulseaud.../msg09900.html

Proposed fix for the N900 -> remote server audio direction:
http://lists.freedesktop.org/archive...ne/010256.html

Let's see if we can "downgrade" the protocol version on the N900 in the /usr/lib/pulse-0.9.15/modules/module-native-protocol-tcp.so binary without recompilation :D

thomasjfox 2012-01-11 21:34

Re: Why is pulseaudio crippled on the n900?
 
Ok, this dirty hack does the trick on the PA "client" side:

Code:

diff -u -r -p pulseaudio-0.9.22/configure.ac pulseaudio.faked/configure.ac
--- pulseaudio-0.9.22/configure.ac      2012-01-11 22:18:40.450280472 +0100
+++ pulseaudio.faked/configure.ac      2012-01-11 22:22:37.563083482 +0100
@@ -41,7 +41,7 @@ AC_SUBST(PA_MAJORMINORMICRO, pa_major.pa
 AC_SUBST(PACKAGE_URL, [http://pulseaudio.org/])
 
 AC_SUBST(PA_API_VERSION, 12)
-AC_SUBST(PA_PROTOCOL_VERSION, 16)
+AC_SUBST(PA_PROTOCOL_VERSION, 15)
 
 # The stable ABI for client applications, for the version info x:y:z
 # always will hold y=z

Just recompile pulseaudio and it will be able to use the N900 as speaker :)

sulu 2012-01-12 10:07

Re: Why is pulseaudio crippled on the n900?
 
Quote:

Originally Posted by thomasjfox (Post 1149146)
Code:

diff -u -r -p pulseaudio-0.9.22/configure.ac pulseaudio.faked/configure.ac
--- pulseaudio-0.9.22/configure.ac      2012-01-11 22:18:40.450280472 +0100
+++ pulseaudio.faked/configure.ac      2012-01-11 22:22:37.563083482 +0100
@@ -41,7 +41,7 @@ AC_SUBST(PA_MAJORMINORMICRO, pa_major.pa
 AC_SUBST(PACKAGE_URL, [http://pulseaudio.org/])
 
 AC_SUBST(PA_API_VERSION, 12)
-AC_SUBST(PA_PROTOCOL_VERSION, 16)
+AC_SUBST(PA_PROTOCOL_VERSION, 15)
 
 # The stable ABI for client applications, for the version info x:y:z
 # always will hold y=z

Just recompile pulseaudio and it will be able to use the N900 as speaker :)

That might also help to get a true pulseaudio 0.9.21 working in a dist-upgraded Easy Debian. I once tried something similar but must have changed the protocol version in the wrong place.

warp 2012-10-18 22:13

Re: Why is pulseaudio crippled on the n900?
 
Quote:

Just recompile pulseaudio and it will be able to use the N900 as speaker.
How does one recompile pulseaudio?

pali 2012-12-02 15:34

Re: Why is pulseaudio crippled on the n900?
 
Here is merge request for cssu pulseaudio: https://gitorious.org/community-ssu/...rge_requests/1


All times are GMT. The time now is 06:54.

vBulletin® Version 3.8.8