= Debugging Pulse Audio = Audio on linux can be challenging because there are many pieces involved. Here are some tips on testing them out one by one. These tips expect you to be running pulseaudio on a Debian Wheezy machine (amd64). == Installing packages == Minimally, you should have the following pulseaduio packages installed: {{{ apt-get install pavucontrol libpulse-mainloop-glib0:amd64 libpulse0:amd64 pulseaudio pulseaudio-module-x11 pulseaudio-utils }}} == pavucontrol == Next, familiarize yourself with the pulseaudio VU graphical application for controlling pulseaudio levels. You can launch by typing: {{{ pavucontrol }}} The "Configuration" tab is a good place to start. You should see a drop down menu to choose the Profile you would like to use. The profiles available depends on your hardware. My laptop has several analog audio stereo devices: * Built-in mic * Built-in speakers * One combo speaker/mic jack In addition, I have an HDMI port, which is a one-way port (it can send out audio, but cannot recieve audio) for digital audio. So, I have a long list of profiles that allow me to mix and match between my various input and output options. Since I only use my built-in mic and speakers and my analog mini mic/speaker combo jack on my laptop (I've never plugged anything into my HDMI jack), the profile that works for me is called "Analog Stereo Duplex." Note: when I plug in headphones, the built-in speaker and mic automatically turns off. Not sure where or how this works... For this tutorial, I'm assuming you have chosen the "Analog Stereo Duplex" profile. == Testing output == Next, click on the "Output Devices" tab. From the "Show" drop down, select "All Output devices." When I do this, I see a Port drop down that lists one option called "Analog Output." I can manually adjust the Front Left/Front Right volume controls. And, I can see a VU meter (that is blank when nothing is playing). Before testing with complex audio applications, ensure you can hear sound via the simple paplay command line tool. Find a sound file on your computer (if you don't know where to look, try /usr/share/sounds - if you dig deep enough, you should find a .wav or .ogg file). Try playing that sound from the command line: {{{ paplay /usr/share/sounds/gnome/default/alerts/sonar.ogg }}} You should see the VU meter react and hear the sound. If you don't hear anything, you'll need to fix this problem before moving on. Try unplugging your computer speakers/head phone to test the built-in speakers. Or, try a different headphone set. Remember - if you have a hardware problem it's much easier to debug using these simple tips than to get bogged down in trouble shooting a complex audio program or running around in circles installing different programs to see if they will work better. == Testing Input == Next, click on the "Input Devices" tab. From the "Show" drop down, select "All Except Monitors." When I do this, I see a Port drop down that lists one option called "Analog input." I can manually adjust the Front Left/Front Right volume controls. And, I can see a VU meter that is active as I watch it. Try tapping your mic or speaking and you should see it move. If you don't see it move - debug before moving on to more complex steps. Try plugging in a mic (or a different mic). You might try unplugging your mic and testing your built-in mic. Assuming everything works up to now... try recording a sound and playing it back: {{{ parec test.wav }}} Say a few words, then hit ctl-c to cancel. Then, play it back with: {{{ pacat test.wav }}} If you can hear what you said - congratulations - you have your base pulseaudio system working. == More debugging == Most applications on wheezy that I've tried, support pulseaudio, but you may need to configure them to use it. Search the configuration screens of your application to ensure they are properly set to use pulseaudio. pulseaudio runs as a daemon - but it is not recommended to start it as system startup. Your /etc/default/pulseaudio file should contain: PULSEAUDIO_SYSTEM_START=0 Applications that need pulseaudio will start and run pulseaudio as your user. On my machine: {{{ 0 jamie@animal:~$ ps -eFH | egrep [p]ulseaudio jamie 20576 1 0 79777 8496 1 Nov25 ? 00:29:23 /usr/bin/pulseaudio --start --log-target=syslog 0 jamie@animal:~$ }}} You can always kill the daemon and it will restart on it's own. If you see more than one daemon running you may have problems and should try killing them all to see if that helps. pulseaudio has many options, which you can get a sense of from reading the files in /etc/pulse. If you want to customize them, you should not mess with system.conf (only needed if you run pulseaudio system-wide). daemon.conf and defualt.pa seem to both apply to the daemon. I've modified my daemon by copying /etc/pulse/default.pa to ~/.pulse/default.pa and editing it. You can do the same with /etc/pulse/client.conf to change the behavior of clients that connect to the daemon. pulseaudio comes with some additional command line utilities which can be used for further debugging. `pactl` allows you to query the running pulseaudio daemon. For basic information about the running daemon: {{{ 0 jamie@animal:~$ pactl info Server String: /tmp/pulse-jL9Rjit86brT/native Library Protocol Version: 26 Server Protocol Version: 26 Is Local: yes Client Index: 92 Tile Size: 65472 User Name: jamie Host Name: animal Server Name: pulseaudio Server Version: 2.0 Default Sample Specification: s16le 2ch 44100Hz Default Channel Map: front-left,front-right Default Sink: alsa_output.pci-0000_00_1b.0.analog-stereo Default Source: alsa_input.pci-0000_00_1b.0.analog-stereo Cookie: 1759:ceb7 0 jamie@animal:~$ }}} Note that pulseaudio refers to "Sink" when referring to what we would usually think of as an output device and "Source" for input devices. Another way of querying and controlling the running daemon is with the `pacmd` tool. If you type `pacmd` into your terminal you will be dropped into a shell. Type `help` to see a list of commands you can run.