linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannu Savolainen <hannu@opensound.com>
To: linux@horizon.com
Cc: linux-kernel@vger.kernel.org, linux-audio-dev@music.columbia.edu
Subject: Re: [OT] ALSA userspace API complexity
Date: Mon, 9 Jan 2006 00:08:24 +0200 (EET)	[thread overview]
Message-ID: <Pine.LNX.4.61.0601082324040.31407@zeus.compusonic.fi> (raw)
In-Reply-To: <20060108071953.17892.qmail@science.horizon.com>

On Sun, 8 Jan 2006 linux@horizon.com wrote:

> Only if you need 10 ms latencies 100.000...0% of the time.  Which isn't
> always the case.
If you are doing audio with 10 ms _buffers_ then you will need smaller 
than 10 ms latencies from the beginning to the end. This is always the 
case.

> The rest of the time, you can do very well by providing a way to supply
> "tentative" data in advance of need, but cancel it and replace it with
> better data when something happens... something explodes in a game, or
> a new person speaks up in an audio conferencing application, or a new MIDI
> event arrives.
You can't predict the future output if you are doing processing on live 
input and playing back the result immediately. In this kind of 
applications you are limited to the latencies the plattform can 
guarantee. There is nothing the audio subsystem can do to make things 
work better so for this reason any time spent on developing such features 
is complete waste of time.

Right. If you can predict what the output could be then you don't need to 
limit the the buffer to 10 ms. You can use much longer buffer and rewrite 
parts of it. 

In reality you can use surprisingly large buffers in applications like 
games and nobody will notice any lags. This is because human brain 
automatically masks them. As you know speed of sound is about 340 m/s. 
Largish delay of 0.1s=100ms equals to distance of 34 meters. This makes 
the distance to the explosion to sound like they occurred 34 meters behind
the actual place. 10 ms equals to just 3.4 meters.

Also in reality getting 10 ms "one way" latencies don't require any 
special tricking with DMA from user land or things like that. Simply using 
short enough buffer is enough. If the game itself is properly designed 
then 10-20ms will work out of box (at least with OSS). This approach has 
been used since the old sasteroids game 10-12 years ago and it's still 
used by the SDL library.

Using sophisticated algorithms that "cannot fail" may be sexy but it's 
pointless because nothing fails anyway.

Best regards,

Hannu
-----
Hannu Savolainen (hannu@opensound.com)
http://www.opensound.com (Open Sound System (OSS))
http://www.compusonic.fi (Finnish OSS pages)
OH2GLH QTH: Karkkila, Finland LOC: KP20CM

  reply	other threads:[~2006-01-08 22:11 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-08  7:19 [OT] ALSA userspace API complexity linux
2006-01-08 22:08 ` Hannu Savolainen [this message]
     [not found] <5rdrx-4Yl-43@gated-at.bofh.it>
2006-01-05 14:01 ` Heikki Orsila
2006-01-05 14:24   ` Jaroslav Kysela
2006-01-05 14:45     ` Heikki Orsila
2006-01-10  9:22       ` Jaroslav Kysela
2006-01-10 11:50         ` Heikki Orsila
2006-01-05 14:51     ` Olivier Galibert
2006-01-05 15:26       ` Alexander E. Patrakov
2006-01-05 15:30         ` Jaroslav Kysela
2006-01-05 16:01           ` Alexander E. Patrakov
2006-01-05 18:11         ` Florian Schmidt
2006-01-05 15:33       ` Jaroslav Kysela
2006-01-05 16:48         ` Marcin Dalecki
2006-01-05 15:27     ` Heikki Orsila
2006-01-05 14:49   ` Alistair John Strachan
     [not found] <4uzow-1g5-13@gated-at.bofh.it>
     [not found] ` <5r0aY-2If-41@gated-at.bofh.it>
     [not found]   ` <5r3Ca-88G-81@gated-at.bofh.it>
     [not found]     ` <5reGV-6YD-23@gated-at.bofh.it>
     [not found]       ` <5reGV-6YD-21@gated-at.bofh.it>
     [not found]         ` <5rf9X-7yf-25@gated-at.bofh.it>
2006-01-04 11:56           ` Patrizio Bassi
2006-01-04 18:07             ` Florian Schmidt
2006-01-04 18:46               ` Alistair John Strachan
2006-01-05 18:59             ` Lee Revell
2006-01-05 20:06               ` Patrizio Bassi
2006-01-05 20:11                 ` Lee Revell
2006-01-05 20:47               ` Patrizio Bassi
  -- strict thread matches above, loose matches on Subject: below --
2005-07-26 15:08 [2.6 patch] schedule obsolete OSS drivers for removal Adrian Bunk
2006-01-03 19:37 ` Adrian Bunk
2006-01-03 23:10   ` Tomasz Kłoczko
2006-01-04  9:37     ` [OT] ALSA userspace API complexity Alistair John Strachan
     [not found]     ` <mailman.1136368805.14661.linux-kernel2news@redhat.com>
2006-01-04 11:00       ` Pete Zaitcev
2006-01-04 11:35         ` Jaroslav Kysela
2006-01-04 11:47           ` Pete Zaitcev
2006-01-04 14:23           ` Alistair John Strachan
2006-01-05 11:41             ` Olivier Galibert
2006-01-05 12:01           ` Tomasz Kłoczko
2006-01-05 12:23             ` Jaroslav Kysela
2006-01-05 14:21               ` Olivier Galibert
2006-01-05 15:07               ` Tomasz Kłoczko
2006-01-05 16:14                 ` Takashi Iwai
2006-01-05 17:19                   ` Marcin Dalecki
2006-01-05 20:13                   ` Tomasz Kłoczko
2006-01-07 14:32                     ` Takashi Iwai
2006-01-08  2:03                       ` Olivier Galibert
2006-01-08  2:26                         ` Martin Drab
2006-01-08 13:21                           ` Olivier Galibert
2006-01-08 13:32                             ` Jaroslav Kysela
2006-01-08 23:18                               ` Pavel Machek
2006-01-08  9:42                         ` Jaroslav Kysela
2006-01-08 13:04                           ` Olivier Galibert
2006-01-08 13:23                             ` Jaroslav Kysela
2006-01-08 13:38                           ` Marcin Dalecki
2006-01-05 23:06                   ` Hannu Savolainen
2006-01-05 23:39                     ` Lee Revell
2006-01-05 23:56                       ` Hannu Savolainen
2006-01-06  0:03                         ` Lee Revell
2006-01-05 23:40                     ` Lee Revell
2006-01-05 23:59                       ` Hannu Savolainen
2006-01-06 15:03                         ` Stefan Smietanowski
2006-01-06 15:48                           ` Erik Mouw
2006-01-06 18:37                           ` Lee Revell
2006-01-10  9:43                         ` Jaroslav Kysela
2006-01-10 13:42                           ` Hannu Savolainen
2006-01-10 14:08                             ` Jaroslav Kysela
2006-01-10 14:17                               ` Hannu Savolainen
2006-01-10 20:13                               ` Marcin Dalecki
2006-01-06  0:14                       ` Marcin Dalecki
2006-01-06  0:29                         ` Martin Drab
2006-01-06  0:57                           ` Marcin Dalecki
2006-01-06  1:49                             ` Martin Drab
2006-01-06  1:21                         ` Zan Lynx
2006-01-06 15:17                           ` Stefan Smietanowski
2006-01-09 23:55                             ` jerome lacoste
2006-01-10  2:29                               ` Stefan Smietanowski
2006-01-06  3:14                     ` Edgar Toernig
2006-01-06  3:33                       ` Hannu Savolainen
2006-01-06 11:34                         ` Florian Schmidt
2006-01-06  7:47                     ` Jan Engelhardt
2006-01-07 14:45                     ` Takashi Iwai
2006-01-05 18:56                 ` Lee Revell
2006-01-05 22:39                 ` Joern Nettingsmeier
2006-01-05 23:44                   ` Tomasz Kłoczko
2006-01-05 23:49                   ` Olivier Galibert
2006-01-06  0:22                     ` Joern Nettingsmeier
2006-01-06  1:30                       ` Olivier Galibert
2006-01-06  2:20                       ` Hannu Savolainen
2006-01-10  9:54                         ` Jaroslav Kysela
2006-01-10 13:50                           ` Hannu Savolainen
2006-01-06  0:00                   ` Marcin Dalecki
2006-01-05 12:47             ` Leonard Milcin Jr.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0601082324040.31407@zeus.compusonic.fi \
    --to=hannu@opensound.com \
    --cc=linux-audio-dev@music.columbia.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).