[pulseaudio-discuss] Help wanted for porting Skype to use PulseAudio

2008-02-01 Thread Tanu Kaskinen
Happened tonight on #pulseaudio:

00:41 < Q-FUNK> guys, it appears that Skype might be willing
to become good audiozens and stop accessing 
ALSA directly.  
00:41 < Q-FUNK> however, they would need help to understand
what's required for stripping ALSA and OSS 
support out of Skype and replacing it with
native PulseAudio support.
00:41 < Q-FUNK> any volunteer I could put them in touch with?



01:30 < Q-FUNK> well, anyhow, if anybody is willing to post
the above to the list on my behalf, I can 
put whoever is willing to explain to them
how it's done in touch with my insider.
01:31 < Q-FUNK> there was initial resistance, followed by
attempts to dodge the issue by pointing me
to various workarounds, and only now,
tonight, admittance that porting to PA might
be the way to go.
01:32 < Q-FUNK> we need to follow-up now, while they're
still convinced that it's worth doing.


Interested people should contact Martin-Éric Racine. Irc is
preferred, he's always on Freenode and IRCnet with nick
Q-FUNK.

-- 
Tanu Kaskinen
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Help in setting up PA

2008-02-01 Thread Tanu Kaskinen
On Fri, Feb 01, 2008 at 03:02:40PM -0500, Richard Geddes wrote:
> You are correct... latest release Ubuntu 7.10 comes with PA 0.9.6.  
> I'll look into getting the latest version of PA.
> 
> My goal was to use PA as a replacement for esound server...  I'd like to
> be able to record/mix different sound sources (midi, analog, sound from
> files (mp3, wav, ogg, etc)) and be able to create different file
> formats, including sound delivered in flash (I'm not a fan of flash as
> it consumes alot of cpu time, but it is in demand).  I played with jackd
> for a while and was impressed with it's technical capabilities, but
> unfortunately, I haven't found a way to play flash sound through
> jackd... that is, flash in firefox.  I found a how-to in the Ubuntu
> forum that seemed to patch together a solution the involved PA:
> 
> http://ubuntu-utah.ubuntuforums.org/showthread.php?t=548178

If you want to record midi and do other "pro-audio" stuff,
then jack is the way to go. If you also want to do "desktop"
stuff (like have every media player just work), then the
best solution in my experience is to run pulseaudio on top
of jack (like instructed in that link).

A summary of what you'll have to do at minimum:
- Get pulseaudio version >= 0.9.7
- Remove device loading from /etc/pulse/default.pa and add
  the jack modules instead
- Edit /etc/security/limits.conf as instructed in the link
- Edit /etc/pulse/daemon.conf to enable realtime scheduling
- Run jackd with -R parameter (i.e. in realtime mode)
- Other stuff that I have forgot ;)

If you are going to record midi, that probably means that
you have some midi instrument that you want to be able to
play live. That requires quite low latency. That's
completely possible to achieve. Unfortunately it may require
extensive tuning (mostly kernel, but you may need to tweak
irq priorities as well). Vanilla kernels are AFAIK getting
better and better regarding latency, so first try with your
current kernel. The actual latency is controlled by jackd
parameters -n and -p (read man jackd). If your kernel isn't
able to provide low enough latency, you'll get drop-outs and
xruns (the former being the audible consequence of the
latter).

If you have problems with setting pulseaudio to work in
combination with jack, or anything else pulseaudio related,
then feel free to ask further questions.

If it turns out that your system needs latency-tuning, here
are a few kernel options you could try without compiling an
-rt patched kernel:
CONFIG_NO_HZ=y
CONFIG_HZ_1000=y
CONFIG_HZ=1000
CONFIG_HIGH_RES_TIMERS=y (AFAIK this requires a rather recent kernel)

There may be others that I'm not aware of. These are
beneficial to pulseaudio regardless of what kind of setup
you need (jack or not).

If you end up needing a patched kernel, here's the wiki of
the patchset: http://rt.wiki.kernel.org/index.php/Main_Page

