.o.    
     /   \         Server: marzen.de
    |     |        Datum:  12.10.2024
    |     |        Zeit:   05:26:32
   /_______\       
        `o   
[Startseite] [Holger] [pulseaudio_and_jack]
------------------------------------------------------------------------------

JACK is a superb low-latency sound server system. But it uses the audio
interface or soundcard exclusively, neither Pulseaudio nor ALSA clients
can talk to that audio interface then. To run them simultaneously,
PulseAudio has to be run as a JACK-client and ALSA-clients have to get
redirected to JACK (or PulseAudio, but I chose JACK).

Note:
You need jackd modules for PulseAudio sound server. On Debian and Ubuntu
they are in the package pulseaudio-module-jack.


Standard setup
--------------
1.) I use QJackCtl to start jackd. My session manager has QJackCtl in
    its autostart list. I won't discuss setting up a base JACK
    installation here.

2.) In /etc/asound.conf (system wide) or ~/.asoundrc we redirect
    ALSA-clients to JACK.

    pcm.!default {
        type plug
        slave.pcm "jack"
    }

    pcm.jack {
        type jack
        playback_ports {
            0 system:playback_1
            1 system:playback_2
        }
        capture_ports {
            0 system:capture_1
            1 system:capture_2
        }
    }

3.) We set up PulseAudio to use JACK as its output and input in
    /etc/pulse/default.pa:

    load-module module-jack-sink channels=2
    load-module module-jack-source

    #.ifexists module-udev-detect.so
    #load-module module-udev-detect
    #.else
    #load-module module-detect
    #.endif

4.) Suppress autostart of the PulseAudio daemon in
    /etc/pulse/client.conf or ~/.pulse/client.conf:

    autospawn = no

5.) Start and stop the PulseAudio daemon in QJackCtl:
    
    -> Settings -> Options

    [ ] Execute script on Startup:
    [X] Execute script after Startup:   pulseaudio -D
    [X] Execute script on Shutdown:     pulseaudio --kill
    [ ] Execute script after Shutdown:

That's it.


Modifications for an alternative input for Skype
------------------------------------------------
In my case it's a bit different because I have a webcam and want to use
it's builtin microphone for Skype instead of the audio interface used by
JACK. Skype works well as a PulseAudio client (but not as an ALSA client
redirected to JACK), so I use a different PulseAudio setup than in 3.).
Instead of

    load-module module-jack-source

I use

    load-module module-alsa-source device=hw:2,0

since my webcam's microphone is hw:2,0.


ALSA-clients are magically redirected to Pulseaudio?
----------------------------------------------------
This can happen because of some ALSA-magic in
/usr/share/alsa/alsa.conf.d and /usr/share/alsa/pulse-alsa.conf. In my
case (Xubuntu 12.04) there's no /etc/asound.conf (system wide) or
~/.asoundrc needed.


------------------------------------------------------------------------------
[Startseite] [Holger] [pulseaudio_and_jack]