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 |
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 :) |
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:
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 Code:
kernel-tmb-desktop-2.6.26.3-1mdv - Linux Kernel for desktop use with x86_64 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 to save on downloads and to keep the “Mandriva tweaks and proprietary drivers”. Quote:
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:
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 Code:
VERSION = 2 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) 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 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:
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:
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 Code:
@audio - rtprio 99 Code:
#checking inotify max_user_watches... too small. For Real-time Audio... 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 |
All times are GMT -5. The time now is 03:12 AM. |