If you have further questions about latency stuff, I
recommend searching the [EMAIL PROTECTED] list
archives, and if that doesn't help, then send questions
there. That's a very good list to subscribe to anyway, if
you're going to do any audio work on Linux.

And then a note on flash. Flash requires a thing called
libflashsupport due to Adobe's plugin's bugginess. AFAIK it
will be packaged eventually, but currently you have to
compile it yourself. The link you gave refers to an outdated
version of the "thing". More recent information is available
at http://www.pulseaudio.org/wiki/PerfectSetup#FlashPlayer9.
In short: get the one that's hosted at git.0pointer.de, not
the revolutionlinux one.

An alternative to the flash plugin is http://keepvid.com,
which allows you to download the .flv files in Youtube and
several other supported services. Then just play the file on
your favourite media player. Keepvid.com is enough for me,
but YMMV. Note the white button saying "Drag this button..."
etc. It talks about a "links toolbar" but bookmarking the
script does the same thing.

> Question:   PA, esound, jackd, etc.. are all called sound servers,
> implying that you can replace one with another... like apache vs iis

I'd say that being a sound server implies only that the
server is somehow capable of software mixing.

> is the main difference that they use different client/server
> communication protocols?

The main difference of pulseaudio and jack is their
different designs and goals. Maybe the communication
protocols somehow reflect that, I don't know. Esound's
distinctive feature is being dead, I don't know much else
about that thing.

-- 
Tanu Kaskinen
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Help in setting up PA

2008-02-01 Thread Richard Geddes
You are correct... latest release Ubuntu 7.10 comes with PA 0.9.6.  
I'll look into getting the latest version of PA.

My goal was to use PA as a replacement for esound server...  I'd like to
be able to record/mix different sound sources (midi, analog, sound from
files (mp3, wav, ogg, etc)) and be able to create different file
formats, including sound delivered in flash (I'm not a fan of flash as
it consumes alot of cpu time, but it is in demand).  I played with jackd
for a while and was impressed with it's technical capabilities, but
unfortunately, I haven't found a way to play flash sound through
jackd... that is, flash in firefox.  I found a how-to in the Ubuntu
forum that seemed to patch together a solution the involved PA:

http://ubuntu-utah.ubuntuforums.org/showthread.php?t=548178


and have run into configuration/version issues since.

Question:   PA, esound, jackd, etc.. are all called sound servers,
implying that you can replace one with another... like apache vs iis
is the main difference that they use different client/server
communication protocols?  So, the competition among the sound servers is
really over the communication protocol... and it looks like sound
performance/features is affected by the communication protocol.



