[music-dsp] diy dsp synth - where to start?

David Olofson david at olofson.net
Tue Jan 20 09:48:01 EST 2004

On Tuesday 20 January 2004 16.21, Jimmy Myhrman wrote:
> That is a good idea, which I have been considering too. However,
> being a windows user, I don't know much about those realtime linux
> distributions, nor would I be able to quickly set up and/or
> configure such a linux box. If you have experience with RT-Linux,
> would you consider it easy to get started with development on such
> a system?

Actually, that's how I got into Linux; from inside the kernel, playing 
around with RTLinux. I was looking for an RTOS and found my 
workstation OS of choice, and a whole culture in the process. :-)

Anyway, there is a bunch of of RTLinux and RTAI "single floppy" and 
other compact distros these days, that fit perfectly in an embedded 
system, running from a CompactFlash disk or similar. There are tiny 
libc implementations, lightweight versions of the most important 
command line tools, small C compilers, small shells and whatnot; just 
pick what you need, or grab a distro with all the standard stuff to 
get started quickly.

If you have a few hundred MB of flash (or a hard drive), you could 
just use a minimal install of a standard Linux distro - Mandrake, Red 
Hat, SuSE, Debian, Gentoo, LFS, etc in approximate order of 
decreasing newbie friendliness - and install a precompiled 
lowlatency, RT-Linux or RTAI kernel. You can use both lowlatency and 
RTL/RTAI, to get user space "ms class" RT + kernel and user space "µs 
class" RT.

The problem with an RTL or RTAI based solution is that you can't 
access the standard Linux drivers directly. However, though people 
have written or ported some sound card drivers for RTL and/or RTAI (I 
have an old one for the AudioPCI chipset lying around), it should be 
possible to set up a sound card in "shared memory" mode and then sync 
a real time periodic thread with the IRQ.

However, unless you're going for sub ms digital latency, I'd recommend 
you stay with the standard drivers and a lowlatency kernel. That way, 
it's plain application hacking, and there's no need for special 
drivers and/or kernel hacks. You should still be able to get the 
latency below 3 ms on most hardware. For two totally audio and 
multimedia focused distros, have a look at DeMuDi (Debian based) and 
RehMuDi (Redhat based) here:


> (assuming you're already familiar with GCC)

That would help, but I hadn't been near GCC, and I had only minimal 
experience with Solaris before I got into Linux. Hacking under 
RTLinux was the easy part. Pretty much like hacking under DOS - only 
easier, and you have both hard RT threads and a whole "general 
purpose" OS when you need it.

> Or do you
> really have to know your unix and configure all sort of stuff
> before it could be useful for a synthesizer application?

Not really. You *can* run without most of the user space stuff 
(scripts, daemons and stuff, and their config files) and (ab)use the 
Linux kernel pretty much as a DOS extender on steroids or something; 
ie just something that loads your software and provides threading, 
memory management, drivers, file systems, low level network access 
and stuff. (And hard RT scheduling, if you have lowlatency, RTL or 
RTAI in there.)

Or you can just install one of these small RT distros and hack away. 
You don't really need to care about they typical Un*x configuration 
stuff, unless you're actually going to use it.

You can even have a full desktop or server OS installed on top of your 
RT kernel, with web servers and stuff running. That's all in user 
space, and doesn't have any significant effect on the scheduling 
latencies of RTL or RTAI.

Linux/lowlatency is similar, but probably not quite as hard RT as RTL 
or RTAI, as a result of it's design. (Countless ways system events 
might interfere, whereas in RTL or RTAI, the whole Linux kernel - 
drivers, ISRs and all - run as the lowest priority RT thread no 
matter what.) Rock solid audio processing with sub 3 ms latency, 
while stressing the system so hard the desktop and consoles will 
hardly respond, is quite possible, though.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---

More information about the music-dsp mailing list