|
|
Subscribe / Log in / New account

Realtime group scheduling doesn't know JACK

Realtime group scheduling doesn't know JACK

Posted Dec 21, 2010 18:43 UTC (Tue) by drag (guest, #31333)
In reply to: Realtime group scheduling doesn't know JACK by jimparis
Parent article: Realtime group scheduling doesn't know JACK

> To solve the problem of buffer underruns, you need to increase the size of your buffers. If you cannot increase the size of your buffers due to latency concerns, or if you have hardware limitations, _then_ I agree you need realtime. But it seems to me that the vast majority of "I'm getting xruns with jack, I need realtime!!"

No.

With Linux without realtime configuration you can't make your buffers large enough to avoid xruns, unless they are very large, because your not able to control your latencies.

That's the point. Realtime gives you control over the latencies. Of course Linux can't give you hard realtime, but certainly the level that Linux can provide when properly configured is enough for audio production.

> In some of my research work, we deal with streaming data from various capture cards at relatively high rate (up to 2Mbit/s). We write it directly to disk on a relatively busy system that can go out to lunch for 500ms or more. The only time I ever had to invoke SCHED_FIFO was with some poorly-designed USB hardware that only had a 384 byte buffer. Now we design our hardware with at least 1MB buffer and the kernel scheduler is no longer a concern.

Does your data corrupt and get nasty artifacts when you get latencies up to 500msecs? Because that is what happens with audio streams. You not just dealing with recording data to disk, your interacting with the real world that won't be able to wait on your computer to respond...


to post comments

Realtime group scheduling doesn't know JACK

Posted Dec 21, 2010 19:46 UTC (Tue) by jimparis (guest, #38647) [Link] (5 responses)

> Does your data corrupt and get nasty artifacts when you get latencies up to 500msecs? Because that is what happens with audio streams. You not just dealing with recording data to disk, your interacting with the real world that won't be able to wait on your computer to respond...

No, it doesn't corrupt. And it's real world data coming in. And I also didn't have any corruption or artifacts when I had 500msec latency when I was running a MythTV backend recording two streams of live television simultaneously. And I can play DVD video just fine even though my old DVD-ROM drive has seek times on the order of 250ms. Etc, etc.

That's my whole point -- there is a whole world of other systems that (to me) seem much more demanding than audio processing, like video input and output, and gaming, that don't seem to have the realtime requirements or problems of JACK. I'm trying to understand exactly what the audio use cases are that make processing 48 KHz data so difficult. And it seems like the answer is the specific case of live looping back audio from input->output which needs low latency.

Realtime group scheduling doesn't know JACK

Posted Dec 21, 2010 21:25 UTC (Tue) by tialaramex (subscriber, #21167) [Link]

Not just audio input, any case where input passes through the JACK system to become output. That's what latency is! For example, from thumping the concert A on a MIDI keyboard to hearing the sound from the software instrument. The larger the buffer, the longer it takes.

Or consider DJing. Suppose we just have a 2 second buffer. So I hear the end of track A, there's a boring instrumental lead out, I want to play track B - must I wait 2 seconds before it begins? That's a long time. OK, so maybe we provide the DJ a separate mix. Now I can hear where track B will start playing, but it takes 2 seconds before I hear my own decisions. This is very difficult to work with.

You can play with this, if you have lab audio equipment, create a 2 second delay audio loop, where what you say is recorded and then played back quietly through headphones (so it doesn't feed back). You won't be able to hold a conversation properly, because you must concentrate very hard just to override a built-in audio-cognitive mechanism that tells you you're being interrupted. Reduce the loop to 15ms. Now it's fine. The much shorter delay resembles environmental echo, which was present when our audio cognition evolved. Latency matters.

Realtime group scheduling doesn't know JACK

Posted Dec 22, 2010 12:25 UTC (Wed) by drag (guest, #31333) [Link]

> That's my whole point -- there is a whole world of other systems that (to me) seem much more demanding than audio processing, like video input and output, and gaming, that don't seem to have the realtime requirements or problems of JACK. I'm trying to understand exactly what the audio use cases are that make processing 48 KHz data so difficult. And it seems like the answer is the specific case of live looping back audio from input->output which needs low latency.

It's not just _LOW_ latency.

Realtime configurations give you the ability to _CONTROL_ latency.

That's the point.

Often stuff running realtime will have significantly worse performance then if you had them in the normal configuration.

Linux is designed to provide high throughput and work efficiently under high loads. The design choices and compromises that goes into making Linux behave well and perform well under high loads is COUNTERPRODUCTIVE to providing good realtime performance.

It's not a question on how demanding the workload is, it has to do with your ability to control how often something happens and when it happens.

THAT is what realtime performance is about. Not making your system work faster, quicker, or perform better... it's just a question of being able to control latencies. Without realtime configurations you can see latency spikes up to 250msec or more on a regular basis for Linux. It's just a nature of the beast.

And of course even with Linux in 'realtime mode' it's not perfect and can't guarantee you with 100% latency control.. Linux is far too complicated for that, but it does help tremendously.

Realtime group scheduling doesn't know JACK

Posted Dec 22, 2010 20:09 UTC (Wed) by jrigg (guest, #30848) [Link] (1 responses)

>I'm trying to understand exactly what the audio use cases are that make processing 48 KHz data so difficult.
If you're processing a lot of tracks simultaneously the throughput can be quite high. In film soundtrack work it's not uncommon to be working with a hundred or more tracks at once.

Realtime group scheduling doesn't know JACK

Posted Jan 6, 2011 19:38 UTC (Thu) by xorbe (guest, #3165) [Link]

Dude. Let's run the numbers on something crazy, like an 8 channel audio with insane bitrate and huge number of streams.

192000 samples/second * 8 movie channels * 4 bytes/sample * 128 streams / 1048576

That's a whole 750MB/s ... my desktop computer has 30GB/s dram bandwidth. For the highly more common 48K * 2 ch * 2 b/sample * 32 streams, the bandwidth is a pathetically small 6MB/s.

The fact that the Linux kernel can't natively handle mixing a few audio streams for the average desktop user without trotting out the anti-DoS argument is silly.

Realtime group scheduling doesn't know JACK

Posted Dec 23, 2010 6:37 UTC (Thu) by omez (guest, #6904) [Link]

Depending on your game, you can easily replicate the problems JACK is suffering. A player can learn to see past consistent quarter-second network latencies in a fast paced game. If the apparent latency changes because the kernel wants to contemplate its navel for 100ms, however, all bets are off. You will be a sitting duck, fragbait.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds