Linux sound HOWTO for Pulseaudio users
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
DISCLAIMER
Try at own risk as I am not an expert. In case you are interested, I am an ALSA fan
due to the fact that I have a 2 ch desktop speaker system and an average on
motherboard sound device from intel.


What is pulseaudio ( PA ) good for?
--Allows on-the-fly changing of mixer channels and sound devices
--Allows graphical = gui control of settings
--Allows some mixing capabilities without needing to learn asoundrc file stuff
--Newbies struggle with the alsamixer command

----However, with so many controls, it is easier to bork your sound.
----And not all things can be changed by gui IMHO


Decisions on how to configure Pulseaudio
At some point you might need to decide if you need to run system wide stuff or home user stuff.

At this stage
---I prefer system wide alsa config for the alsa-base.conf
---I prefer home user pulse configs using the guis

Local user configs exist under home .pulse

HDMI users should consider using a system wide default.pa instead of a copy
in home users .pulse with a setting as in part 2.

What packages are installed
---assumes alsa packages already installed on your distro
padevchooser no longer exists so now

:: Code ::

apt-get install pulseaudio paman pavucontrol pavumeter paprefs

--which gets

gstreamer0.10-pulseaudio libasound2-plugins libgconfmm-2.6-1c2 libglademm-2.4-1c2a
libgtkmm-3.0-1 libsystemd-daemon0 libwebrtc-audio-processing-0 paman paprefs   
pavucontrol pavumeter pulseaudio pulseaudio-module-gconf pulseaudio-module-x11
pulseaudio-module-zeroconf pulseaudio-utils rtkit


Note that I use E17 which is low resource and if you use KDE or gnome etc its likely to pull down more packages.

Warning for those with modest hardware

:: Quote ::

cat /usr/share/doc/pulseaudio/README.Debian
pulseaudio for Debian

The pulseaudio executable is installed suid root. In the near future, the
current Suggests for rtkit may be promoted, as upstream developers
strongly recommend that latter approach instead.

PLEASE NOTE: PulseAudio's default configuration uses high quality sample
rate conversion that may be overly CPU intensive. If PulseAudio's CPU usage
is unacceptable on your hardware, please change the resample-method option
in /etc/pulse/daemon.conf to either src-linear or trivial. See daemon.conf
for more details.


Warning for known hardware or codec
www.freedesktop.org/wiki/Software/PulseAudio/Backends/ALSA/BrokenDrivers

Multimedia packages
You are likely to need a plugin package for your multimedia app

I use vlc so need
:: Code ::

apt-get install vlc-plugin-pulse


Then we need to tweak the settings


If you also use bluetooth, infrared etc you may also need to download the other packages such as showing here

ftp.iinet.net.au/debian/debian/pool/main/p/pulseaudio/

Home user config
Next as its gui ....add paman and pavucontrol to your desktop list, or create icons or ibar (panel icons for E17) etc

:: Code ::

ls /usr/share/applications/p* (culled results)
paman.desktop       
pavumeter.desktop         
paprefs.desktop     
pavumeter-record.desktop 
pavucontrol.desktop 


I don't need the other icons but will discuss later

Surround sound

Method 1 ...gui


Start paman either by desktop icon, run command, menu item under sound, ibar icon
or by terminal command.

As I am an intel user I initially had ch2 default output
if you want surround sound here is what I did.

Open the PA volume control icon and click on configuration tab
click on the pulldown....and if alsa was setup correctly

you get various output or output+input surround sound devices

choose one


If you can not get an option pulldown for surround sound,
likely for sound modules with mutiple model=string configs,
you need an alsa-base file as per the Alsa HOWTO.

Method 2....text file edit

copy /etc/pulse/daemon.conf to /home/yourname/.pulse
(note its dot pulse )

Edit this file based on your research, I am using just smallest changes at this stage

contents changed are these lines:
:: Quote ::

default-script-file = /home/gordon/.pulse/default.pa
alternate-sample-rate = 48000
default-sample-channels = 6


reboot and open paman to see


above image now 6 ch instead of 2 ch and frequency upped from 41400 to 48000
--There is a lot more you can change but I suggest you do it
---one change at a time and test your cpu usage and sound quality

----Part A Research your sound card as per wiki reference

:: Code ::

arecord -f dat -r 60000 -D hw:0,0 -d 5 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 60000 Hz, Stereo
Warning: rate is not accurate (requested = 60000Hz, got = 48000Hz)
         please, try the plug plugin

