Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Quality resampling code for libasound
Date: Mon, 19 Feb 2007 23:54:15 +1100	[thread overview]
Message-ID: <45D99DF7.90204@usherbrooke.ca> (raw)
In-Reply-To: <s5hirdy72ue.wl%tiwai@suse.de>

>> The quality is similar to what you get with libsamplerate, but the
>> license is BSD, so there should be no issue using it within libasound.
>> There are 11 quality settings (0-10) and even the lowest quality
>> provided is already miles better than the linear interpolation currently
>> being done (which creates insane amounts of aliasing when doing things
>> like upsampling from 8 kHz to 48 kHz). I'm also willing to help whoever
>> is interested in adding support for it.
> 
> Basically I'd like to keep the default resampling code in alsa-lib as
> simple as possible.  So, I recommend you to impelment this first as an
> external plugin in alsa-plugins package just like like libsamplerate
> one.

What?? I hope you're joking here. It's one thing if you don't want my
code for a reason or another, but being happy to keep things as they are
currently is just insane. What libasound does is not resampling, it's
audio mutilation, plain and simple. It's not an audiophile thing we're
talking about. The aliasing is so bad people notice it even with speech
(which usually tolerates a lot of abuse) and think it's an application
bug (e.g. http://www.mail-archive.com/ekiga-list@gnome.org/msg01316.html
). This is only getting worse as people get new machines with HDA-based
cards that only do 44.1/48 kHz, so it'll become even more embarrassing.
Do you expect most Linux users who use a soundcard to know that they
need a plugin to have their cards actually reproduce sounds properly?

Oh, and BTW from what I see libasound is at least 80k lines of code and
my resampling is 1000 lines -- of which you can probably remove half if
you want to keep things simple. I fail to see what the problem is.

>> Partly related to that is another annoyance I found in the plug:
>> converters. The conversion between 24-bit samples into 16-bit samples
>> appears to be done by truncating rather than by rounding, which
>> introduces more quantisation noise and also a small DC bias. The fix for
>> that is fairly simple: in all the places where you have something like:
>> out[i] = in[i] >> 8;
>> it should be replaced by:
>> out[i] = (in[i]+128) >> 8;
> 
> Yes, that's a thing to be fixed.

Thanks.

>> I would have submitted a patch for that, but I was never able to figure
>> out how that part of the code works.
> 
> Better to see the patch first, then discuss further :)

Well, I'll submit the 3-line patch if you can indicate where the change
actually goes. There are lots of places that do similar shifts and I'm
not quite sure which are the right ones.

	Jean-Marc

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

  reply	other threads:[~2007-02-19 12:54 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-19  4:01 Quality resampling code for libasound Jean-Marc Valin
2007-02-19 12:23 ` Takashi Iwai
2007-02-19 12:54   ` Jean-Marc Valin [this message]
2007-02-19 13:10     ` Takashi Iwai
2007-02-19 13:38       ` Jean-Marc Valin
2007-02-19 13:47         ` Takashi Iwai
2007-02-20  5:53           ` Jean-Marc Valin
2007-02-20  6:48           ` Jean-Marc Valin
2007-02-20 10:45             ` Takashi Iwai
2007-02-20 11:54               ` Jean-Marc Valin
2007-02-20 12:13                 ` Takashi Iwai
2007-02-20 12:38                   ` Jean-Marc Valin
2007-02-20 21:50                     ` Fernando Lopez-Lezcano
2007-02-20 22:07                     ` James Courtier-Dutton
2007-02-20 22:45                       ` Jean-Marc Valin
2007-02-21  2:10                       ` Jean-Marc Valin
2007-02-21  9:18                       ` Jean-Marc Valin
2007-02-22 11:38                         ` Takashi Iwai
2007-02-22 11:48                           ` Jean-Marc Valin
2007-02-22 12:07                             ` Takashi Iwai
2007-02-28  2:10                               ` Jean-Marc Valin
2007-03-07 22:25                                 ` Takashi Iwai
2007-03-08  0:59                                   ` Jean-Marc Valin
2007-03-09 16:08                                     ` Takashi Iwai
2007-03-20 13:22                                       ` Jean-Marc Valin
2007-03-20 13:52                                         ` Takashi Iwai
2007-03-20 14:07                                           ` Jean-Marc Valin
2007-03-20 14:19                                             ` Takashi Iwai
     [not found]                                               ` <4600539A.2070804@usherbrooke.ca>
2007-03-21 11:23                                                 ` [Alsa-devel] " Takashi Iwai
2007-03-21 13:08                                                   ` Jean-Marc Valin
2007-03-21 13:14                                                     ` Takashi Iwai
2007-03-21 13:39                                                       ` Jean-Marc Valin
2007-03-21 13:59                                                         ` Takashi Iwai
2007-03-21 14:19                                                           ` Jean-Marc Valin
2007-03-21 14:53                                                             ` Takashi Iwai
2007-03-21 15:17                                                               ` Jean-Marc Valin
2007-03-21 15:43                                                                 ` Takashi Iwai
2007-03-21 15:27                                                       ` Rene Herman
2007-03-21 15:34                                                         ` Jean-Marc Valin
2007-03-21 16:38                                                           ` Rene Herman
2007-03-21 16:57                                                             ` Takashi Iwai
2007-03-21 17:24                                                               ` Takashi Iwai
2007-02-21 14:48                       ` Jean-Marc Valin
2007-02-19 13:11     ` Prakash Punnoor
2007-02-19 13:36       ` Adam Tlałka

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=45D99DF7.90204@usherbrooke.ca \
    --to=jean-marc.valin@usherbrooke.ca \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=tiwai@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox