alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: "Marc-André Hébert" <hebert.marcandre@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: Keyclick latency
Date: Fri, 18 Mar 2011 16:44:11 +0100	[thread overview]
Message-ID: <4D837DCB.7030502@ladisch.de> (raw)
In-Reply-To: <AANLkTim=b2hc-DB+UZN8bnr9XzpHpiA8EerjsyUh69N+@mail.gmail.com>

Marc-André Hébert wrote:
> I am working on an embedded device which does audio playback. Now when
> the user presses a key, we want to play a tone to provide a keyclick
> feedback to the user.
> 
> What we always did (we were using OSS before) was pretty much the
> simplest thing possible which is for the application to:
> -stop sending playback samples
> -send the keyclick samples
> -resume sending the playback samples
> 
> With our new hardware this approach does not produce good results
> because of the size of the device's ringbuffer. The larger buffer
> introduces a significant latency issue for the user feedback. Reducing
> the ring buffer size is not a viable option to ensure no underruns are
> generated on the system.
> [...]
> Would there be a simpler approach? Something like pausing
> the stream or reading the contents of the ringbuffer before dropping.

Depending on what plugins sits between your application and the
hardware, your ALSA device might support snd_pcm_rewind()/
snd_pcm_forward().  Please note that rewinding will increase the
chance of an underrun (just like a smaller buffer), so you might want
to disable xrun detection (which means that instead of stopping, the
old buffer data will be played in place of the beginning of the click).


Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

      reply	other threads:[~2011-03-18 15:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-18 14:13 Keyclick latency Marc-André Hébert
2011-03-18 15:44 ` Clemens Ladisch [this message]

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=4D837DCB.7030502@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=hebert.marcandre@gmail.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).