Re: [LAD] incorrect number of samples reading from /dev/dsp1

From: Clemens Ladisch <clemens@email-addr-hidden>
Date: Tue Feb 01 2011 - 09:57:42 EET

Gordon JC Pearce wrote:
> On Mon, 2011-01-31 at 21:55 -0800, farhan baluch wrote:
> > I am trying to read data from a usb microphone and using the pretty
> > standard method of using ioctl's to setup the sampling rate, channels,
> > bits and block size . This all works so the device is correctly setup.
> > I then use "read" to read samples from the device which shows up
> > as /dev/dsp1. I get a lot more samples from this read command in one
> > second of recording than the set sample rate. E.g. if i set 10Khz on
> > one run i got 269312 samples.
>
> OSS has been obsolete for over a decade. Don't use it.

But it's still supported. Of course, this API must be used correctly,
i.e., after setting parameters, one has to check whether the device has
accepted the value or has changed it to something supported.

> What have you got the sample rate set to? It's possible that your card
> isn't capable of reading at that rate so it goes to the nearest sample
> rate it does have and then interpolates.

In that case, it doesn't interpolate, it just returns data at the supported
rate.

Regards,
Clemens
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Tue Feb 1 12:15:02 2011

This archive was generated by hypermail 2.1.8 : Tue Feb 01 2011 - 12:15:02 EET