Wrestling with JACK - JACK is winning

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

User avatar
lintlicker
Established Member
Posts: 59
Joined: Sat Dec 03, 2011 7:51 pm

Wrestling with JACK - JACK is winning

Post by lintlicker »

Hi,
It is nice to see that this forum is still active. I was active here for a period in 2011, but life happened and I disappeared for a bit.

But now I'm back, and I'm looking for some guidance dealing with JACK. For me, this program is an enigma. It seemingly has a will of its own, deciding when to function, and when to crash; when to behave, and when to just do its own thing. Clearly I'm doing something wrong, but after reading countless JACK set-up guides, I'm spinning my wheels.

Here's the situation: I'm a teacher. My old Windows desktop was stolen, so now I'm left with this half-dead elderly dog of a desktop. It doesn't boot windows anymore, so I installed Lubuntu and things have been great. Now, I'm trying to use my Edirol UA 4FX through JACK to record and run a synthesizer.

Here's where stuff gets weird. JACK *usually* refuses to acknowledge the UA 4FX, HOWEVER, the device is recognized and functions. Audacity is able to use the device as a sound source and i have successfully recorded in this manner. If recording was my only goal, I would have no problem. This is what I typically do:

Boot
Launch JACK
Start JACK
plug in UA 4FX
start other applications (like Yoshimi, Ardour, Audacity)

The UA 4FX does not appear in the connections tab. I cannot create connections to the device because it refuses to show up in the connections tab. In the setup dialog, the UA 4FX appears in the list when you press ">" at "Interface" but it has no effect. I've tried tweaking so many settings and I am stumped about what to do now. I suspect that for some reason my device is not "talking" to ALSA. Maybe it's talking to Pulseaudio, I don't know. I don't know how to verify or fix this.

In the course of my battle with JACK, I made the brilliant decision to uninstall then reinstall Pulseaudio. I'm thinking this was not wise, as I'm noticing some instability now.

So, TL:DR - JACK won't list my usb interface in the connections tab. I don't know how to fix it, and my bumblings are probably breaking everything. Can you help?

Thank you,

Lintlicker
nils
Established Member
Posts: 538
Joined: Wed Oct 22, 2008 9:05 pm
Has thanked: 35 times
Been thanked: 94 times
Contact:

Re: Wrestling with JACK - JACK is winning

Post by nils »

1) Remove Pulseaudio from your system and from your memory
1b) Tabula Rasa. Delete you maybe weird-by-now jack settings:

Code: Select all

rm ~/.jackdrc

Code: Select all

rm ~/.config/rncbc.org/QjackCtl.conf 
2) Plug the card in, configure qjackctl, then start jack. Not the other way around. Before starting check that you have enabled realtime, set your Samplerate to 48k, frames/period to something reasonable like 512 or 256 and Timeout to maximum and Periods/Buffer to 3 (since it is USB)
3) Be sure to have the right audio card chosen in qjackctl, and not your mainboard sound chip. If you have the option in your bios (you usually have): Switch that sound chip off, leave you usb card plugged in at all times.
3) Jack needs exclusive audio card access. If you have programs running that need sound (browser, media player) it will not start.
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: Wrestling with JACK - JACK is winning

Post by Pablo »

Welcome back!
JACK won't list my usb interface in the connections tab
Note that the audio card used by jack is, by default, called "system". This generic name doesn't mean it is not your USB interface. As Nils told you, just make sure that you choose the right interface in qjackctl and "system" will be the Edirol.

There is a potential problem though: As audio cards sometimes swap numbers in different reboots, if you define the number such as hw:1, jack might grab the wrong card without warning. This is why it is recommended calling the card by name instead of by number.

Another source of confusion is when the card has differente devices for capture and playback. I don't think this is your case, but just in case, "arecord -l && aplay -l" will tell. Ideally, the Edirol will have one only duplex device.
User avatar
lintlicker
Established Member
Posts: 59
Joined: Sat Dec 03, 2011 7:51 pm

Re: Wrestling with JACK - JACK is winning

Post by lintlicker »

Thank you for the help. I will follow those instructions when I get back to my lubuntu machine on Monday. Is it ok if I ask some questions? I'd really to understand how and why these things work.

