sound driver for RTAI

Paolo Mantegazza mantegazza at aero.polimi.it
Fri Jul 29 14:03:59 CEST 2005


Michael Beckinger wrote:
> Hi,
> 
> I want to use a professional soundcard with RTAI. The application is 
> similar to a audio mixing console running on a PC. The DSP algorithm 
> running on the PC is very calculation power consuming. The maximum IRQ 
> latency time should be less than 1-1.5msec to minimize throughput 
> latency of the mixing console. (48 KHz sampling frequency, 64 samples 
> buffer)
> 
> So here are my questions:
> It seems that there is no hard realtime soundcard support in RTAI?
> 
> How could I port an ALSA driver to RTAI?
> 
> Is there any documentation on writing an RTAI hardware driver available?
> 
> 
> Some guy on the music-dsp mailinglist wrote to this topic:
> 
> "However, in the case of soundcards, you can probably get away with
> setting the card up in DMA mode and hook into the soundcard's IRQ
> with an RTL/RTAI ISR. That way, you're using the standard Linux
> (OSS/Free or ALSA) driver to set up the audio I/O, but once it's
> running, you're only using the IRQ and the DMA buffers. You just put
> your RT code in an RTL/RTAI periodic (timer driven) thread, and
> adjust the timing based on the IRQs, so you can update N fragments of
> the DMA buffer per soundcard IRQ."
> 
> Is this a possible way to proceed?

If you mean having an interrupt at 48 KHz and use it to launch a task 
directly for due processing then that is what RTAI is for.
Provided you are on a x86 the best way comes with magma. Just copy any 
of its timer handlers, from hal.c, almost verbatim under the 
DONT_DISPATCH_IRQ macro set.

In such a way the interrupt is vectored directly, i.e. neither 
dispatched nor piped, to your handler and you can schedule from within 
it as you like.

The difference is maximaed determinism, i.e. less latency, even if that 
is somewhat naturally embedded in GPP unfortunately, maximised real time 
throughput, more friendliness to Linux (cause you do what you have to 
faster and so let it more time).

That is the way we do active acustic control here at DIAPM, at the 
frequecy you want to use.

Paolo.





More information about the Rtai mailing list