All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francisco Moraes <fmoraes@nc.rr.com>
To: alsa-devel@lists.sourceforge.net
Subject: Re: Rate or Plug plugin problem when converting rate down
Date: Fri, 09 Jul 2004 19:47:47 -0400	[thread overview]
Message-ID: <40EF2EA3.1090205@nc.rr.com> (raw)
In-Reply-To: <40EDDFAC.9000201@nc.rr.com>

Francisco Moraes wrote:

> Whenever I use plug, plughw or rate plugins to convert a stream into a 
> lower frequency, I get cracks in the sound output.
>
> I am attaching a dump of aplay -v with the rate plugin being used.
>
> Any ideas of what can be wrong? I've tried even 24000 which is half of 
> the default frequency of the emu10k1x card, but it still causes the 
> problem.

I've looked at the source code for the pcm_rate plugin and it seems like 
*snd_pcm_rate_shrink* will not fill the destination buffer last byte, at 
least from in the cases I've tried. From looking at the code, the loop 
is controlled by the source frames, which is bigger than the 
destination. Depending on the get_increment fractional part, the last 
"put" into the destination buffer will not happen and sound noise will 
be generated. It gets worse on lower frequencies and I've been able to 
reproduce this on both the emu10k1x and cs46xx sound cards.

I've also used the file plugin to write the output to a file and to play 
it back and the sound noise was present in the written file.

It seems to me that the code calling the function assumes that all bytes 
in the destination buffer will be filled and that's not happening. For 
istance:

from 48000 to 24000, which would be a simple 0x8000 step in the code, 
the actual calculated value for the get_increment is 0x7FFF from this code:

rate->pitch = (((u_int64_t)dst_rate * LINEAR_DIV) + src_rate - 1) / src_rate;

Anybody  with better knowledge to comment on the above?

Francisco


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com

      reply	other threads:[~2004-07-09 23:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-08 23:58 Rate or Plug plugin problem when converting rate down Francisco Moraes
2004-07-09 23:47 ` Francisco Moraes [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=40EF2EA3.1090205@nc.rr.com \
    --to=fmoraes@nc.rr.com \
    --cc=alsa-devel@lists.sourceforge.net \
    /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.