Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexander E. Patrakov" <patrakov@gmail.com>
To: Petr Kulhavy <petr@barix.com>, alsa-devel@alsa-project.org
Subject: Re: How to properly handle variable samplerate?
Date: Sat, 06 Sep 2014 16:33:06 +0600	[thread overview]
Message-ID: <540AE2E2.3050000@gmail.com> (raw)
In-Reply-To: <5409E2DA.2090403@barix.com>

05.09.2014 22:20, Petr Kulhavy wrote:
> Hi,
>
> I'm developing an audio stream player application with ALSA output, the
> player has a large software buffer. The trouble is that the stream can
> potentially change the sampling rate (e.g. streaming RTP from a VLC
> playlist created from different MP3 songs). How to properly handle this?
>
> I'm thinking of the following concept:
> The codec feeds data into the software buffer together with markers for
> sample rate changes. The ALSA playback is asynchronous, using a callback
> function feeding the data from the software buffer into ALSA. If a
> samplerate marker is hit the new rate is set.
>
> Can the sample rate be set from a callback? What other constraints are
> there? And how does the HW FIFO handle samplerate changes?
> Or is there a better way of implementing?

ALSA does not support variable sample rate at all. So you either have to 
do the variable-rate resampling yourself in your player, or depend on 
PulseAudio which does support this feature.

-- 
Alexander E. Patrakov

      reply	other threads:[~2014-09-06 10:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 16:20 How to properly handle variable samplerate? Petr Kulhavy
2014-09-06 10:33 ` Alexander E. Patrakov [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=540AE2E2.3050000@gmail.com \
    --to=patrakov@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=petr@barix.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