Re: Increasing maximum sampling frequency?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Thu, 28 May 2009 09:28:57 +0200,
I wrote:
> 
> At Thu, 28 May 2009 08:52:44 +0200,
> Clemens Ladisch wrote:
> > 
> > Lee Revell wrote:
> > > On Wed, May 27, 2009 at 9:47 PM, Cameron Stone
> > > <camerons.lists@xxxxxxxxxxxxxxx> 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
> > 192 kHz.
> > 
> > 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
> > alsa-lib/src/pcm_pcm_rate_linear.c.
> 
> It's anyway better to user other resampler like pph or samplerate
> plugins.  And these have no restriction, I guess.
> 
> It'd be nicer if the rate plugin itself provides the min/max rates
> optionally.  It shouldn't be hard -- just extend the pcm_rate_info_t
> to contain the new info.  A version check would be required to make
> the backward compatibility, though.

OK, here are two patches.  One for alsa-lib and one for alsa-plugins.
The linear plugin still limits the rate up to 192kHz.  But other
plugins should work (hopefully).


Takashi

---

Attachment: alsa-lib-rate-plugin-ext.diff
Description: Binary data

Attachment: alsa-plugins-rates-ext.diff
Description: Binary data

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

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux