JACK Audio Server

Discussion in 'General Linux Discussion' started by allenskd, Jul 1, 2014.

  1. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    Hey guys, I'm trying to find a replacement for PulseAudio. I actually got both of them running right now, but having the thought that two audio servers are running at the same time is not pleasant.

    Has anyone ever used JACK or have it as default? I seek answers... but it's pretty hard to seek them when they could be written in different ways.

    1) JACK multiple soundcard auto-detection?

    I have loaded the USB speakers using alsa_out command, it's actually really really simple. Yet I wonder if there's a auto load mechanism for JACK

    2) Apps like KMIX, I need something to switch audio output on the fly.

    Actually, I found a way through Connect in qjackctl. But it's not what I want. I want something more... basic/simple, although having the power of outputting to multiple cards at the same time is nice.

    3) JACK as the main audio server

    I'm getting mixed answers on this one. It seems some people mix it with PulseAudio, others try to switch between them.
  2. Aryvandaar

    Aryvandaar Active Member

    Joined:
    Jun 21, 2014
    Messages:
    304
    Likes Received:
    29
    Trophy Points:
    28
    Location:
    Norway
    I use ALSA as my sound server on my desktop PC with Manjaro. I removed Pulseaudio. I haven't tried JACK though, but I think that will have to wait because I just got ALSA set up with a working mic setup and everything. Maybe I will do some tests on my laptop, because I don't need my laptop functional, so I can mess up and still have my desktop working. :)

    In general I don't like Pulseaudio, because it has a habit of making the sound stutter at times. As an audiophile I think that this is unacceptable.
  3. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    Right now PulseAudio is routing the onboard card to JACK and I've managed to totally remove the stutter. Why would I set up two sound servers? I don't like the idea, but I do use several outputs than the built-in audio. ALSA is pretty bare bones unless you spent hours configuring it how you want it to be.

    I think one of the remarking features that I really need is this one:

    [​IMG]

    I actually had positive results today with JACK+Pulseaudio mix.

    - I can record games with audio, dmix didn't let me.
    - No more stutter, I explicitly specified for JACK to control the main onboard card.
    - No more underruns with WINE.

    I want to move to full JACK setup, but there are several things holding me. Loading devices with alsa_out keeps throwing resource error. alsa_out command loads a device to JACK, you can simultaneously output the stream to several input ports in qjackctl (usb speakers, HDMI) with low latency. I can't switch the streams with kmix, so it defeats the purpose.

    I think the only problem I'm having is with the microphone but eh... that can wait.
  4. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    Adding up:

    Man... this combination really rocks. I actually am noticing a big difference in audio quality. Some songs I had sounds even more amazing than it did with just PA.
  5. ThunderRd

    ThunderRd Irreverent Query Chairman Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    2,762
    Likes Received:
    88
    Trophy Points:
    48
    Location:
    Northern Thailand, the Land of Smiles
    Home page:
    I want to follow this thread because I've long been interested in JACK. Several knowledgeable people have recommended it to me, but unfortunately I have nothing to add here since I haven't had the time to fuss with it as yet.

    It seems like from what I have heard, people have either a love or hate relationship with ALSA/Pulse, but most of them have been able to work out their problems using some kind of combination with JACK, or a replacement altogether.

    I use ALSA, but my biggest problem seems to be an intermittent need to restart it. I have not been able to track down why this happens. It seems to work fine for my purposes 90% of the time, sometimes for days on end, but then something gets borked, requiring a restart.

    You might be on the right track. I'll follow here and try to get some time to experiment with JACK as well.
  6. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    If you are going to do a JACK/PulseAudio setup, follow these instructions if you are going to start jackd with qjackctl at the start.

    https://wiki.archlinux.org/index.php/PulseAudio/Examples#PulseAudio_through_JACK (follow the "new way" section)

    Just wanted to point it out because I had trouble with the microphone since both were fighting for it, and me killing pulseaudio wasn't the answer. Basically you just hook up four shell scripts.

    Important: In the post_start script, add at the end pactl suspend false

    I'm gonna give it a little break. I tend to get a little obsessed when things aren't working so let's say I'm a bit burned out on researching. It's still worth it (imho).

    I think the other answer for me on loading additonal hardware, since jackd only manages a single card is just to add them up via those shell scripts. Sadly, it's just gonna end up me disabling pulseaudio for the fifth time. Loading the new outputs isn't the problem for me, changing audio on the fly is more... less of a commodity, and more chore-ish, since you have to play with qjackctl Connections section.
    Last edited: Jul 3, 2014
  7. Aryvandaar

    Aryvandaar Active Member

    Joined:
    Jun 21, 2014
    Messages:
    304
    Likes Received:
    29
    Trophy Points:
    28
    Location:
    Norway
    I just set the default soundcard in the alsamixer in my terminal, and I had to activate the microphone with spacebar when selecting the mic volumebar. The volume is a bit off, and I have to speak a bit loud in Teamspeak, but I manage until I can fix the volume for the mic.
  8. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    Did you try boosting it and raised Capture to 100%? That's what I do when people don't hear me well. I always ends up blasting my ears off because it's too loud (when I unmute the mic so I can listen to my voice)
  9. Aryvandaar

    Aryvandaar Active Member

    Joined:
    Jun 21, 2014
    Messages:
    304
    Likes Received:
    29
    Trophy Points:
    28
    Location:
    Norway
    I can't seem to set the volume for the mic with the alsamixer, only enable the mic in alsamixer.

    Can you run JACK as a single audio server?
  10. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    Yes, both PA and JACK relies on ALSA in one way or another, you can't ditch ALSA since it's necessary. That said I haven't tried it myself completely, but I remember reading you needed to install ALSA plugins for JACK and remember to switch your media players, desktop environment backend to JACK. I did have a problem when I was using mpd with ALSA and JACK at the same time, it had plenty stutters. Supposedly having the ALSA/JACK plugin(both 64/32bit) will help you , which I bet it will.

    By the way you can just use qjackctl (app) to configure JACK (with audio interface and all), it's really easy. Launch qjackctl at startup.
  11. ThunderRd

    ThunderRd Irreverent Query Chairman Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    2,762
    Likes Received:
    88
    Trophy Points:
    48
    Location:
    Northern Thailand, the Land of Smiles
    Home page:
    screenshot-20140705@234754.png View attachment 5584
    I've played around with this and have it running solo as my realtime sound server now. (with ALSA)

    I might be able to help you with the configuration if you have specific questions about that. There are a number of things to do to allow realtime access. The realtime access is the key to removing stutters, etc.
    Last edited: Jul 5, 2014
  12. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    @ThunderRd

    I'm having problems with the microphone again for some reason... alsamixer it works just fine, but with JACK? It keeps breaking :/ I had to reboot today and now I'm without a microphone again. sigh :(
  13. ThunderRd

    ThunderRd Irreverent Query Chairman Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    2,762
    Likes Received:
    88
    Trophy Points:
    48
    Location:
    Northern Thailand, the Land of Smiles
    Home page:
    I'll be afk until this evening, but a fast thought - have you set up a persistent connection for it in the patchbay?
  14. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    Actually I just fixed it after poking with pavucontrol... apparently I have to set the volume 100% on both captures (that by the way, they come from the same input) if the capture of pulseaudio is at 0% volume, the JACK capture that uses the same input will also be affected. It's so weird.

    I haven't played with Patchbay yet, need to read up what it does. I've only played with Connections, which was pretty fun.
  15. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    Reporting in... positive results. I'm going to research more about JACK patchbay today.

    alsa_out utility is working like I wanted to. It's not throwing any errors now... which is great!

    My only problem right now is

    1) How to save that connection I just made with alsa_out. Thunder hinted to use patchbay for persistence.
    2) The speakers are outputting little noises and everything I check the terminal it just says "delay" and some numbers. I want the noises gone when the speakers are idling. (it just makes noises when I'm not using it)
  16. ThunderRd

    ThunderRd Irreverent Query Chairman Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    2,762
    Likes Received:
    88
    Trophy Points:
    48
    Location:
    Northern Thailand, the Land of Smiles
    Home page:
    1) patchbay, yes.
    2) are you configured for realtime privs? /etc/security/limits.conf
  17. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    I used patchbay, it was pretty easy but not really what I want.

    2) I haven't done much on the realtime privs, at least not with that file... I did dpkg-reconfigure -p high jackd. I do see jackdbus having -11 niceness but I'm not sure if that's the issue...

    Whenever my USB speaker reports a delay, a little noise emerges, takes less than a second. It's a tad annoying because they popup whenever you are doing tasks with your PC (using a filemanager, or whatever). I'm going to ask the people over Ubuntu Studio to see what they say about those delays and how to keep them down. Other than that, USB speakers outputs music beautifully. I still have trouble linking my HDMI (nvidia card) with alsa_out
  18. ThunderRd

    ThunderRd Irreverent Query Chairman Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    2,762
    Likes Received:
    88
    Trophy Points:
    48
    Location:
    Northern Thailand, the Land of Smiles
    Home page:
    When you start up jack do you see that 'RT' light blinking on and off? Look in my screenshot above.

    Put the following lines at the end of the limits.conf file:
    Code:
    ## thunderrd edit to setup realtime priority
    YourUserName    -    rtprio        99
    YourUserName    -    memlock        unlimited
    YourUserName    -    nice        -10
    And make sure your user is in both the audio and realtime groups.
  19. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    RT is blinking, I also checked the status:

    [​IMG]

    I added those two, but I'm not sure if RT shouldn't blink.
  20. ThunderRd

    ThunderRd Irreverent Query Chairman Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    2,762
    Likes Received:
    88
    Trophy Points:
    48
    Location:
    Northern Thailand, the Land of Smiles
    Home page:
    It should be blinking, so if it is, RT is working.

Share This Page