On Fri, Jul 11, 2003 at 03:44:34AM +0300, Kai Vehmanen wrote:
> Hmm, not quite - you are reading 16bit samples at a rate of 22050 per sec, 
> so the data rate should be 22050*16/8=44100 bytes per second.

Ok

> But the rate actually is 8000 (you can check this by catting
> /proc/asound/card0/pcm0c/sub0/hw_params). In your  code:
> 
> res = 22050;
> if (ioctl(fd, SOUND_PCM_READ_RATE, 0xbfffdcfc) == -1)
> {
>    perror("ioctl");
>    exit(1);
> }
> printf("Sample rate: %d\n", res);
> 
> ... 'res' is always 22050 no matter what the device reports.

Ugh.  Now I am confused.  Since this is a speech recognition
program, I suppose it will perform a fourier transform (fft)
on the data.  When it expects a rate of 22050 (it requested
that and the ioctl confirmed it) then it will treat the data
as if it was 2.76 times higher in frequency then it actually
is!  That could lead to it not being able to understand the
spoken words, no?

> So with 8000, the date rate should be 16000 bytes/sec.

Ok, thats what I get more or less without any xruns.

> > Anyway, it seems too low or too high.
> > When I add back the "if (info.fragments > 0)" test
> > and decrease the naptime drastically, I get:
> 
> Try my other change to the test code - i.e. only sleep for
> naptime when info.fragments is zero.

That leads to no xruns, then it works.
It is of no use however because I can't get the closed
source application to read faster ;).

-- 
Carlo Wood <[EMAIL PROTECTED]>


-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to