Monday, December 19, 2011

Tutorial: Load & Loop Samples

Hey all,

This tutorial will show you how to load a sample into memory, and then play it back trough a JACK port, continually looping. There's not really that much to it, just a bit of thinking of the order things happen, and arrays.

If you've read the "Writing a sample" tutorial, you'll already be familiar with LibSndFile, the library we use to read / write samples, so there's nothing too hard to handle :)

Check out the source here:

Any queries / suggestions, you know how to get to me :) -Harry

Saturday, December 17, 2011

Arch Linux : The quest for a minimal system with maximal RT performance

Hey All,

My install of TangoStudio is getting old, and its repos are getting polluted with conflicts & nastiness, that means a reinstall! So a quick bit of searching for a minimal yet configurable, RT capable and rock-solid led to some intresting distro choices.

TangoStudio - Worked well enough ( 30ms lowest lat on stock kernel )
64Studio - a touch oudated by now, but it was always very good
Pure::Dyne - personal favorite for a while, also gone a touch out of date
Gentoo - probably not good for a non-kernel hacker type... but then

Arch has been a distro I've tried a couple of times because I love the sound of it:
Arch Linux, a lightweight and flexible Linux® distribution that tries to Keep It Simple.
However any time I tried it I had been put off by its "initial configuration" that needs doing before you can get yourself online to look at some forums / wiki's for help!

So off I went, download the 380mb ISO, install it on a seperate partition, get going. You get a minimal system that drops to a root prompt on install, and "startx" isn't going to help much untill you install you video driver packages etc. Note this can be done during install but I opted not to, as I wanted the control to select only needed packages.

So after a bit of haggling with the X server, reading some wiki entries using the text only webbroswer links, and installing the "slim" display manager, messing with /etc/inittab and ~/.xinitrc there's a system up and running, straight to a graphical logic screen (with awesome "darch-white" theme") and then to a barebones LXDE desktop with OpenBox as WM.

The speed of the menu's & actions in unreal, it feels like its there before you clicked. Some small issues with ugly themes and nasty font's were quickly ironed out using lxapperance.

Couple of "nasty" little things:

Then on to the audio side of things:
There's a project called ArchAudio, who are maintaining lots of up to date software for audio / multimedia purposes, you'll want to install that repo: has all the info you'll need!

I'm a JACK1 user, so first thing I wanted to do was install that:
the "Extra" repository has a build of 0.121.3, so a simple pacman -S extra/jack1 done the trick. FFADO installation for my Echo AudioFire was quick and painless: pacman -S libffado That installs your needed library, the ffado-mixer, ffado-test etc programs, and sets up the privelidges so that you can run JACK in RT mode.

If you want to use this install as your "daily", you'll need to install a mountain of stuff, things like gtkmm,flashplayers, media players, codecs, etc. But if you want to run audio... no need. Actually you'd be better off without that stuff.

The end result:
A system that will run JACK @ 4ms latency, 192kHz samplerate, with a *non-RT* kernel. That's currently still compiling, and I'm hoping to squeeze another ms or 2 off the RT_PREEMPT & IRQ tuning (& IRQ threading.. but that's dangerous territory AFAIK!)

So far I'm very satisfied with Arch and its amazing documentation :)
Will keep this up to date with the RT kernel progress & latency tuning,