View Full Version : Lowest latency audio out, and midi in under linux for FPC?

27-08-2012, 04:36 PM
Any API recommendations on this -- I need ASIO style latency (50ms or less), in a API that will work under Raspbian or a similar RPi distro. I've tried SDL, and it's not even CLOSE to what I need on the Pi... to get down where I need the buffer size has to be around 128 bytes, which the pi just can't keep up with. I'd like to use Jack, but I can't find any decent API bindings for it and lack the time or ambition to write one... and I'd really prefer NOT to switch to C++... though again, I may end up having to.

... and MIDI under Linux I can kind-of do, but looking for a better way to do it -- and does anyone have any experience/advice when it comes to MIDI over USB on Linux? MIDI on Linux is poorly documented to begin with -- I can't find anything about MIDI over USB at all.

BTW, this would be a command line app, so if you point at something that needs X11 up and running... uhm, no.

28-08-2012, 03:17 PM
Bah, looks like I'm going to end up using GCC and ALSA... I hate C. Hell, the re-re example code for enumerating sound devices in ALSA alone shows why I hate C programmers... and to think most of them have the cojones to say BASIC makes spaghetti code.

28-08-2012, 04:06 PM
Have you tried BASS?

28-08-2012, 04:46 PM
JackD is a low latency audio mixing framework, kind of like a mixing desk for audio applications. It's not a hardware interface but does itself use ALSA etc

It's a kicker because I actually wrote full Jack headers for pascal last year and then lost them when decided to try a new linux distro one day. (they're actually tiny, only took a day or two)

ALSA as far as I'm currently aware has pascal headers in the form of ALSAPAS. They've not been update for a while so you may find some more exotic functionality missing (perhaps with midi etc) but the basic functionality - Audio Buffer cycle etc should be fine.

You're highly unlikely to get ASIO like performance or anywhere near on a raspberry PI. It does however depend on many factors, primary in your case will be the audio chip the PI comes with. inbetween you and the sound-card there are a number of buffers, your apps, ALSA, the hardware etc.

The final latency being a combination of these three, you might have a limit you can't change or you might find that the CPU simply can't process the audio frames quickly enough.

ASIO (to my current limited understanding) is capable of such low latency because A) you're writing directly into the hardware buffer or as close as the drivers will let you B) is set up in such a way that you're writing new data on a knife edge with no OS imposed delays etc note that ALSA, WaveOut, DirectSound etc are designed to provide smooth audio output on a wide range of performance profiles where as ASIO is studio-grade stuff that assumes a fairly quick CPU.


All that said it still may be possible, but I should imagine it's going to be some hardcore direct interface with the sound chip or some special ALSA/Kernel functionality I'm not aware of.

The PI is a popular piece of kit, I should imagine that audio-processing is being pursued by many people so you're definitive answer one way or the other is probably out there by now.

31-08-2012, 08:59 PM
I ended up finally finding an up to date ASLA translation

Probably going to test it on the pi this coming week... Right now I'm knee deep in woodworking a case for a project based around a teensy++

First version is just getting a teensy, the second version is probably going to use a teensy and the pi. I'll be posting up details on said project soon enough.

01-09-2012, 01:16 PM
Nice find there with fpalsa deathshadow. Been looking for something of the sort for all eternity so thanks a ton :)

01-09-2012, 05:17 PM
nice find on the updated headers, thank you! I might do the jack headers again one of the days so I'll post if I do.