All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carlo Wood <carlo@alinoe.com>
To: Kai Vehmanen <kai.vehmanen@wakkanet.fi>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Bug in OSS simulation (ALSA 0.9.4)
Date: Fri, 11 Jul 2003 04:03:53 +0200	[thread overview]
Message-ID: <20030711020353.GA27925@alinoe.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0307110334250.5612-100000@ecabase.localdomain>

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 <carlo@alinoe.com>


-------------------------------------------------------
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

      reply	other threads:[~2003-07-11  2:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-10  1:33 Bug in OSS simulation (ALSA 0.9.4) Carlo Wood
2003-07-10  1:51 ` Carlo Wood
2003-07-10 22:54   ` Kai Vehmanen
2003-07-10 23:43     ` Carlo Wood
2003-07-11  0:05       ` Kai Vehmanen
2003-07-11  1:41         ` Carlo Wood
2003-07-10 13:15 ` James Courtier-Dutton
2003-07-10 22:36   ` Carlo Wood
2003-07-10 22:49 ` Kai Vehmanen
2003-07-10 23:07   ` James Courtier-Dutton
2003-07-11  0:00   ` Carlo Wood
2003-07-11  0:21     ` Kai Vehmanen
2003-07-10 23:09 ` Kai Vehmanen
2003-07-11  0:28   ` Carlo Wood
2003-07-11  0:44     ` Kai Vehmanen
2003-07-11  2:03       ` Carlo Wood [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030711020353.GA27925@alinoe.com \
    --to=carlo@alinoe.com \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=kai.vehmanen@wakkanet.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.