Changes between Initial Version and Version 1 of faq/pulse-debug


Ignore:
Timestamp:
Dec 4, 2012, 2:02:32 PM (11 years ago)
Author:
Jamie McClelland
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • faq/pulse-debug

    v1 v1  
     1= Debugging Pulse Audio =
     2
     3Audio on linux can be challenging because there are many pieces involved.
     4
     5Here are some tips on testing them out one by one.
     6
     7These tips expect you to be running pulseaudio on a Debian Wheezy machine (amd64).
     8
     9== Installing packages ==
     10
     11Minimally, you should have the following pulseaduio packages installed:
     12
     13{{{
     14apt-get install libpulse-mainloop-glib0:amd64 libpulse0:amd64 pulseaudio pulseaudio-module-x11 pulseaudio-utils
     15}}}
     16
     17== pavucontrol ==
     18
     19Next, familiarize yourself with the pulseaudio VU graphical application for controlling pulseaudio levels. You can launch by typing:
     20
     21{{{
     22pavucontrol
     23}}}
     24
     25The "Configuration" tab is a good place to start. You should see a drop down menu to choose the Profile you would like to use.
     26
     27The profiles available depends on your hardware. My laptop has several analog audio stereo devices:
     28
     29 * Built-in mic
     30 * Built-in speakers
     31 * One combo speaker/mic jack
     32
     33In addition, I have an HDMI port, which is a one-way port (it can send out audio, but cannot recieve audio) for digital audio.
     34
     35So, I have a long list of profiles that allow me to mix and match between my various input and output options.
     36
     37Since 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."
     38
     39Note: when I plug in headphones, the built-in speaker and mic automatically turns off. Not sure where or how this works...
     40
     41For this tutorial, I'm assuming you have chosen the "Analog Stereo Duplex" profile.
     42
     43== Testing output ==
     44
     45Next, 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."
     46
     47I can manually adjust the Front Left/Front Right volume controls. And, I can see a VU meter (that is blank when nothing is playing).
     48
     49Before testing with complex audio applications, ensure you can hear sound via the simple paplay command line tool.
     50
     51Find 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).
     52
     53Try playing that sound from the command line:
     54
     55{{{
     56paplay /usr/share/sounds/gnome/default/alerts/sonar.ogg
     57}}}
     58
     59You should see the VU meter react and hear the sound.
     60
     61If 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.
     62
     63Remember - 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.
     64
     65== Testing Input ==
     66
     67Next, 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."
     68
     69I 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.
     70
     71If 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.
     72
     73Assuming everything works up to now... try recording a sound and playing it back:
     74
     75{{{
     76parec test.wav
     77}}}
     78
     79Say a few words, then hit ctl-c to cancel.
     80
     81Then, play it back with:
     82
     83{{{
     84pacat test.wav
     85}}}
     86
     87If you can hear what you said - congratulations - you have your base pulseaudio system working.
     88
     89== More debugging ==
     90
     91Most 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.
     92
     93pulseaudio 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
     94
     95Applications that need pulseaudio will start and run pulseaudio as your user. On my machine:
     96
     97{{{
     980 jamie@animal:~$ ps -eFH | egrep [p]ulseaudio
     99jamie    20576     1  0 79777  8496   1 Nov25 ?        00:29:23   /usr/bin/pulseaudio --start --log-target=syslog
     1000 jamie@animal:~$
     101}}}
     102
     103You 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.
     104
     105pulseaudio has many options, which you can get a sense of from reading the files in /etc/pulse.
     106
     107If 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.
     108
     109pulseaudio comes with some additional command line utilities which can be used for further debugging.
     110
     111`pactl` allows you to query the running pulseaudio daemon.
     112
     113For basic information about the running daemon:
     114
     115{{{
     1160  jamie@animal:~$ pactl info
     117Server String: /tmp/pulse-jL9Rjit86brT/native
     118Library Protocol Version: 26
     119Server Protocol Version: 26
     120Is Local: yes
     121Client Index: 92
     122Tile Size: 65472
     123User Name: jamie
     124Host Name: animal
     125Server Name: pulseaudio
     126Server Version: 2.0
     127Default Sample Specification: s16le 2ch 44100Hz
     128Default Channel Map: front-left,front-right
     129Default Sink: alsa_output.pci-0000_00_1b.0.analog-stereo
     130Default Source: alsa_input.pci-0000_00_1b.0.analog-stereo
     131Cookie: 1759:ceb7
     1320 jamie@animal:~$
     133}}}
     134
     135Note that pulseaudio refers to "Sink" when referring to what we would usually think of as an output device and "Source" for input devices.
     136
     137Another way of querying and controlling the running daemon is with the `pacmd` tool.
     138
     139If you type `pacmd` into your terminal you will be dropped into a shell. Type `help` to see a list of commands you can run.
     140
     141