PulseAudio: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Initial import: Pulseaudio (a networked sound server) on the XO)
 
(Some small fixes)
Line 1: Line 1:
== pulseaudio on the XO ==
== Pulseaudio on the XO ==
- XO version: B1
- XO version: B1
- Build: 406
- Build: 406
Line 72: Line 72:


and you need to install the alsa-plugins. I could not find an rpm for Fedora that is why I build and installed the plugins by hand. You can find the sources here: ftp://ftp.alsa-project.org/pub/plugins/ To test the result I used aplay with the following option.
and you need to install the alsa-plugins. I could not find an rpm for Fedora that is why I build and installed the plugins by hand. You can find the sources here: [ftp://ftp.alsa-project.org/pub/plugins/ alsa-plugins]
To test the result I used aplay.
aplay -Dpulse soundfile.wav
aplay -Dpulse soundfile.wav



Revision as of 18:23, 6 July 2007

Pulseaudio on the XO

- XO version: B1
- Build: 406
- pulseaudio version: 0.9
- more info: pulseaudio

Install

Basic

These are the basic packages you need to install to run pulseaudio on the XO. The zeroconf module is needed if you want to enable networking of the sound server. zeroconf is used to announce the sound servers on the network.

 pulseaudio pulseaudio-lib-zeroconf pulseaudio-module-zeroconf
 deps: pulseaudio-lib libsamplerate

Extra packages

The utile package contains tools like a soundfile player which is a native pulseaudio client.

 pulseaudio-utils

To configure pulseaudio you may want to install these X tools. You will need them to setup the networking part.

 padevchooser pavucontrol pavumeter panam


Configuration

To run pulseaudio with a higher priority you have to add yourself to the group pulse-rt (you may have to log out before these changes take effect).

/usr/bin/usermod -a -G pulse-rt olpc

You can start pulseaudio with the high priority option to prevent clicks when doing UI stuff

pulseaudio --high-priority=1

You will see the following output when pulseaudio succesfully gained the priority.

      I: core-util.c: Successfully gained nice level -15.                                                   
      I: core-util.c: Successfully enabled SCHED_FIFO scheduling.                                                  
                                                                                                   

Tests

Start pulseaudio

pulseaudio -v
pulseaudio --high-priority=1 -v

Native pulseaudio client

In the first test we use a native pulseaudio client to play a sound (paplay is included in pulseaudio-utils)

paplay soundfile.wav

Some numbers:

- top shows a cpu usage of pa of ~2.6 and a memory usage of ~1.2 when not in use
- when playing a soundfile with paplay cpu usage is 7-10 and memory usage 1.7

Gstreamer Applications

Applications using the GStreamer media framework can make use of the PulseAudio through gst-pulse, our PulseAudio plugin for GStreamer. We used the python gstreamer bindings to play a soundfile on the pulseaudio server.

ALSA Applications

To setup pulseaudio to work for alsa applications you have to put these lines into /etc/asound.conf.

   # This following device can fool some applications into using pulseaudio                                 
   pcm.dsp2 {                                                                                               
   type plug                                                                                                
   slave.pcm "pulse"                                                                                        
   }                                                                                                        
                                                                                                            
   pcm.pulse {                                                                                              
   type pulse                                                                                               
   }                                                                                                        
                                                                                                            
   ctl.pulse {                                                                                              
   type pulse                                                                                               
   }                                                                                                        
                                                                                                            
   pcm.!default {                                                                                           
   type pulse                                                                                               
   }                                                                                                        
                                                                                                            
   ctl.!default {                                                                                           
   type pulse                                                                                               
   }                                                                                                        
   

and you need to install the alsa-plugins. I could not find an rpm for Fedora that is why I build and installed the plugins by hand. You can find the sources here: alsa-plugins To test the result I used aplay.

aplay -Dpulse soundfile.wav

Csound

You can run csound as a pulseaudio client as well. To make this work on the XO you have to use big enough buffer sizes (-b -B options).

csound -+rtaudio=alsa -odac:plug:pulse -m0 -d -b1024 -B4096 bilbar.csd