LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 08-28-2012, 12:37 PM   #1
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slack(64|32)_v(13.37|14.0), debian6, ubuntu
Posts: 632

Rep: Reputation: 36
real time kernel for audio (DAW)


hello everyone,
i am once again puzzled as to patch and convert a mainline kernel to a real time one. The reason is that jackd will give me xruns:

Quote:
nass@starbase:~$ set_rlimits jackd -R -d alsa -D -p256
.........
.........
**** alsa_pcm: xrun of at least 0.026 msecs
**** alsa_pcm: xrun of at least 0.022 msecs
**** alsa_pcm: xrun of at least 0.025 msecs
I have obviously setup set_rlimits
Quote:
@audio /usr/bin/jackd nice=-1 rtprio=80 memlock=500000
@audio /usr/bin/qjackctl nice=-1 rtprio=80 memlock=500000
(setting a higher rtprio doesn't solve the problem)

and followed suggestions in this thread for mainline kernel options, but it just doesn't do the trick.

I did switch to kernel 2.6.38.4 because slackmedia suggests that this kernel version received some realtime attention: http://slackermedia.info/html/bk01ch07.html but that didn't help either.

Well i hope I have convinced you I need to patch my kernel (to those of you I didn't convince, please please tell me if there is anything else to try - apart from increasing the jack frames/period :P (option -p above)

I should also mention that this very same hardware, could run in winXP with the asio drivers and a latency of no more than 12msec. Now if I start the jackd server with even 21msec latency, i'll still get frequent xruns...

So is there anything that I need to know before I patch from http://www.kernel.org/pub/linux/kernel/projects/rt/

Things like nvidia drivers do not work with real time kernel, as I read, but does the nv driver work? I am not interesting in fancy 3d graphics and composite stuff but I hope I can use the nv driver. Does anyone have experience with the RT kernel? does anyone know of other things that will be broken?

Thank you for you help!
 
Old 08-28-2012, 12:51 PM   #2
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 2,504

Rep: Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912
For running jack with realtime privileges, I used the method Heinz describes in his slackbuild for jack

http://slackbuilds.org/repository/13...onnection-kit/

Quote:
jackd has to run with realtime privileges. One way to do this on Slackware
would be to use set_rlimits. Since 12.2 there's another way - if you have
a filesystem that supports posix capabilities (reiserfs does not), you can
grant jackd the rights to run in realtime mode, even when started as a
normal user, with the following command:
Code:
setcap cap_ipc_lock,cap_sys_nice=ep /usr/bin/jackd
If you use qjackctl to start jack, it will need the same capabilities set
to be able to start jack as non-root user. You can use the same command
with 'qjackctl' instead of 'jackd'
I think an -rt kernel is optional, slackware-13.37 already provides kernel 2.6.38.4 in testing and that should suffice.

Last edited by ponce; 08-28-2012 at 12:56 PM.
 
Old 08-28-2012, 01:07 PM   #3
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slack(64|32)_v(13.37|14.0), debian6, ubuntu
Posts: 632

Original Poster
Rep: Reputation: 36
I still get xruns...

less frequent but more severe

Quote:
alsa_pcm: xrun of at least 0.057 msecs
 
Old 08-29-2012, 06:39 AM   #4
4Strings
Member
 
Registered: Aug 2010
Distribution: slackware-14.1
Posts: 38

Rep: Reputation: 5
Hi!
I usually record on Ardour by using the official slackware-current kernel version, getting a jack latency < 10 ms.
(I'm actually using a firewire Presonus Firebox)
But, in order to do so, I always have to reduce my ati gpu power state in order to avoid xruns.

Before running jack, I have to change my power_profile (....altough I always receive an NMI warning message from the kernel!..but it's a different matter):
Code:
echo low > /sys/class/drm/card0/device/power_profile.
I don't know how it works! but it allows to get a low latency. Instead, leaving the gpu power state at its default (high) power state would lead me to get several xruns.

Although your graphic card is an nvidia one, you could try to manage your gpu power state,
....hoping that it helps!
 
Old 08-29-2012, 08:34 AM   #5
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slack(64|32)_v(13.37|14.0), debian6, ubuntu
Posts: 632

Original Poster
Rep: Reputation: 36
4strings, yes it is an nvidia and i don't see any problems of the sort.Thank you though.

So some findings:
using the professional audio card (a Hoontech DSP24 with DSP2000 outboard, based on ice1712) and the 2.6.38.4 kernel tweaked as explained earlier, I will still get scarce xruns of jackd with 512 frames/period. this results in a latency of 10.7ms @48kHz.

The pc is somewhat old (AMD Athlon(tm) XP 2600+, 1GB RAM) but as stated before I remember I could run in winXP with latencies less than 12ms stably.

Well here comes the magic though; with the 3.2.28-rt41 patched kernel (with a slight modilfied generic config),
I can go down to 128 frames /period and still run jackd solid. Thats a latency of 2.7ms @48kHz. It is a DAW at its best using linux and indeed slackware

just for reference the command I used to run jackd (after using setcap per Ponce's suggestion):
Quote:
jackd -R -dalsa -dhw:2,0 -D -p128 -r48000 -H -M
where hw:2,0 is the pro-audio card.

AS for the system, it's only been running for a day but I haven't noticed any instability.

Last edited by nass; 08-29-2012 at 08:37 AM.
 
1 members found this post helpful.
Old 08-29-2012, 08:57 AM   #6
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 2,504

Rep: Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912
Quote:
Originally Posted by nass View Post
(after using setcap per Ponce's suggestion)
it wasn't mine, it's in the README of jack on slackbuilds.org (don't forget you are supposed to read the READMEs of the build scripts you use from there ), written by Heinz Wiesinger.

Last edited by ponce; 08-29-2012 at 08:58 AM.
 
Old 08-29-2012, 08:59 AM   #7
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slack(64|32)_v(13.37|14.0), debian6, ubuntu
Posts: 632

Original Poster
Rep: Reputation: 36
well i hadn't used it before , cause in other cases I was on reiserfs filesystems.
so set_rlimits came as the natural choice to mind once again.
But when you mentioned it again, i decided to give it a go on this system that's running on jfs
 
Old 08-29-2012, 04:59 PM   #8
Martinus2u
Member
 
Registered: Apr 2010
Distribution: Slackware
Posts: 353

Rep: Reputation: 56
just out of interest, have you ever tried the BFS cpu scheduler, maybe in conjunction with scheduling class SCHED_RR for sound applications? I have no experience in the field of sound latency, but since latency is the whole point of BFS it might help.
 
Old 08-30-2012, 01:36 AM   #9
tpreitzel
Member
 
Registered: Aug 2007
Posts: 253

Rep: Reputation: 28
Quote:
Originally Posted by ponce View Post
For running jack with realtime privileges, I used the method Heinz describes in his slackbuild for jack

http://slackbuilds.org/repository/13...onnection-kit/



I think an -rt kernel is optional, slackware-13.37 already provides kernel 2.6.38.4 in testing and that should suffice.
Hasn't cap_sys_nice=ep been deprecated ????
 
Old 08-30-2012, 05:30 AM   #10
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slack(64|32)_v(13.37|14.0), debian6, ubuntu
Posts: 632

Original Poster
Rep: Reputation: 36
Martinus2u I had never thought of that.
I should give it a go (and post back here).
Thanks!

tpreitzel I don't know if it has been deprecated, but it seems to give me slightly less xruns (when I stress the card's capabilities) than the set_rlimits solution...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to record audio mic input and broadcast it as a fedora 12 service in real-time sumantacm Linux - Hardware 1 06-11-2011 07:37 PM
LXer: Crash Course in Audio Recording With Ardour DAW LXer Syndicated Linux News 0 04-29-2011 09:50 PM
Real time management of audio inputs/outputs? Jeff91 Linux - Software 9 06-23-2010 04:05 PM
real time kernel not real time, still xruns in Jackd browny_amiga Linux - General 0 09-20-2009 03:47 PM
latency and audio programming in real-time tanoatlq Programming 2 08-12-2008 06:01 PM


All times are GMT -5. The time now is 12:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration