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

Notices

Reply
 
Search this Thread
Old 01-22-2009, 05:18 PM   #1
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Mageia Studio-13.37 Kubuntu.
Posts: 3,325
Blog Entries: 33

Rep: Reputation: 199Reputation: 199
Smile How to set up realtime audio, Mandriva 2009.0, Ardour, qjackctl, UA-25EX edirole.


I've put up a howto...at LQ blog.

I'd like to consider it a WIP, any suggestions kindly taken on board...

A new version (v0.3) of this document exists on my blog here at LQ (4 sections)

Not Repeated here for continuity....and space. GW

Last edited by GlennsPref; 01-29-2009 at 04:27 AM. Reason: New version available, Thanks for reading
 
Old 01-24-2009, 02:52 AM   #2
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Mageia Studio-13.37 Kubuntu.
Posts: 3,325
Blog Entries: 33

Original Poster
Rep: Reputation: 199Reputation: 199
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.

A major revision of this howto is under construction because I could not find this video file.

Life's too short.

I'll finish it and put it up asap, Glenn.



Thank you to Linux Journal's Web-Mistress, Katherine for the link

Last edited by GlennsPref; 01-29-2009 at 04:26 AM. Reason: Thank you to Linux Journal's Web-Mistress, Katherine for the link :)
 
Old 01-26-2009, 11:32 PM   #3
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Mageia Studio-13.37 Kubuntu.
Posts: 3,325
Blog Entries: 33

Original Poster
Rep: Reputation: 199Reputation: 199
A new version (v0.3) of this document exists on my blog here at LQ (4 smaller posts)

and at GlennsPrefs blogspot page, one long doc.

Regards Glenn

Making Real-time audio with
Mandriva Linux and Roland's
Edirol UA-25ex (usb powered sound card), using
jackd, qjackctl, Ardour, Hydrogen, Rosegarden and fluidsynth.

Topical Index
Quote:
Objective
Current system Hardware
Find appropriate Kernel
rpm's info and choice
I used a perl script to check my system, ref. http://arnout.engelen.eu/files/dev/l...igQuickScan.pl
Patching the kernel
Preparations.
Manual (diy) Edirol Patch by blablack, ref. http://ubuntuforums.org/archive/index.php/t-908845.html
Manual (diy) RT Patch(Linux Journal video)ref. http://www.linuxjournal.com/video/hy...al-time-kernel
Configure the kernel, (use Gentoo guide...)http://proaudio.tuxfamily.org/wiki/i...owto_RT_Kernel
Compile and install the Kernel
Give apps real time access, install and configure set_rlimits
Run perl script check edit files to comply with script
Reconfigure and compile if required.
Test recording in Ardour with Hydrogen Drums controlled by jackd (not documented yet, but it works for me)
Objective

To achieve real time monitoring of multi track sound recording on a personal computer with
Open Source Software. We will probably have to compile twice or more, until all the
requirements are met, so don't worry if you miss something the first time through.

Current System Hardware

My system, Mandriva 2009.0 official release kde4.1.3(mdv)
Asus M3n78-EH AM2 motherboard,
2x 1gig kingston 800mHz DDR2, AMD64x2 5600+,
Edirol UA-25EX (24/96) usb sound.
nVidia 9800gt 512Mb ddr3 (pci-e x16), Zalman ZM750-HP PSW
numerous usual storage devices.

Find appropriate Kernel, rpm's info and choice

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

http://www.edirol.net/products/en/UA-25EX/index.html

I started with the newest available, from Mandriva cooker, 2.6.28 rc...x86_64.(2009.1)

Once I turned off the on-board sound chip in bios, this kernel allowed the device to work out of
the box. (start-up music found it's way to the speakers, without configuring)

But I want Real-Time support!

The new kernel has the Edirol devices already installed. But I want Real-Time support.
I could not get a real-time patch for the new kernel, and to make one is out of my league.

Mandriva has RT type kernels available in .rpm packages from the contrib
and contrib/updates repositories. The real-time patched vanilla kernel...
kernel-rt-source-2.6.26.8-1.rt13.1mdv

The tmb kernel has Mandriva patches and third-party drivers I generally use so I'll start there as a
configuration basis, kernel-tmb-desktop-2.6.26.3-1mdv

Then I will patch the rt-kernel-source with the Edirol patch to get the usb-audio module to
recognise my new sound card.

rpm's info and choice...

The RT kernel is vanilla 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.

kernel-rt-source-2.6.26.8-1.rt13.1mdv.
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. 
NOTE: This kernel has no Mandriva patches and no third-party drivers, only Ingo Molnar 
-rt (real-time) series patches applied to vanilla kernel.org kernels.
kernel-tmb-desktop-2.6.26.3-1mdv.
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. 
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 !!
you can do this (install) on a Mandriva system with smart or urpmi, if you have a current rpm
and urpmi database...(for smart too?) Smart is a package manager, like synaptic,
available from the MDE repos. Ref. http://www.mde.djura.org/index.html (I like it a lot)

Code:
smart install kernel-tmb-desktop-2.6.26.3-1mdv kernel-rt-source-2.6.26.8-1.rt13.1mdv
Code:
urpmi kernel-tmb-desktop-2.6.26.3-1mdv kernel-rt-source-2.6.26.8-1.rt13.1mdv
Note: I did not install the rt-kernel rpm, just the tmb-kernel and rt-kernel-source rpms,
to save on downloads and to keep the “Mandriva tweaks and proprietary drivers”.


Quote:
RT= to bring hard real-time scheduling capabilities to the Linux Kernel,
with worst case latency and code execution in the tens of micro seconds.
(Linux Journal video)ref. http://www.linuxjournal.com/video/hy...al-time-kernel


Note: I use the video also in manually patching the kernel with an rt patch and
setting rt access for the programs. I used that video and this perl script (next) to set up
my system for jackd.


I used a perl script to check my system,

By following this perl program, I found what I needed to change for optimum Audio Response

Check the system with “realTimeConfigQuickScan.pl” (found here)...

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

perl script to report if you need to adjust ticks, or smp, etcetera.

you can run it from another shell terminal, (Konsole has tabs like firefox)
and it just reports to screen what needs to be done. Beautiful!

You can use the shift+PageUp or shift+uparrow to scroll back up the page.
Make a list, although they wont all be kernel config changes, It checks for several things,
Quote:
Checking for Ingo Molnar's Real-Time Preemption, Checking for tick less 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 (inotify max_user_watches), Checking for resource-intensive background
processes, like kpowersave.
We'll run this check again later to be sure we have everything in it's list. “to be sure, to be sure!”

Patching the kernel...

Preparations.
Patch the kernel with the Edirol patch.
Patch the kernel with the RT patch.

Preparations

Before I configured the kernel it needed to be patched and hacked a bit,

I edited the lines in the new Makefile to reflect the name I wanted to use for my kernel...

and added the Edirol patch to the RT kernel....

vi is a handy editor, We need admin rights to “save these files here”...

su (enter root password)

vi /usr/src/linux/Makefile

Quick vi tute
Code:
vi is operated in a shell, like Konsole or term

	Quick keys...

	I = insert “edit mode”
	Esc = exit mode/s
	:w = write
	:q = quit
	:wq! = force write quit (does not always over-ride the admin permissions)
/usr/src/linux/Makefile (Only showing the top 5 lines or so)...
Code:
	VERSION = 2
	PATCHLEVEL = 6
	SUBLEVEL = 26
	EXTRAVERSION = -music.8-1.rt13.1mdv
	NAME = GamesBox.GlennsPref.net
uname -a reveals the details of the running kernel (reflected from the installed kernel),
I don't want them all named “x.x-x-custom-x.x”,
I like task names more than reference numbers in my boot loader,
less geeky, more task oriented.

uname -a
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$
Patch the kernel with the Edirol patch.

Copy the lines from the code box below to a file named /usr/src/linux/sound/usb/Edirol
-patch.diff

Change to the directory and run the patch...

cd /usr/src/linux/sound/usb
sudo patch < Edirol-patch.diff

Note:
When tested (25-01-2009, 12:09), the response was “patching file usbaudio.c
Reversed (or previously applied) patch detected! Assume -R? [n]”
I [ctrl+c] to kill the process (exit). I believe the process of how and where to patch the
kernel is concise now.



The Edirol UA-25EX Patch code...
ref. http://ubuntuforums.org/archive/index.php/t-908845.html

Copy all text in the next frame...(except the words, code ;-)
Code:
Add Alsa support for Roland Edirol UA-25EX in Advanced mode
(for MIDI support and sample rates of 48 kHz and 96 kHz)
usbquirks.h
================================================== =================
diff -u sound/usb/usbquirks.h.00 sound/usb/usbquirks.h
--- sound/usb/usbquirks.h.00 2007-11-28 02:15:11.000000000 -0700
+++ sound/usb/usbquirks.h 2007-11-28 02:17:51.000000000 -0700
@@ -1311,6 +1311,37 @@
}
},
/* TODO: add Edirol MD-P1 support */
+{ /*
+ * This quirk is for the "Advanced" modes of the Edirol UA-25EX.
+ * If the switch is not in an advanced setting, the UA-25EX has
+ * ID 0x0582/0x00a4 and is standard compliant (no quirks), but
+ * offers only 16-bit PCM at 44.1 kHz and no MIDI.
+ */
+ USB_DEVICE_VENDOR_SPEC(0x0582, 0x00e6),
+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+ .vendor_name = "EDIROL",
+ .product_name = "UA-25EX",
+ .ifnum = QUIRK_ANY_INTERFACE,
+ .type = QUIRK_COMPOSITE,
+ .data = (const struct snd_usb_audio_quirk[]) {
+ {
+ .ifnum = 0,
+ .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ },
+ {
+ .ifnum = 1,
+ .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ },
+ {
+ .ifnum = 2,
+ .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ },
+ {
+ .ifnum = -1
+ }
+ }
+ }
+},
{
/* Roland SH-201 */
USB_DEVICE(0x0582, 0x00ad),

Tip:
Always leave a blank line at the end of config files, so the shell program (zsh, bash, etc)
knows it's a valid end of file (eof). Ensure when you compile your kernel to activate the
module snd_usb_audio [USB_AUDIO]. When you lsmod, it should be in the list.


If you have the RT kernel-source installed, your free to build the kernel, you may need to do
this again, it's ok, it's just time. I had to do the config twice or more before I completed the
exercise, but I think we'll just install each part once. You should still be in the /usr/src/linux
directory.

Type...
make xconfig
go to Device Driver->Sound->Alsa->USB devices and activate the module USB-Audio
(by blablack)

Check with the perl script to be sure...

Quote:
reference pages...
Patch the kernel with the Edirol patch if required, by blablack,
http://ubuntuforums.org/archive/index.php/t-908845.html
The kernel patch Edirol FA-4x and UA-25ex From the Ubuntu forums...
http://ubuntuforums.org/showthread.php?t=855327
http://ubuntuforums.org/archive/index.php/t-855327.html
links to this alsa wiki page...
http://alsa.opensrc.org/index.php/Edirol_UA-4FX
Which links to the previous ua-25 page.
http://alsa.opensrc.org/index.php/Ed...ce_information
Next is the rt kernel patch...
Note: You only need to do this if you have not installed the rt kernel source from the rpm,
as mentioned above, if you did you can skip this Patching section and continue on to the
configuring the kernel section of this document.

Patch the kernel with the RT patch

manual patch method,

from the video. (includes applications rt permissions and access with set_rlimits)...
http://www.linuxjournal.com/video/hy...al-time-kernel

download and patch any rt diffs.
I could not find a real-time patch for the new 2.6.28.x-kernel at...
http://rt.et.redhat.com/download/


You might find that you need to revise what kernel .ver you need to use, as I did,
Once I realised this I used the rpm method instead. Same versions, less work and the
“Mandriva tweaks and proprietary drivers”.

Download the patch (a .bz2 file in this case)to an appropriate place...
/usr/src/linux/patch-2.6.26.8-rt13.bz2 (or whatever version you require)

cd to the src dir (or where you saved the file to)...
cd /usr/src/linux

run bzip2 -d for the .bz2 file to unpack it in the src directory...
bzip2 -d patch-2.6.26.8-rt13.bz2

Now patch the kernel by running...
patch -p1 < patch-2.6.26.8-rt13

Now you're ready to configure the kernel, which will bring the patches to fruition
and allow for making other changes (the perl script suggestions).

Configuring the kernel

We'll need to configure further, We'll integrate the patch, type...
cd /usr/src/linux

running make oldconfig will only ask NEW questions not answered in the old (current) config
file.(/boot/config)...
make oldconfig

say yes to the real-time preemption question, preempt_rcu and preempt_rcu_Boost and any deps
(none I noticed).

You can say no to the others or leave them as dynamic loading modules. (depending on the age of
this document, Jan2009)

Some questions may be debugging apps, but generally you really won't want a lot of low level
apps running taking notes and writing reports while you're trying to record and sequence sounds.
So you can probably leave the debugging and kernel hacking out or unchanged if you like.
I turned off “Kernel_Debugging” as a whole.

This Gentoo guide is concise, (ignoring distro centric commands and) look for the selections to change in the kernel.
http://proaudio.tuxfamily.org/wiki/i...owto_RT_Kernel

Once that is finished, you can run the build sequence...

Another way to do this is with with a GUI, make xconfig or make menuconfig you can get right
down to the nitty gritty of selections, with a search function, with your mouse and you can
browse around. :-)

cd /usr/src/linux

Note: I would run “make oldconfig” first, answering the questions then save. Then...
make xconfig or make menuconfig.

check to see if rt has been enabled,
Search for “real-time preemption” and “preempt_rcu” and any deps (preempt_rcu_Boost),

you can probably leave the debugging and kernel hacking out or unchanged if you like.

Make sure the snd_usb_audio module is loaded in the config.[USB_AUDIO]

I also look for spcaxxx module for my webcam, and option module for usb_storage
“usb hdspa modem”.
I check to see if the agpgart modules are dynamic not static for my amd/nVidia combo.
I also check for write access to ntfs file systems.

Save your config then exit the xconfig app.
make sure you save the config file with the save button/icon and exit xconfig program.

That should save the config file to the default place... /usr/src/linux/somewhere.
You'll see on the shell, “saved config file to....”(Be sure you know where it is).

Config complete.

Compiling the kernel
Note: The rolling of the kernel (compiling) takes longest, up to 2 hours on most machines
It has been recommended to me not to run any other memory or filesystem intensive
applications on the system while the compiling is being carried out.

Otherwise type...
make all && make modules_install && make install

Note: make all, this does... make dep && make clean bzImage modules

Reboot selecting the new kernel, should be automatic with grub2 Mandriva system...
Shutdown -r now

