Re: [LAU] ALSA doesn't speak to JACKD

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: lau <linux-audio-user@...>
Date: Monday, October 26, 2009 - 12:33 am

Pablo, many thanks; you have just solved a problem for me :-)  A few of
my system-generic audio was coming out distorted.  So here is what I
have now.  So far, I have not been able to detect any reduction in
latency or other performance, when compared to using jack-only audio.

My first step was to identify the alphanumeric name (as opposed to the
number!) of the sound device I want to use for everything.  This is
done thusly:
$ cat /proc/asound/cards

I received the following from the above:
 0 [HD2            ]: Prodigy71HD2 - Audiotrak Prodigy
HD2
                      Audiotrak Prodigy HD2 at 0xef80, irq 10

You should have at least one item representing your sound card.  If
not, your card is not configured
completely to work with ALSA, and I'm afraid I cannot help :-)  Anyway,
providing that your desired device is listed in /proc/asound/cards, it
will have an alphanumeric name; the one you want is in the square
brackets [].  So my
card's ALSA name is "HD2".

My second step was to test Jack applications using this alphanumeric
name.  In qjackctl setup, in the "Interface:" field, usually it reads
either (default) or a numeric device number, e.g., hw:0.  
In my case, I set this field to read hw:HD2.  Suddenly all
sound on the machine began behaving a bit better.  I don't know
entirely why, but I suspect the numeric-to-alphanumeric translation in
ALSA either runs slow or gets confused or both.  No matter;
alphanumeric is far better, the numerics do definitely get confused
when USB audio is plugged in et cetera.  I ran in AVLinux just like
this for a while; AVLinux gives me an MPlayer which will do Jack, which
is nice, but some annoyances remained.

My third step was to get the ALSA2Jack plugin in.  This is a module for
ALSA, which permits it to send output to Jack.  The idea is that we
need
two audio data paths.  The first is for general latency-irrelevant
applications, jack-incompatible, which will run
App-->ALSA-->Jack-->ALSAdevice.  The second is for
latency-critical applications, which will run
App-->Jack-->ALSAdevice.  If we set up the ALSA2Jack plugin's
virtual
device, as default audio device, and tell Jack to run all of its output
direct to the ALSA sound device of explicit choice, we should get the
best of both worlds.

So.  This being AVLinux (Debian), I then had to install package
"libasound2-plugins", to get the ALSA2Jack plugin in.  Found it in
Synaptic.

The last step was to implement an ALSA configuration file handling
ALSA2Jack and also the Jack device IDs.  I am now using the
below.  The only significant change you will need, is the ALSA mixer
should be set to point
directly to the alphanumeric name of my ALSA sound device.  Probably
should
reboot after changing it, just in case.  On the other hand, unlike many
who use ~/.asoundrc, I use it as
an /etc/asound.conf, which is just a bit different; I don't like the
idea of sound configs changing at login, I want them nailed to the wall
at boot :-)

J.E.B.

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
        }
}

ctl.mixer0 {
    type hw
    card HD2
}

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAU] ALSA doesn't speak to JACKD, HamRadio, (Sun Oct 25, 12:03 pm)
Re: [LAU] ALSA doesn't speak to JACKD, Ray Rashif, (Sun Oct 25, 3:02 pm)
Re: [LAU] ALSA doesn't speak to JACKD, Jonathan E. Brickman, (Sun Oct 25, 9:53 pm)
Re: [LAU] ALSA doesn't speak to JACKD, Pablo Fernandez, (Sun Oct 25, 10:51 pm)
Re: [LAU] ALSA doesn't speak to JACKD, Esben Stien, (Tue Oct 27, 8:40 pm)
Re: [LAU] ALSA doesn't speak to JACKD, Jonathan E. Brickman, (Tue Oct 27, 11:55 pm)
[LAU] ALSA to pulseaudio, Jonathan E. Brickman, (Tue Oct 27, 11:14 pm)
Re: [LAU] ALSA to pulseaudio, Esben Stien, (Wed Oct 28, 10:19 pm)
Re: [LAU] ALSA to pulseaudio, Paul Davis, (Wed Oct 28, 2:29 am)
Re: [LAU] ALSA to pulseaudio, , (Wed Oct 28, 5:26 pm)
Re: [LAU] ALSA doesn't speak to JACKD, Jonathan E. Brickman, (Mon Oct 26, 12:33 am)
Re: [LAU] ALSA doesn't speak to JACKD, HamRadio, (Tue Oct 27, 6:55 pm)