Archive for the ‘My Music’ Category

Filed Under (Geekstuff, Linux, My Music) by Sean on March-3-2008

This is a follow up to the previous post located here.

Well I finally decided to get down and dirty once again and dive into the innards of real time kernel tuning. As I reported last time, I was getting some latency which was evident through the sound card as a very nasty buzzing sound. Here I’ll report some basic findings which hopefully will help anyone attempting to set up a real time system set up for use as a DAW.

My system is running Ubuntu Gutsy Gibbon. You may recall where I had some serious trouble installing the Ubuntu Studio real time Ubuntu kernel; the initrd image was severely anemic to the point where I couldn’t even boot up. Instead, I decided to download the latest kernel source and roll my own so I knew everything would be just the way I wanted.

Before I go into the step by step process of how that was done, allow me to report some updated findings that may clear up some confusion. One issue is deciding what method to use to grant realtime scheduling to users (so you don’t have to run programs as root, which is a very bad idea). The old way of doing things was to use the realtime-lsm kernel patch and module. The problem I was running into with this method along with the latest 2.6.24 kernels is the fact that you can no longer configure your kernel with CONFIG_SECURITY_CAPABILITIES as a module! The kernel maintainers have decided that it introduces some serious security vulnerabilities, so the only options now are built into the kernel or not at all. This is a serious problem when using realtime-lsm since presumably the capability module does not support stacking and needs to be unloaded when the realtime-lsm module is loaded. This is not completely true as pointed out by the Debian Kernel Team, but the realtime-lsm module patches I was using have not been modified to correct this. In any case, realtime-lsm has been deprecated in favor of the newer PAM rlimits method of granting realtime scheduling priority to userspace programs. It is important to note that realtime-lsm will still give you superior performance over the rlimits method for really heavy multimedia work, but in 99% of cases the rlimits method should suit most users just fine. The rlimits method works by configuring priority scheduling limits in /etc/security/limits.conf.

Let’s get to the meat of how I configured my system. I’m going to list all the steps in order with a very brief explanation of each.

First we get the latest kernel source tarball. In my case this was 2.6.24.3.

wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.xx.tar.bz2

Then we get the latest realtime kernel patch. Make sure the patch version matches your kernel version above. Get the latest rt version if there is more than one for your kernel. In my case this was patch-2.6.24.3-rt3.bz2.

wget http://kernel.org/pub/linux/kernel/projects/rt/patch-2.6.xx-rt.bz2

Copy the files to your kernel source tree, un-tarball them and patch the kernel. Be sure to use the proper version numbers below in place of these as applicable from your download.

cd /usr/src/

tar zjfv ~/linux-2.6.24.3.tar.bz2 linux-2.6.24.3 .

ln -s linux-2.6.24.3 linux

cd linux

bzcat ~/patch-2.6.24.3-rt3.bz2 | patch -p1

Get your current working config if you have one.

zcat /proc/config.gz > .config

or

cp /usr/src/linux-`uname -r`/.config ./.config

From the existing .config, if you have one, update the settings from it. If there are any new features from the last config file, you may be asked some configuration questions.

make oldconfig

Get your favorite editor out and modify the config file to match the following settings. If they don’t exist just add them to the end of the config file. Another option is to make menuconfig (or xconfig, gconfig, config, etc.) and set the values that way.

vi .config

HIGH_RES_TIMERS=y

PREEMPT_RT=y

HZ_1000=y

RTC=y

SND_RTCTIMER=y

SND_SEQ_RTCTIMER_DEFAULT=y

Now we can recompile and install our kernel. Below is the Debian/Ubuntu way of doing it. You can use the old school make && make modules && make modules_install technique as well. The Debian way does it all for you and packages the kernel image and headers as .deb packages in /usr/src and even installs the new kernel into GRUB!

make-kpkg --initrd --append-to-version=-rt_custom kernel_image kernel_headers

