Re: NEWSFLASH! Linux ported to Commodore VIC-20!!

Robert Hamilton (hamilton@users.kdi.com)
Sun, 20 Sep 1998 23:40:14 -0500


On Sun, Sep 20, 1998 at 09:28:51PM +0000, H. Peter Anvin wrote:
> It's not FM, at all; the Linux PC speaker driver uses PDM (Pulse
> Duration Modulation) with a high frequency clock to increase the
> resolution; this works because Linux can toggle the speaker much
> faster than the speaker itself can move, so you get a "smoothing"
> effect here.

While this effect undoubtedly contributes, there is another
factor which I believe is of equal importance , if not far
greater.

I offer below what I hope to be a nice justification for pulse
width modulation that is independent of physical properties
of the speaker. If it _is_ correct then it may be useful to
provide limits to what one might expect in further development.

Consider a pulse of finite duration dt and of height h, h<1.
(A single scaled datum from an .au file for example). If you
compare the Fourier coefficients of this pulse to that of a
pulse of height 1 but duration (h)(dt) (e.g. a pulse width
modulation) you will note that they are equal through
the first order in dt. Unfortunately second order (error)
terms are apparently always of the same sign and cannot be
eliminated through some rearrangement of the PWM 'bits'.
They are however about the same order of magnitude as the
second order effects due to discretization of the original
data (if my math is correct) [1].

The only reason this has relevance here stems from the fact
that the ear can be more accurately modeled by its response
to a frequency distribution than to a sequence of amplitudes.
In particular the relative phases of the frequency components
are apparently unimportant, and the ear responds roughly
logarithmicly (therefore weakly) to the amplitudes of the wave
form, and consequently to the amplitudes of those components.
(Please forgive me for neglecting masking effects.)
Thus it is "legal" to compare only Fourier components as I have
done and to some extent to neglect second order terms.

The upshot of this is simply that not only can you "trade off"
bit resolution for higher output frequencies (to 1st order),
the ear also vastly-under samples the resulting waveform [2].
In any case this means that the ear hears both waveforms, the
original and the PWM, as roughly equal, even though in fact
they may be quite different.

--
Robert

[1] Which would seem to indicate, BTW, that there may not be a whole lot to be gained in attempting to improve on the basic PWM methods with the PC speaker. [2] On a related note, this means that caution is indicated in using the arguments which we sometimes see, which are based simply on bit-precision (for lack of a better word).

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/