1) Ok, what exactly is pulseaudio? My concept is that pulseaudio and alsa are audio daemons. I keep hearing that pulseaudio is this evil broken thing. Why do the Ubuntu devs keep including it if it is so bad? Is it as simple as typing "sudo apt-get remove pulseaudio"? What are the consequences of removing pulseaudio?
3) Be sure to have the right audio card chosen in qjackctl, and not your mainboard sound chip. If you have the option in your bios (you usually have): Switch that sound chip off, leave you usb card plugged in at all times.
I'm confused about all of this. My device is a usb interface for various inputs (1/4", XLR, midi, ect.) My understanding of the sound chip is to send signals to the speakers. If i disable the sound chip, that means that the device will have to do both input AND output. I think I just figured it out. Did I just figure it out?
3) Jack needs exclusive audio card access. If you have programs running that need sound (browser, media player) it will not start.
So this means that Jack needs to start "clean"? I know that many programs don't talk to JACK. If I disable my sound chip, does this mean that I cannot play audio from those sources?
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: Wrestling with JACK - JACK is winning

Post by autostatic »

lintlicker wrote:1) Ok, what exactly is pulseaudio? My concept is that pulseaudio and alsa are audio daemons.
PulseAudio is a sound daemon that allows multiple sound sources. It needs drivers in order to do so. Those are provided by ALSA, ALSA is the Linux sound driver stack.
lintlicker wrote:I keep hearing that pulseaudio is this evil broken thing.
PulseAudio is not broken. It is just not suited for real-time, low-latency audio. That's what JACK is for. JACK is a sound daemon, just like PulseAudio.
lintlicker wrote:Why do the Ubuntu devs keep including it if it is so bad?
Because it is not bad. 99% of the Ubuntu users don't even know they're using it. That's how good it is.
User avatar
lintlicker
Established Member
Posts: 59
Joined: Sat Dec 03, 2011 7:51 pm

Re: Wrestling with JACK - JACK is winning

Post by lintlicker »

lintlicker wrote:Why do the Ubuntu devs keep including it if it is so bad?
Because it is not bad. 99% of the Ubuntu users don't even know they're using it. That's how good it is.
Thank you for clearing that up for me. The pulseaudio daemon drives the sound. I don't understand why it needs to be removed. On the many blogs, forums, and sites I've checked, it seemes that everyone has a differing opinion about whether or not pulseaudio should be removed or not. I have removed it before (via sudo apt-get remove pulseaudio) and after reboot my speakers still played sound (from youtube). How can this be if the daemon is removed?

(This question just popped into my head)
Do I have to commit to having either a general purpose OR a recording/pro audio setup?
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: Wrestling with JACK - JACK is winning

Post by autostatic »

lintlicker wrote:Thank you for clearing that up for me. The pulseaudio daemon drives the sound. I don't understand why it needs to be removed. On the many blogs, forums, and sites I've checked, it seemes that everyone has a differing opinion about whether or not pulseaudio should be removed or not. I have removed it before (via sudo apt-get remove pulseaudio) and after reboot my speakers still played sound (from youtube). How can this be if the daemon is removed?
Because then your browser uses ALSA directly. Try another ALSA audio application when watching a YouTube video without PulseAudio. I'd bet that second application will remain silent or fails to start because it can't lock the soundcard.
lintlicker wrote:(This question just popped into my head)
Do I have to commit to having either a general purpose OR a recording/pro audio setup?
Very good question. I'd go for the latter. The first is possible too but takes some more work.
User avatar
lintlicker
Established Member
Posts: 59
Joined: Sat Dec 03, 2011 7:51 pm

Re: Wrestling with JACK - JACK is winning

Post by lintlicker »

Ok, so is there a way to determine if an application uses pulseaudio or Alsa?
Can you change this behavior (make an app use pulseaudio)?

Is there more to getting rid of pulseaudio than "apt-get remove"?
Is there a reason NOT to get rid of pulseaudio?
User avatar
eikakot
Established Member
Posts: 103
Joined: Fri Jan 29, 2010 2:24 pm
Location: Vilnius, Lithuania
Has thanked: 7 times
Been thanked: 3 times
Contact:

