[alsa-devel] Increasing maximum sampling frequency?
clemens at ladisch.de
Thu May 28 08:52:44 CEST 2009
Lee Revell wrote:
> On Wed, May 27, 2009 at 9:47 PM, Cameron Stone
> <camerons.lists at cse.unsw.edu.au> wrote:
> > I've got a USB microphone application that I want to sample at 256000 8
> > bit samples per second so I can listen to bats. I know that my device
> > can get close to that rate, but alsa seems to restrict sampling rates to
> > 192kHz.
> > Is it possible to push the maximum sampling frequency higher? If so,
> > where should I start looking?
> For starters, try adding a 256K sample rate to include/sound/pcm.h:
> and sound/core/pcm_native.c:
This is not necessary; drivers can define whatever sample rate they
want. 1,792,000 Hz works just fine with the Bt878 driver.
> $ arecord -v -Dplughw:1,0 test.wav -d 1 -r 256
> Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 256000 Hz, Mono
> Slave: Hardware PCM card 1 '8-Mic AVR Adaptor' device 0 subdevice 0
> Its setup is:
> rate : 256000
This indicates that the record PCM stream _does_ use the correct rate.
> $ aplay -r 256 test.wav
> Playing WAVE 'test.wav' : Unsigned 8 bit, Rate 256000 Hz, Mono
> Warning: rate is not accurate (requested = 256000Hz, got = 192000Hz)
The automatic sample rate converter never uses a frequency higher than
This maximum frequency is defined in alsa-lib/include/pcm_plugin.h, but
you cannot change it without changing LINEAR_DIV and the algorithm in
Try resampling the .wav file before with sox.
More information about the Alsa-devel