[alsa-devel] Hidden rate conversion, and Alsa configuration
Takashi Iwai
tiwai at suse.de
Fri Aug 3 17:11:47 CEST 2007
At Fri, 03 Aug 2007 15:29:48 +0100,
James Courtier-Dutton wrote:
>
> Alan Horstmann wrote:
> > On Friday 27 July 2007 21:16, Jaroslav Kysela wrote:
> >
> >> On Fri, 27 Jul 2007, stan wrote:
> >>
> >>> I really want to avoid rate resampling if I can, while format
> >>> conversion has to occur somewhere in order to match the hardware in
> >>> most cases. I assume that any format conversion alsa does
> >>> is at least as good as one I would do myself. While the rate
> >>>
> >
> >
> >> I answered this numerous times on this list. We have a function to notify
> >> the plugins that resampling should be avoided - it's
> >> snd_pcm_hw_params_set_rate_resample().
> >>
> >
> > Can this function be built into an ALSA configuration file in some way, or can
> > it only be called from an app?
> >
> > Alan
> >
> It is only really sensible to have the app do the call, and not a config
> file.
> Reason being, if the app does the call, it must also be able to handle
> the resampling itself.
> If the config file did it, the app might not be able to do the
> resampling itself and therefore fail to play anything.
> Generally, the app is the best place to do the resampling, as it can
> handle the quality issues better.
> The resampler in ALSA is only really there to let other apps that don't
> do resampling limp along ok.
Well, it's basically a user's choice whether he really wants only a
fixed certain samplerate over all apps or not. If he wants, he can
set up his own default PCM, of course.
As a hint, the plug plugin can have "slave.rate unchanged" parameter.
For example,
pcm.mypcm {
type plug
slave.pcm "myownhw"
slave.rate unchanged
}
would wrap the slave PCM "myownhw" with plug layer but the automatic
rate conversion is suppressed there. This allow, however, automatic
conversions of other parameters such as channels and format.
Takashi
More information about the Alsa-devel
mailing list