Page 2 of 3
Re: Question about CPU
Posted: Mon Jun 11, 2012 7:28 am
by autostatic
briandc wrote:Can I change any of this to reduce the xruns even more? (I don't get many, but they do happen at times...
Probably not but you might be able to prevent xruns from happening by tweaking other settings. More info in the LinuxMusicians Wiki:
http://wiki.linuxmusicians.com/doku.php ... figuration
In your case, what soundcard are you using? And what is the output of the terminal commands
cat /proc/interrupts and
cat /proc/asound/cards ?
And regarding the ulimit thing you're running Ubuntu right? In that case, try running
sudo dpkg-reconfigure jackd2 . If it asks you if you want to enable realtime process priority select Yes.
Re: Question about CPU
Posted: Mon Jun 11, 2012 9:07 am
by briandc
AutoStatic wrote:briandc wrote:Can I change any of this to reduce the xruns even more? (I don't get many, but they do happen at times...
Probably not but you might be able to prevent xruns from happening by tweaking other settings. More info in the LinuxMusicians Wiki:
http://wiki.linuxmusicians.com/doku.php ... figuration
In your case, what soundcard are you using? And what is the output of the terminal commands
cat /proc/interrupts and
cat /proc/asound/cards ?
And regarding the ulimit thing you're running Ubuntu right? In that case, try running
sudo dpkg-reconfigure jackd2 . If it asks you if you want to enable realtime process priority select Yes.
Hi AutoStatic,
I'll check the link you gave.
I'll be back at that PC tonight (I'm in Italy, so I think we have the same timezone..), and I'll run the info on the sound cards.
Admittingly, I'm using a PC with an internal sound card, of not great quality. I'm doing things on it just to see how much performance I can get out of it. Obviously, the best thing would be to get an external sound card, but I'm not going to bother since I have another PC with more powerful resources.
And, since this PC in question is limited in resources, I've installed AntiX, which I like a lot because it's particularly fast on older PCs. And so it's fast and light for making music.
And, when I installed Jack2, it asked if I wanted realtime, and I selected "yes," and QJackCtl indicates this.
My question at this point is, are there other things that I can tweak to clean out xruns, such as changing priorities somewhere, or doing something like what this guy mentions:
http://www.akjmusic.com/linuxaudio.html
What do you think?
brian
Re: Question about CPU
Posted: Mon Jun 11, 2012 10:08 am
by Pablo
And, when I installed Jack2, it asked if I wanted realtime, and I selected "yes,"
OK, but that is not enough. Now you have to add your username to the audio group. Do in a terminal:
And restart the computer. Now, "ulimir -r -l" should say rtprio ninety-something and memlock unlimited.
Cheers, Pablo
Re: Question about CPU
Posted: Mon Jun 11, 2012 1:08 pm
by autostatic
briandc wrote:Admittingly, I'm using a PC with an internal sound card, of not great quality. I'm doing things on it just to see how much performance I can get out of it.
If it's something like an Intel HDA onboard thingy you can still achieve a reasonable latency. Afaik these kind of onboard cards work best with the following JACK settings:
- Frames/Period: 128 (you could try going lower, maybe it works)
- Sample Rate: 48Khz
- Periods/Buffer: 2
briandc wrote:My question at this point is, are there other things that I can tweak to clean out xruns, such as changing priorities somewhere, or doing something like what this guy mentions:
http://www.akjmusic.com/linuxaudio.html
Turning off ACPI is not necessary in most situations. Tuning your hard drive is uncharted territory for me, I'll add it to the to-do list in the Wiki. Tuning the PCI bus is not necessary in your case I think, unless the Intel HDA soundcard is sitting on an old-school PCI (so not PCIe) bus. But more info on PCI bus latency can be found here:
http://wiki.linuxmusicians.com/doku.php ... us_latency
Re: Question about CPU
Posted: Mon Jun 11, 2012 5:46 pm
by briandc
Pablo wrote:And, when I installed Jack2, it asked if I wanted realtime, and I selected "yes,"
OK, but that is not enough. Now you have to add your username to the audio group. Do in a terminal:
And restart the computer. Now, "ulimir -r -l" should say rtprio ninety-something and memlock unlimited.
Cheers, Pablo
I had checked the GUI for users before, but I was in doubt so I ran the command you posted here. But indeed, I am already part of the audio group.
Does locking/unlocking memory have any effect?
What about priority changes? QJackCtl is set to "default" but maybe that's not enough?
Also, I notice that an occasional xrun happens even when I'm not recording. Sometimes opening an app will cause one!
brian
Re: Question about CPU
Posted: Mon Jun 11, 2012 6:47 pm
by Pablo
I had checked the GUI for users before, but I was in doubt so I ran the command you posted here. But indeed, I am already part of the audio group.
To sum up,
1) You are in the audio group
2) The lines
@audio - rtprio 95
@audio - memlock unlimited
are present in either
/etc/security/limits.conf or in some file under
/etc/security/limits.d (tipically
/etc/security/limits.d/audio.conf)
3) But still you don't have rtprio and memlock privileges, as shown by "ulimit -r -l" or in qjackctl and ardour messages.
Some users had this exact problem when using a light login manager (slim) that wouldn't load the pam_limits PAM module. See
http://linux.die.net/man/8/pam_limits
http://meandubuntu.wordpress.com/2008/0 ... -and-jack/
rtprio and memlock are a must. Other tweaks can help but you need to solve that first.
Cheers, Pablo
Re: Question about CPU
Posted: Mon Jun 11, 2012 7:37 pm
by autostatic
briandc wrote:Does locking/unlocking memory have any effect?
Highly doubt it.
briandc wrote:What about priority changes? QJackCtl is set to "default" but maybe that's not enough?
You could give it a try. I mostly use 70, but that also depends of the other prios set on the system (I also use rtirq and have to make sure no prios overlap each other which defeats the purpose of using prios).
briandc wrote:Also, I notice that an occasional xrun happens even when I'm not recording. Sometimes opening an app will cause one!
That shouldn't happen. What kind of Desktop Environment are you using (Gnome3, KDE, Unity, XFCE)?
Re: Question about CPU
Posted: Mon Jun 11, 2012 7:50 pm
by briandc
Pablo wrote:
To sum up,
1) You are in the audio group
Correct.
Pablo wrote:2) The lines
@audio - rtprio 95
@audio - memlock unlimited
are present in either
/etc/security/limits.conf or in some file under
/etc/security/limits.d (tipically
/etc/security/limits.d/audio.conf)
Correct.
Pablo wrote:3) But still you don't have rtprio and memlock privileges, as shown by "ulimit -r -l" or in qjackctl and ardour messages.
Correct.
I don't know what I should do to the pam_limits.so file. It's basically blank.
But my problems aren't as "severe" as mentioned in the second link (Jack not working at all).
However, I did notice in the "/etc/security/limits.d/audio.conf" file that the renice function was not activated. Perhaps I should activate it?
brian
Re: Question about CPU
Posted: Mon Jun 11, 2012 7:53 pm
by briandc
AutoStatic wrote:briandc wrote:Does locking/unlocking memory have any effect?
Highly doubt it.
briandc wrote:What about priority changes? QJackCtl is set to "default" but maybe that's not enough?
You could give it a try. I mostly use 70, but that also depends of the other prios set on the system (I also use rtirq and have to make sure no prios overlap each other which defeats the purpose of using prios).
briandc wrote:Also, I notice that an occasional xrun happens even when I'm not recording. Sometimes opening an app will cause one!
That shouldn't happen. What kind of Desktop Environment are you using (Gnome3, KDE, Unity, XFCE)?
I'm using the IceWM environment.
What about the renice command? Is that the same as prios? How can I know what prios are already set? I know that running
gives the nice settings. I also saw in the audio.conf file that the renice setting of -19 was ready but not activated..
brian
Re: Question about CPU
Posted: Mon Jun 11, 2012 8:02 pm
by briandc
I'm supposing that I should open the limits.conf file as root, and put:
as domain: brian
as type: hard
as item: memlock
as value: unlimited
-and-
as domain: brian
as type: hard
as item: rtprio
as value: 95
Correct?
brian
Re: Question about CPU
Posted: Mon Jun 11, 2012 9:21 pm
by Pablo
I also saw in the audio.conf file that the renice setting of -19 was ready but not activated..
According to Paul Davis, nicety is irrelevant for realtime processes. Activating that line won't hurt but it won't help either.
And no, you don't have to further edit security limits conf.
Instead, take a look at /etc/pam.d/
there should be a "login" file of some sort. Write this line:
session required pam_limits.so
Cheers, Pablo
Re: Question about CPU
Posted: Mon Jun 11, 2012 9:30 pm
by Pablo
But my problems aren't as "severe" as mentioned in the second link (Jack not working at all)
jack2 (the "modern" jack, so to speak) is more tolerant with system configurations and it works without realtime privileges. jack1 (the default jack at the time of the writing) wouldn't even start.
Re: Question about CPU
Posted: Tue Jun 12, 2012 5:52 am
by briandc
Pablo wrote:I also saw in the audio.conf file that the renice setting of -19 was ready but not activated..
According to Paul Davis, nicety is irrelevant for realtime processes. Activating that line won't hurt but it won't help either.
And no, you don't have to further edit security limits conf.
Instead, take a look at /etc/pam.d/
there should be a "login" file of some sort. Write this line:
session required pam_limits.so
Cheers, Pablo
I found the "login" file you suggested.
And the line: session required pam_limits.so was already inserted.
Now, from what I read in this file, it appears that pam reverts to what is written in the limits.conf file.
So I'll try adding the lines I mentioned in my last post, just to see if that improves anything, and I'll let you know how it goes..
brian
Re: Question about CPU
Posted: Tue Jun 12, 2012 6:39 am
by briandc
I'm back..
well, adding the two lines didn't "seem" to make much difference.
BUT, I do see that setting QJackCtl at 32000Mhz rather than 41000 Mhz keeps the xruns very low indeed.
In addition, I used the "renice" command (at root) to set QJackCtl at about -18, and a2jmidid and yoshimi (or other synth) at about -16. I think renicing has to be done at every boot, but that's ok.
Audour still gives me the memlock warning, but it does the job.
My (last?) problem at this point, is to figure out why Audacity doesn't "see" the signal coming from Jack. When I hit record, it crashes. It might be a setting that's off, in the ALSA mixer, but I don't know where or what...
brian
Re: Question about CPU
Posted: Tue Jun 12, 2012 8:22 am
by autostatic
briandc wrote:Perhaps I should activate it?
No, that's not necessary:
You could also allow the audio group to renice processes with the help of the limits.conf file, but since nice uses SCHED_OTHER it basically does nothing to increase the performance of a low-latency real-time audio environment that relies on SCHED_FIFO/SCHED_RR. Consult the sched_setscheduler manpage for more info on this subject.
From:
http://wiki.linuxmusicians.com/doku.php ... audio.conf
In other words: using renice improves nothing.
And since you're using IceWM that rules out the desktop environment as a possible troublemaker. I've used IceWM for quite a while too, very light-weight and easy to configure with flat-file, ini-style configuration files. Good choice for doing audio stuff. But what kind of display/login manager are you using?
Regarding Audacity:
- Start JACK
- Start Audacity
- Tick View - Toolbars - Device Toolbar
- In the Device Toolbar select 'JACK Audio Connection Kit' with the 'Audio Host' combo box (default is ALSA)
briandc wrote:How can I know what prios are already set?
Also in the WIki:
http://wiki.linuxmusicians.com/doku.php ... tion#rtirq