Re: Wrestling with JACK - JACK is winning

Post by eikakot »

You don't necessary need to remove pulseaudio. If you are using qjackctl, you can set it to run a script which would kill pulseaudio daemon before starting JACK and run another script to start up pulseaudio after stopping JACK. That way you would use pulseaudio only when JACK is not running. The reason to use pulseaudio or not depends on what you want to do with your computer. Do you plan to run JACK all the time? If it is so, you don't need pulseaudio.
In the case when JACK isn't running, pulseaudio enables you to listen to the audio from different applications at the same time. Let's say you are watching a youtube video, and you want to play something in vlc at the same time: pulseaudio lets you do that. You can also use a mixer to set the volume levels of youtube and vlc individually. Without pulseaudio, the browser playing youtube would use ALSA directly and so no other application could use the soundcard at that time.
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: Wrestling with JACK - JACK is winning

Post by Pablo »

I second Elikakot but I'd like to add something.

If you want to make music and still have a general purpose system, don't remove pulseaudio. In this case, either (1) you don't mind or even prefer not having sound from desktop apps when jack is active (as Elikakot suggests) or (2) you want sound from desktop apps even if jack is active (this is also possible).

Once you make this decision, we can help you with the howto.
User avatar
lintlicker
Established Member
Posts: 59
Joined: Sat Dec 03, 2011 7:51 pm

Re: Wrestling with JACK - JACK is winning

Post by lintlicker »

I guess I would like my system to behave normally until I start JACK. Then it would be in "music making mode". If it is easier (or a better idea) to run jack all the time, then I am all for that choice. My main goal is to educate myself, so I will submit to your expert opinion.
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: Wrestling with JACK - JACK is winning

Post by Pablo »

OK, for the first option, see:

http://wiki.linuxaudio.org/wiki/system_ ... pulseaudio

To automate the process, you can put the command "pulseaudio -k" (without the quotes) in qjackctl, Setup, Options tab: "Execute script on Start up".

To resume pulseaudio once jack is stopped type: "pulseaudio -D" in "Execute Script after shutdown".

Important note: All the tweaks and tricks regarding linux audio depend a lot on the distro and its release number.

For example, in my ubuntu 13.04 the above is not needed.
User avatar
lintlicker
Established Member
Posts: 59
Joined: Sat Dec 03, 2011 7:51 pm

Re: Wrestling with JACK - JACK is winning

Post by lintlicker »

For example, in my ubuntu 13.04 the above is not needed.
This is very interesting to me. I'm running 13.04 on my laptop, but I'm running Lubuntu on my classroom computer. (I plan to set both up for recording eventually.) Why do you not need to kill pulseaudio in 13.04?

Do you also need to edit ~/.pulse/client.conf for "pulseaudio -k" to work?
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: Wrestling with JACK - JACK is winning

Post by Pablo »

Why do you not need to kill pulseaudio in 13.04?
I guess pulseaudio devs did something in the last year or so, to release the audio card when jack asks for it and grab it again when jack stops.
Do you also need to edit ~/.pulse/client.conf for "pulseaudio -k" to work?
No in 13.04. But I have disabled d-bus interface in qjackctl.
User avatar
lintlicker
Established Member
Posts: 59
Joined: Sat Dec 03, 2011 7:51 pm

Re: Wrestling with JACK - JACK is winning

Post by lintlicker »

Ok, so now I'm back at my "target machine" and I think I can better describe my issue.

I open qjackctl and then click the connections tab. I see a window open that has 3 tabs: audio, midi, alsa. When JACK is running, the following options are under the audio tab: Pulseaudio Jack Sink (which is new as of today), System. There is nothing under Midi. In ALSA, I see 14:midi through.

The problem is that when I start other programs (like zynaddsubfx) they appear under the ALSA tab. In the past, when things are working correctly, my device also appears under the ALSA tab. This allows me to connect the UA 4FX to zynaddsubfx. For some reason, the UA 4FX is not appearing on this list. Audacity and Yoshimi also fail to appear on this list, but interestingly enough, Audacity will talk directly to the UA 4FX.

Am I clearly describing my problem?
Post Reply