LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Blogs > GlennsPref
User Name
Password

Notices

Rate this Entry

Making Realtime audio, with Mandriva Linux and Rolands Edirole UA-25ex (usb powered s

Posted 01-22-2009 at 04:02 AM by GlennsPref

Making Realtime audio, with Mandriva Linux and Rolands Edirole UA-25ex (usb powered sound card), using Ardour, Hydrogen, Rosegarden, jackd and qsynth.

First thing I had to do was get a kernel that supported the new usb audio card.

I started with the newest available, from Mandriva ccooker, 2.6.28 rc...x86_64.

This kernel allowed the device to work out of the box, once I turned off the onboard sound chip in bios.

But I could not get a realtime patch for the new kernel, and to make one is out of my league.

By following this perl program, I found what I needed to change,

I found this wiki very helpful...Suggested reading,
http://wiki.linuxmusicians.com/doku....al-time_kernel

realTimeConfigQuickScan.pl

http://arnout.engelen.eu/files/dev/l...igQuickScan.pl


Make a list, they wont all be kernel config changes.

It checks for several things,
Checking for Ingo Molnar's Real-Time Preemption, Checking for tickless time support, Checking for 1000hz clock, Checking for High Resolution Timers,
Checking filesystem types, Checking tmpfs mounted on /tmp, Checking filesystem 'noatime' parameter, Checking the ability to prioritize processes with (re)nice, Checking whether you're in the 'audio' group, Checking for multiple 'audio' groups, Checking sysctl settings (checking inotify max_user_watches), Checking for resource-intensive background processes.


So, I went back to the last version of the Mandriva RT kernel, and to get the mandriva settings I installed the tmb flavour, 2.6.26.3-1(mdv) via rpm, and restarted the system with that tmb kernel.

then I installed the source for the RT kernel

2.6.26.8-1rt13.1(mdv) (I edited the lines in the makefile to reflect the name I wanted to use)...

Code:
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 26
EXTRAVERSION = -music.8-1.rt13.1mdv
NAME = GamesBox.GlennsPref.net




uname -a reveals the details, I don't want them named all “custom”
Code:
glenn@GamesBox:~/bin$ uname -a                                                                          (22-01 13:33)
Linux GamesBox.GlennsPref.net 2.6.26-music.8-1.rt13.1mdv #3 SMP PREEMPT RT Wed Jan 14 20:45:45 EST 2009 x86_64 AMD Athlon(tm) 64 X2 Dual CoreProcessor 5600+ GNU/Linux
glenn@GamesBox:~/bin$
rpm's...
Code:
kernel-rt-source-2.6.26.8-1.rt13.1mdv - The source code for the Linux kernel                                                                                                                        
The kernel-rt-source package contains the source code files for the Linux kernel. The source files are only needed if you want to build your own custom kernel that is better tuned to your particular hardware. 

If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...) drivers against, install the *-devel-* rpm that is matching your kernel. 

For instructions for update, see: http://www.mandriva.com/en/security/kernelupdate 

NOTE: This kernel has no Mandriva patches and no third-party drivers, only Ingo Molnar -rt (realtime) series patches applied to vanille kernel.org kernels.


Code:
kernel-tmb-desktop-2.6.26.3-1mdv - Linux Kernel for desktop use with x86_64                                                                                                                        
The kernel package contains the Linux kernel (vmlinuz), the core of your Mandriva Linux operating system.  The kernel handles the basic functions of the operating system:  memory allocation, process allocation, device input and output, etc. This kernel is compiled for desktop use, single or multiple x86_64 processor(s)/core(s), using voluntary preempt, CFS cpu scheduler and cfq i/o scheduler. This kernel relies on in-kernel smp alternatives to switch between up & smp mode depending on detected hardware. To force the kernel to boot in single processor mode, use the "nosmp" boot parameter. 

For instructions for update, see: http://www.mandriva.com/en/security/kernelupdate 

The tmb kernels is an experimental kernel based on the kernel.org kernels with added patches. Some of them may/will never end up in the main kernels due to their experimental nature. Some refer to this kernel as a 'hackkernel' ... Use these kernels at your own risk !!
But the RT kernel is vanila and has no Mandriva tweaks, so to keep the tweaks I configured the RT source from the old tmb config file. The versions overlapped in the right order.

Change to the new source dir (link to actual kernel)

You will need to be root when you install the kernel, but until then as a normal user go through the config and make processes.

cd /usr/src/linux

2 ways to do this, either type …

make menuconfig and load the /boot/config as the starting place, make sure you save it...
or
make oldconfig (will only ask NEW questions not answered in the old config file. (/boot/.config)

say yes to the realtime preemption question, and preempt_rcu_Boost and any deps (none I noticed).

and no to the others or leave them as dynamic loading modules.
Some of it will be debugging apps, but you really won't want a lot of low level apps running while trying to record. So you can leave the debugging and kernel hacking out if you like.



Check with the http://arnout.engelen.eu/files/dev/l...igQuickScan.pl

script if you need to adjust ticks, or smp, x86_64, any graphics tweaks, etcetera.
And make sure the snd_usb_audio module is loaded in the config.

(I also look for spca561 support for my webcam, and option for usb hdspa modem)
I check to see if the agpgart modules are dynamic not static for my amd/nVidia combo.

make all && make modules_install && make install

Reboot to the new kernel.

I got this from a Linux-Journal tutorial (.flv) called

Hyper_Low-Latency_Audio_with_a_Real-Time_Kernel_Linux_Journa.flv

For the life of me, I can't find it on the web, it's about 16Mb, I have a copy here.

I'm going to split it to make 3 smaller clips and post it up on Google groups, unless I can find a link....


Get set_rlimits...

http://www.physics.adelaide.edu.au/~...mits-1.3.0.tgz
http://www.physics.adelaide.edu.au/~jwoithe/

Quote:
“This file sets the maximum priorities which
set_rlimits can set for a given program when executed by a given user or
group. The program specified must include an absolute path.”
Uncompress it with
tar xf *

Run,

make clean
make

and when your ready to install it, run
make install

Now get ready with you favourite editor, with root privleges

to edit some system files...

vi is a good one.

usually /etc/set_rlimits.conf

We want access to the @audio group and any of it's members (or a username), you should be a member of that group.

The next is the absolute address to the binary, then the nice level, realtime priority, and memlock for the binary to run in.

Code:
@audio /usr/bin/jackd nice=-1 rtprio=80 memlock=100000
@audio /usr/bin/qjackctl nice=-1 rtprio=79 memlock=100000
@audio /usr/bin/ardour nice=-1 rtprio=78 memlock=400000
#@audio /
@audio /usr/bin/hydrogen nice=-1 rtprio=76 memlock=100000
@audio /usr/bin/rosegarden nice=-1 rtprio=75 memlock=100000
@audio /usr/bin/vkeydb nice=-1 rtprio=74 memlock=100000
@audio /usr/bin/qsynth nice=-1 rtprio=73 memlock=100000
/etc/security/limits.conf
Code:
@audio - rtprio 99
@audio - memlock 500000
@audio - nice -10
Edit sysctl.conf for …
Code:
#checking inotify max_user_watches... too small. For Realtime Audio...
#** /proc/sys/fs/inotify/max_user_watches is smaller than 524288
#** increase it by adding 'fs.inotify.max_user_watches = 524288' to /etc/sysctl.conf and rebooting
#   For more information, see http://wiki.linuxmusicians.com/doku.php?id=system_configuration#sysctl.conf
fs.inotify.max_user_watches = 524288
and any others mentioned in the perl script, like tmp fs listing.

Set up the server path in qjackctl to read, set_rlimits jackd

Type in set_rlimits jackd to start the server.

You should see (and hear) some difference in how smoothly it ticks along.


Before starting with jackd

jack with 64 frames per second and a buffer of 4 periods, at 44.1kHz 16bit
latency is about 5.6msec but jack has dropouts in the audio chain,
Xruns...

After set_rlimits jackd

jack with 64 frames per second and a buffer of 2 periods, at 44.1kHz 16bit
gets about 2.6msec, with no xruns.


Try to get in a habit of using one resolution most of the time.


Check for basic system sounds, configure kernel for virtualBox and nVidia Graphics re-instalation.

Done.
Posted in Uncategorized
Views 4831 Comments 4
« Prev     Main     Next »
Total Comments 4

Comments

  1. Old Comment
    The missing Linux-Journal Video...

    http://www.linuxjournal.com/video/hy...al-time-kernel

    This formed a strong background to enable rt schedule access for programs.
    Posted 01-24-2009 at 02:51 AM by GlennsPref GlennsPref is offline
  2. Old Comment
    I have a major rewrite of this tute in progress.

    Once I confirm the patching process for the edirol patch, I will be ready to recompile this doc.

    very soon.

    Thanks for your patience,

    regards Glenn
    Posted 01-24-2009 at 07:04 PM by GlennsPref GlennsPref is offline
  3. Old Comment
    It will be basically this script, http://arnout.engelen.eu/files/dev/l...igQuickScan.pl

    from the alsa wiki, http://wiki.linuxmusicians.com/doku....al-time_kernel

    followed by the rt http://www.linuxjournal.com/video/hy...al-time-kernel

    and edirol, by blablack, http://ubuntuforums.org/archive/index.php/t-908845.html

    patches for the kernel.

    Rather than try to rewrite already perfect documents,
    Posted 01-24-2009 at 07:13 PM by GlennsPref GlennsPref is offline
  4. Old Comment

    http://www.linuxjournal.com/video/hyper-low-latency-audio-real-time-kernel

    Quote:
    Originally Posted by GlennsPref View Comment
    The missing Linux-Journal Video...

    http://www.linuxjournal.com/video/hy...al-time-kernel

    This formed a strong background to enable rt schedule access for programs.
    The whole url would be better, Sorry I missed this.
    http://www.linuxjournal.com/video/hy...al-time-kernel
    Posted 02-07-2009 at 10:00 PM by GlennsPref GlennsPref is offline
 

  



All times are GMT -5. The time now is 04:47 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