Tanu Kaskinen wrote:
> On Thu, Jan 31, 2008 at 08:52:32PM -0500, Richard Geddes wrote:
>   
>> The PA daemon is not starting and PA Manager is say "connection refused"
>> .  Not sure what to make of it, but your suggestions are welcome.
>> 
>
> "Connection refused" is the message you get when trying to
> use a pulse client program without having the daemon
> running.
>
>   
>> Here's some output from /var/log/messages:
>>
>> 
>>> pulseaudio[7278]: main.c: Module load failed.
>>> pulseaudio[7278]: main.c: failed to initialize daemon.
>>> pulseaudio[7288]: pid.c: daemon already running.
>>> pulseaudio[7288]: main.c: pa_pid_file_create() failed.
>>> pulseaudio[7291]: pid.c: daemon already running.
>>> pulseaudio[7291]: main.c: pa_pid_file_create() failed.
>>> pulseaudio[7285]: module-alsa-sink.c: Failed to set hardware
>>> parameters: Operation not permitted
>>> pulseaudio[7285]: module.c: Failed to load  module "module-alsa-sink"
>>> (argument: "sink_name=delta_out device=hw:0 channels=10
>>> channel_map=left,right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7"):
>>> initialization failed.
>>> pulseaudio[7285]: main.c: Module load failed.
>>> pulseaudio[7285]: main.c: failed to initialize daemon.
>>> pulseaudio[7294]: module-alsa-sink.c: Failed to set hardware
>>> parameters: Operation not permitted
>>> pulseaudio[7294]: module.c: Failed to load  module "module-alsa-sink"
>>> (argument: "sink_name=delta_out device=hw:0 channels=10
>>> channel_map=left,right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7"):
>>> initialization failed.
>>> pulseaudio[7294]: main.c: Module load failed.
>>> pulseaudio[7294]: main.c: failed to initialize daemon.
>>>   
>
> The "Failed to set hardware parameters: Operation not
> permitted" is an encrypted message, and means that
> pulseaudio couldn't open the device for 16-bit samples,
> because the device only supports 32-bit samples. You seem to
> have an older version of pulseaudio. Since 0.9.8 pulseaudio
> has supported 32-bit samples, so you'll have to upgrade to
> at least that version.
>
> An unrelated note: you seem to have made the decision to run
> pulseaudio as a system-wide daemon. That is not generally
> recommended way to run pulseaudio, it's only for the cases
> when the per-user way just doesn't cut it. This isn't a
> fatal mistake (if it's mistake at all, I don't know what
> kind of setup you actually have/need), and you don't
> necessarily need to fix it. Some information on this matter:
> http://www.pulseaudio.org/wiki/SystemWideInstance
>
>   
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] pulseaudio automatic startup

2008-02-01 Thread Jim Duda
I'm using pulseaudio 0.9.6, on Fedora 7 installed via yum.
I'm current having to start pulseaudio -D manually.

Three Questions:
1) Should pulseaudio startup automatically somehow when someone logs into X?
If so, how does this work?  I've read all the docs, etc, but haven't found my 
answer.

2) I need to run pulseaudio on some diskless server machines which don't run X 
or have anyone login.
As such, I need to run pulseaudio as either a system daemon or some phantom 
user.
Is there a recommended approach to starting pulseaudio on a X-less machine, 
i.e., rc script?

3) I've read in a couple of posts that pulseaudio can be used with an spdif 
output.  Did that support
start with some version after 0.9.6?

Thanks,

Jim 



___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Atomic operations on ARM

2008-02-01 Thread Jyri Sarha

Hi,

I have written inline assembler implementations of pa_atomic
operations for arm for ARM6 and above. For compatibility with older
ARMs I have also written versions using ARM-Linux kernel helper
functions (see http://0pointer.de/blog#atomic-rt). 

The both implementations run almost perfectly now. However there is a
thing to note about compare and exchange implementations for 
ARM6 and above. The semantics of the usual ARM ldrex-strexeq instruction 
sequence is not identical to x86 implementations of the same thing, e.g.
the exchange is not totally atomic after all.

The strexeq-instruction has two conditions the equality to the old value 
and the exclusiveness of the operation (e.g. if the value in memory was 
tampered between the operations). The operation fails if either of
these conditions fail, e.g. the value in memory is unchanged. So it is 
possible that the old-value-condition is met, but the exclusiveness- 
condition fails, but even the tampered memory value would meet the 
old-value-condition.

The above applies also to kernel helper implementation of atomic exchange 
for ARM6 and above.

Because of the above problem (I suspect) this assertion in pulsecore/async.c 
fails sometimes under heavy load:
/* Guaranteed to succeed if we only have a single reader */
pa_assert_se(pa_atomic_ptr_cmpxchg(&cells[idx], ret, NULL));

The assertion failure has happened with the both kernel helper and inline asm 
versions (they are identical in ARM6 environment anyway). The failures
are not very common thou.


The atomic compare and exchange can also be written in a way that it retries
the operation if the exclusiveness-condition fails but the equality-condition
was ok, which would resemble real atomicity more. The inline assembler version
would then look like this:

static inline int pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
unsigned long not_equal, not_exclusive;

pa_memory_barrier();
do {
__asm__ __volatile__("@ pa_atomic_cmpxchg\n"
 "1: ldrex  %0, [%2]\n"
 "   subs   %0, %0, %3\n"
 "   mov%1, %0\n"
 "   strexeq %0, %4, [%2]\n"
 : "=&r" (not_exclusive), "=&r" (not_equal)
 : "r" (&a->value), "Ir" (old_i), "r" (new_i)
 : "cc");
} while(not_exclusive && !not_equal);
pa_memory_barrier();

return !not_equal;
}