dpkg -i ../*deb

Now we grant realtime scheduling to the user group audio. Be sure your user account is part of this group. Here we set a max priority of 99 (RT), nice value of -10 (not very nice :) ) and memlock value of 512MB.
sudo cat "@audio - rtprio 99" >> /etc/security/limits.conf
sudo cat "@audio - nice -10" >> /etc/security/limits.conf
sudo cat "@audio - memlock 512000" >> /etc/security/limits.conf

Verify everything looks good in GRUB and reboot. Verify you’re running the new kernel. Look for PREEMPT RT in the version.

uname -ar

Linux ubuntu 2.6.24.3-rt3-rt_custom #1 SMP PREEMPT RT Sun Mar 2 22:06:11 CST 2008 i686 GNU/Linux

Great! Now you can run qtjackctl and select the appropriate realtime setting. You can launch your other studio applications with these settings as well and modify them in real time using the chrt command. You can check on the status of a process with ps -eo rtprio,comm.

ps -eo rtprio,comm | grep jack

chrt -p 99 <process id>

I will follow up with some more details and howtos regarding working with your DAW. Feel free to comment below if you have any questions or email me using the email icon at the top of the page. Enjoy!



Filed Under (Geekstuff, My Music) by Sean on February-19-2008

Wow . . . I certainly didn’t anticipate the difficulty I was going to face trying to get all the software set up and configured on my shiny new Digital Audio Workstation.

You see, it’s all about real time computing. Since normal, every day Linux is based on a voluntary preemptive kernel (as are all other regular OS-es), it is not suited to the demands of a professional DAW. The various software components of the DAW have to sync perfectly and in real time. The sequencers, synthesizers, mastering software, loops, keyboards connected though MIDI and audio, all have to exactly sync up with near zero latency if you’re going to have anything that sounds worth a crap come out the other end.

UbuntuStudio was created with this in mind. It has the real time kernel included, all the DAW software and components that tie it all together (the zero latency plumbing is called Jack). I had already installed Ubuntu Desktop (Gutsy Gibbon to be precise) so I followed the instructions to upgrade. Well something definitely went awry with that process. For some reason, the install of the rt kernel totally futzed up my initrd image to the point where it didn’t detect my hard drive. Suffice it to say that makes it difficult to start mastering any recordings!

I first attempted the usual fixes, including yaird, initrd, initramfs tools, to no avail. I went back to my default kernel and went ahead and launched all my DAW software anyway, setting up Jack with options so it would ignore the latency problems. I just wanted to see how the applications worked in general. Everything ran, albeit not synced in real time.

So, I decided to roll my own kernel from scratch, pulling it from kernel.org, patching it with the realtime kernel patch, choosing the appropriate kernel options, and compiling. After a few false starts (didn’t quite get all the correct options in the menuconfig the first couple of times) and a few hours, I had a kernel that finally booted! Finally my optimized, preemptive realtime kernel:

$uname -ar
Linux sean-desktop-home 2.6.24-rt1-rtsbs #1 SMP PREEMPT RT Mon Feb 18 22:25:02 CST 2008 i686 GNU/Linux

Of course now that I was no longer using the restricted mode NVidia drivers to get hardware acceleration (i.e., the restricted module doesn’t match the kernel version; I’ll have to download and compile module from NVidia), I didn’t have a working X server. A simple dpkg-reconfigure xserver-xorg later and I was off and running. Click on the image below to see it in action.

My DAW on Ubuntu

I still was getting xruns on Jack, but my SBLive card has issues anyway. Sometimes the synthesis or even regular sound files sound like ass; it is a 4 year old card that cost $20 so I can’t complain. I guess I’m going to have to shell out for the E-mu 1212M I’ve been eying and get down to business. I suspect that will solve a lot of my problems. Who knows, I may even finally get some of my music uploaded as promised. Stay tuned for more updates (and more late nights) soon!



Filed Under (Geekstuff, My Music) by Sean on February-17-2008

So now that I’ve decided I’m going to get serious about releasing the music I’ve composed for the better part of the last 25 years (and still write), I’ve been going through the process of learning as much as I can about Digital Audio Workstations (DAW). I’ve certainly played around with ProTools and other DAW software over the years but I really wanted to move everything to 100% open source running under Linux (see my previous article about moving exclusively to Ubuntu on all my systems). It appears the time has come for that to become a reality. I’ll be writing here about my experience in getting my DAW set up so others will gain from it. Here is the very rough list of the components of my DAW:

I still need to purchase either a good full-size electric piano or steal my mother’s Steinway Grand I had the privilege playing growing up. :) Another idea is to get a good, 88-key, weighted midi controller and use sampled sounds. I have written and arranged lots of multi-timbred works but much of my continuing composition these days is solo piano.

I will keep you posted on my continuing efforts. Also stay tuned for some initial recordings coming very soon!

(UPDATE) See http://www.seanstoner.com/blog/2008/02/19/linux-studio-chapter-ii/ for the follow up to this post.



Filed Under (My Music) by Sean on February-16-2008

The rain outside has me feeling calm with a touch of melancholy. I’ve fired up the espresso machine so I can make myself a latte. I think the weather has also lent me a great deal of creativity; I’ve composed three new piano pieces in the last couple of hours. I’m calling the melancholy one February. Listening to the rain, I sat down at the piano and it just poured out of me onto the keys. I hope to record and upload it later this evening. Perhaps, if it’s raining where you are, it will express your mood too.