Note that I have an onboard cheap card so got only 48000 while YMMV
Play a file and check your CPU usage.

I run vlc and check using either htop or top
before vlc....dual core was about 3% jumped to 15% for 6 ch
or about 6% for 2 ch and modded back to 41400 Hz
YMMV

Part 2 follows

< Edited by aus9 :: Aug 31, 12, 21:46 >

Back to top
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
part 2

How do I know PA controls my home user?
As a local user run alsamixer command in a terminal


You can also check the underlying alsa settings with
:: Code ::

alsamixer -c (cardnumber)

replace (cardnumber) with 0 or 1 or whatever you need for surround sound.

Note you may need to set an index if your surround options do not appear in pavucontrol as well??



HDMI users please read

If you prefer HDMI output as the default, do not have a copy of default.pa in each
home users .pulse

edit /etc/default.pa to preset your hardware device as per
wiki.archlinux.org/index.php/PulseAudio/Examples#HDMI_output_configuration

Personal note, currently all hdmi aplay output I have seen are all hw1 as makers
set analog as card 0. And I don't have hdmi to test

Muting, volume and other changes
Most are done from the gui for pavucontrol icon

The main options are:
muting or unmuting
linking volumes across all channels or making independent
setting volume levels

Turning off PA is done through paman using the disconnect button

Multiple ways of muting or volume changes
This is why PA "may" be confusing to newbies.
Assuming PA is running correctly here are ways of muting or changing volumes


Above, config is 2 channel and we are on the playback panel
Showing application outputs
Vlc section shows a speaker MUTE icon....which mutes or unmutes
image shows mute-speaker button and is not clicked IN so its not muted
second button is for linking volume sliders and is clicked IN so links
volume sliders are set to 100%

Bottom of above image is a meter

--Moving to OUTPUT tab


Mute button is clicked In and meter is empty, so no sound
The Link button to the right has been un-clicked so I set a separate volume

Unmuting gives us the below image


Part 3 follows

< Edited by aus9 :: Aug 31, 12, 15:04 >

Back to top
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
Part 3

Webcam mic

Open pavucontrol and look at these images

You can choose your webcam mic or your sound card mic if they exist

There is more than one to configure, I show guvcview and if you look closely you will see a pulldown that shows I selected pulse

size for first image may need to scroll, but I could not resize without risking losing details.

Trivia

green bars show on screen mic volumes





References

www.freedesktop.org/wiki/Software/PulseAudio/FAQ

looking at resample and cpu usage
proaudio.tuxfamily.org/wiki/index.php?title=PulseAudio

some FAQ I am looking at
www.freedesktop.org/wiki/Software/PulseAudio/FAQ#I_have_a_surround_sound_card.2C_but_PulseAudio_uses_just_the_front_speakers.21

sounds to 2 devices at same time
www.freedesktop.org/wiki/Software/PulseAudio/FAQ#Can_I_use_PulseAudio_to_playback_music_on_two_sound_cards_simultaneously.3F

reverse speakers
www.freedesktop.org/wiki/Software/PulseAudio/FAQ#How_can_I_reverse_my_left_and_right_speaker_channels.3F

arch is good for stuff but its out-of-date for some as well

wiki.archlinux.org/index.php/PulseAudio

< Edited by aus9 :: Aug 30, 12, 1:17 >

Back to top
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
there is a ton of info available within a terminal

:: Code ::