A similar kind of external loop can also be added to kernel helper
function, but if the kernel helper in fact makes a systemcall it is
unnecessary. I wonder if all this is worth the trouble. 

So what should be done?

1. Change the above line in pulsecore/async.c to use pa_atomic_store
instead and try to look if there are other similar places.

2. Write loops like above to ARM specific implementations atomic
compare and exchange.

Any way I'll produce a proper ARM atomic ops patch as soon as I am happy 
with it. However it may take a while because I am still only learning
the autoconf magic and I have some other tasks I should take care of too.

Cheers,
   Jyri

// Jyri Sarha -- [EMAIL PROTECTED]
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Atomic operations on ARM

2008-02-01 Thread Colin Guthrie
Jyri Sarha wrote:
> Any way I'll produce a proper ARM atomic ops patch as soon as I am happy 
> with it. However it may take a while because I am still only learning
> the autoconf magic and I have some other tasks I should take care of too.

This is really cool. I know a lot of people will like this progress you
are making :)

Col

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Help in setting up PA

2008-02-01 Thread Tanu Kaskinen
On Thu, Jan 31, 2008 at 08:52:32PM -0500, Richard Geddes wrote:
> The PA daemon is not starting and PA Manager is say "connection refused"
> .  Not sure what to make of it, but your suggestions are welcome.

"Connection refused" is the message you get when trying to
use a pulse client program without having the daemon
running.

> Here's some output from /var/log/messages:
> 
> > pulseaudio[7278]: main.c: Module load failed.
> > pulseaudio[7278]: main.c: failed to initialize daemon.
> > pulseaudio[7288]: pid.c: daemon already running.
> > pulseaudio[7288]: main.c: pa_pid_file_create() failed.
> > pulseaudio[7291]: pid.c: daemon already running.
> > pulseaudio[7291]: main.c: pa_pid_file_create() failed.
> > pulseaudio[7285]: module-alsa-sink.c: Failed to set hardware
> > parameters: Operation not permitted
> > pulseaudio[7285]: module.c: Failed to load  module "module-alsa-sink"
> > (argument: "sink_name=delta_out device=hw:0 channels=10
> > channel_map=left,right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7"):
> > initialization failed.
> > pulseaudio[7285]: main.c: Module load failed.
> > pulseaudio[7285]: main.c: failed to initialize daemon.
> > pulseaudio[7294]: module-alsa-sink.c: Failed to set hardware
> > parameters: Operation not permitted
> > pulseaudio[7294]: module.c: Failed to load  module "module-alsa-sink"
> > (argument: "sink_name=delta_out device=hw:0 channels=10
> > channel_map=left,right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7"):
> > initialization failed.
> > pulseaudio[7294]: main.c: Module load failed.
> > pulseaudio[7294]: main.c: failed to initialize daemon.

The "Failed to set hardware parameters: Operation not
permitted" is an encrypted message, and means that
pulseaudio couldn't open the device for 16-bit samples,
because the device only supports 32-bit samples. You seem to
have an older version of pulseaudio. Since 0.9.8 pulseaudio
has supported 32-bit samples, so you'll have to upgrade to
at least that version.

An unrelated note: you seem to have made the decision to run
pulseaudio as a system-wide daemon. That is not generally
recommended way to run pulseaudio, it's only for the cases
when the per-user way just doesn't cut it. This isn't a
fatal mistake (if it's mistake at all, I don't know what
kind of setup you actually have/need), and you don't
necessarily need to fix it. Some information on this matter:
http://www.pulseaudio.org/wiki/SystemWideInstance

-- 
Tanu Kaskinen
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss