Subject: Re: Proposal: Audio: Sampling rate conversion
To: None <tech-kern@netbsd.org>
From: IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp>
List: tech-kern
Date: 03/14/2002 03:34:51
I noticed that Matlab has a digital filter design tool and played with
it to generate a set of filters to do 44.1 <-> 48kHz conversion.
I've put the code temporarily at
http://www.sat.t.u-tokyo.ac.jp/~iwamoto/misc2/aurateconv.c
which should have sufficiently high quality for most purposes.
It does 44.1 <-> 50.4 <-> 48kHz two-staged conversion, which idea I
borrowed from some web page. Additionaly, it has 8 -> 44.1, 8 -> 48kHz
conversion code, which I've never tested.
To test, do something like:
$ cc -O2 aurateconv.c
$ audioctl -w play.rate=44100 play.encoding=slinear \
play.precision=16 play.channels=2
$ cat 48k.wav |./a.out > /dev/sound
$ audioctl -w play.rate=48000 play.encoding=slinear \
play.precision=16 play.channels=2
$ cat 44.1k.wav |./a.out -t 1 > /dev/sound
I plan to do some clean up and put it into the kernel, when I'll have
time to do. (If anyone would do this work instead of me, that's
better.)
But this conversion is quite expensive (uses ~30% CPU on 233MHz PPro).
If you have a 486 or similar, you'll not likely to want this.
OTOH if you have much better CPU, computation cost is not likely an
issue.
I think there should be a way to enable/disable this code, which is
better than a kernel config option.
Any ideas?
--
IWAMOTO Toshihiro