pacmd
Welcome to PulseAudio! Use "help" for usage information.
>>> help
Available commands:
    help                      Show this help
    list-modules              List loaded modules
    list-cards                List cards
    list-sinks                List loaded sinks
    list-sources              List loaded sources
    list-clients              List loaded clients
    list-sink-inputs          List sink inputs
    list-source-outputs       List source outputs
    stat                      Show memory block statistics
    info                      Show comprehensive status
    load-module               Load a module (args: name, arguments)
    unload-module             Unload a module (args: index)
    describe-module           Describe a module (arg: name)
    set-sink-volume           Set the volume of a sink (args: index|name, volume)
    set-source-volume         Set the volume of a source (args: index|name, volume)
    set-sink-mute             Set the mute switch of a sink (args: index|name, bool)
    set-source-mute           Set the mute switch of a source (args: index|name, bool)
    set-sink-input-volume     Set the volume of a sink input (args: index, volume)
    set-source-output-volume  Set the volume of a source output (args: index, volume)
    set-sink-input-mute       Set the mute switch of a sink input (args: index, bool)
    set-source-output-mute    Set the mute switch of a source output (args: index, bool)
    set-default-sink          Set the default sink (args: index|name)
    set-default-source        Set the default source (args: index|name)
    set-card-profile          Change the profile of a card (args: index|name, profile-name)
    set-sink-port             Change the port of a sink (args: index|name, port-name)
    set-source-port           Change the port of a source (args: index|name, port-name)
    suspend-sink              Suspend sink (args: index|name, bool)
    suspend-source            Suspend source (args: index|name, bool)
    suspend                   Suspend all sinks and all sources (args: bool)
    move-sink-input           Move sink input to another sink (args: index, sink)
    move-source-output        Move source output to another source (args: index, source)
    update-sink-proplist      Update the properties of a sink (args: index|name, properties)
    update-source-proplist    Update the properties of a source (args: index|name, properties)
    update-sink-input-proplist Update the properties of a sink input (args: index, properties)
    update-source-output-proplist Update the properties of a source output (args: index, properties)
    list-samples              List all entries in the sample cache
    play-sample               Play a sample from the sample cache (args: name, sink|index)
    remove-sample             Remove a sample from the sample cache (args: name)
    load-sample               Load a sound file into the sample cache (args: name, filename)
    load-sample-lazy          Lazily load a sound file into the sample cache (args: name, filename)
    load-sample-dir-lazy      Lazily load all files in a directory into the sample cache (args: pathname)
    kill-client               Kill a client (args: index)
    kill-sink-input           Kill a sink input (args: index)
    kill-source-output        Kill a source output (args: index)
    set-log-level             Change the log level (args: numeric level)
    set-log-meta              Show source code location in log messages (args: bool)
    set-log-time              Show timestamps in log messages (args: bool)
    set-log-backtrace         Show backtrace in log messages (args: frames)
    play-file                 Play a sound file (args: filename, sink|index)
    dump                      Dump daemon configuration
    dump-volumes              Debug: Show the state of all volumes
    shared                    Debug: Show shared properties
    exit                      Terminate the daemon


you would then input the next command,
its acts like a grub command box

so eg of next command is dump not pacmd dump
Back to top
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
aus9 has moved this post from Alsa HOWTO to here for original poster GoinEasy9 about date:
Jan 18, 12, 13:04

:: Quote ::

PulseAudio did a good job with HDMI output on Fedora, but, since we don't use it on siduction, I'll have to come back to this thread once I start to install siduction on the laptops that have HDMI outputs. That probably won't be for a couple of weeks yet, but, it would be nice to have it work with alsa. Then again, I really need to experiment with PulseAudio on Sid also, I still don't know if it's up to par with what's running on Fedora. Since Lennart is on Red Hat's payroll, his applications seems to work better on the RedHat/Fedora distros.
Nice to see your still adding stuff to this thread, Thanks aus9.
_________________
Registered Linux User: 348347

Back to top
GoinEasy9
Status: Contributor
Joined: 28 Jun 2008
Posts: 84
Location: Manorville, New York
Reply Quote
Nice having all that info together. I still haven't tried it with siduction though. I mainly use PulseAudio Controls when I'm hooking up the laptop to the TV to watch movies. It's a bit cumbersome, but, it gets the job done.

What would be nice, would be, if it gave you the option of switching to the HDMI settings when it sees the HDMI connection. It already recognizes the connection, as you can see when accessing the info in the pavucontrol application. It just needs to get one feature better.
Back to top
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
howto being improved for part 1 and part 2 for hdmi users.

ahh I should read your post?

possible reads

lists.freedesktop.org/archives/pulseaudio-discuss/2012-March/013009.html

www.freedesktop.org/wiki/Software/PulseAudio/RFC/PriorityRouting

hmmm running
:: Code ::
pacmd
...then list-priorities

no such animal...we are not there yet

full output list shows above
Back to top
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
I won't edit above post but may delete and tidy up with matters resolved?

to any HDMI user

I think for hdmi users, my new howto is correct.

b) when I made the default 6 ch....in pavucontrol ...config panel
THAT selection went to the top of the pulldown choices. I suspect the same will apply if you pre-set hdmi

In other words, if you have a family, you can train them to go to
pavucontrol -> configuration and choose some analog or what ever setting.

To get back to hdmi, they choose the top mentioned pull down.

BUT, each hdmi user has to do the research and config as per part 2.

Sorry about that......but its just as ugly in alsa but in alsa you would use asoundrc
and thats not perfect for on-the-fly changing
Back to top
Display posts from previous:   

All times are GMT - 8 Hours