Subject: Re: NetBSD plays .wav ultra fast
To: Brett Lymn <>
From: Andreas Gustafsson <>
List: current-users
Date: 07/19/2001 10:35:26
Brett Lymn writes:
> >If you play 8kHz samples at 48 kHz without doing serious digital (or analog)
> >filtering, it will be MUCH worse than simple 8kHz. You'll hear 5 mirror images
> >(in the frequency domain) plus, possibly, the 8kHz carrier.
> >
> Correct, but the filtering requirements for such a conversion are not
> that onerous - a couple of taps on a digital filter should do it (2
> multiplies, 2 adds - more modern processors even have the instructions
> to do the macc in one step...3DNow, MMX and so on).

There is a problem with using these instructions in the NetBSD kernel:
they use the floating point registers, and the floating point context
switch code of the NetBSD i386 port does not maintain floating point
state for the kernel, only for user processes.  I have some patches to
deal with this, but they are scary. Followups about this issue should
go to port-i386, of course.

None of this matters if we only need to deal with the specific case of
8 kHz -> 48 kHz - that's simple enough that you should be able to get
decent quality using a reasonable amount of CPU with a filter based on
integer multiplies, adds and shifts, and/or lookup tables.  As you
say, handling arbitrary frequency ratios is the hard part.
Andreas Gustafsson,