Note: If you want this to run during the night, let say, and to shut down automatically
when the process is complete, type this instead...
make all && make modules_install && make install && shutdown -h now

Then go to work, or bed and check it when you return.

If you get errors, or stoppages, please ask before you reboot to the new kernel, you can always
fall back to the old kernel if you have booting problems.

Other than the package manager references, this is a good guide for any distro...IMO
Gentoo guide...
http://proaudio.tuxfamily.org/wiki/i...owto_RT_Kernel

Compile complete.

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

Hyper_Low-Latency_Audio_with_a_Real-Time_Kernel_Linux_Journa.flv
ref. http://www.linuxjournal.com/video/hy...al-time-kernel

To configure the system applications use the alsa examples...
http://alsa.opensrc.org/index.php/Ed..._system_rights


Get set_rlimits...(set_rlimits is only one of a few programms that enables this type of functionallity)

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 privileges

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),
Note: you should be a member of that group.

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

/etc/set_rlimits.conf
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 /	=-1	rtprio=		memlock=
@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 (if ardour complains about memory limits)
Code:
@audio - rtprio 99
@audio - memlock 500000
@audio - nice -10
/etc/sysctl.conf for …
Code:
#checking inotify max_user_watches... too small. For Real-time 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

I also preceded the music programs commands with this as well, by editing the icon properties.

Type in set_rlimits jackd to start the server from a prompt.

Check with the video and perl script to check everything is as it should be. There are references to
some of the pages I have trolled through to assemble this document, and you can check those for
configuring the kernel, Alsa, and checking the hardware.

Repeated links from above...
Kernel http://proaudio.tuxfamily.org/wiki/i...owto_RT_Kernel

Alsa http://ubuntuforums.org/archive/index.php/t-908845.html
Contributed to by the Ubuntu community and Blablack in particular

Note: The UA-4FX page has more command line utility examples for debugging.
http://alsa.opensrc.org/index.php/Edirol_UA-4FX

Which links to the previous ua-25 page.
http://alsa.opensrc.org/index.php/Edirol_UA-25
http://alsa.opensrc.org/index.php/Edirol_UA-25EX


Outcomes
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 drop-outs in the audio chain,
X runs...

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 x runs
(x runs = audio-processing lock-ups causing drop-outs, caused by resource scheduling).

I try to get in a habit of using one resolution most of the time,
after all, CD quality is still 44.1kHz/16bit.
:-)

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

After going through all of this, you won't want Mandriva Automatically Upgrading
your kernel for you.
To change this behaviour for urpmi (and drakrpm?) go to /etc/urpmi/skip.list
Use the config help in that file, /^kernel*/ you need to be root to save it.
Smart has a version lock, where you can lock packages by version from the smart GUI, nice.


So we have not covered installing the programs, but I figure there's other documents about that already.

I used Audacity to check the audio recording and playback systems during the kernel configs.
(without jackd running)

Thank you to the contributors of Alsa, Ubuntu, Linux Journal Magazine, www.atomicmpc.com.au
and www.LinuxQuestions.org and you too (for reading).

I have tried to reference others work where I could, and give credit where it is due.

I apologise for any omissions, and accept any useful criticism, amendments will be made as they
become available and or relevant.

Thank you
Regards Glenn (GlennsPref) 27/01/2009
 
  


Reply

Tags
audio, realtime


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
using phonic firefly 302 (firewire audio card) on mandriva 2009 kidsil Linux - Hardware 8 01-03-2009 10:08 AM
O Mandriva One 2009 how does one set up a HP DeskJet 6940 Network printer? Cristobal Linux - Newbie 2 12-29-2008 04:18 PM
want to set up an install to run ardour vertigo88x Slackware 3 05-11-2008 07:58 PM
Audio interface for Ardour 2 hitchface Linux - Hardware 2 09-28-2007 12:01 PM
Linux Audio: Connecting Rosegarden to Ardour via qjackctl? mikejedw Linux - Software 0 08-19-2004 02:01 AM


All times are GMT -5. The time now is 10:34 AM.

Main Menu
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