Opened 15 years ago

Closed 15 years ago

Last modified 12 months ago

#7412 closed enhancement

PCjr + PC Speaker Emulation Sound Muffled

Reported by: SF/tbcarey Owned by: SF/hoenicke
Priority: normal Component: Audio
Keywords: Cc:


This is probably not a bug, as I'm sure it's there by
design, but the PCjr + PC Speaker emulation both employ
some sort of [undocumented, as far as I'm aware]
bandpass filter that makes them sound incredibly
muffled and also accentuates the low-end far too much
compared to the originals.

It would be desirable to have any sort of filter be
optional, as it really makes the music sound far worse
than it ought to. I've included a comparison of
ScummVM's PCjr emulation in Monkey Island 1 as opposed
to the PCjr output under DOSBox, and a clip of the MI1
intro on a real PCjr as well. The DOSBox
[non-bandpassed] version sounds much closer to the

Ticket imported from: #1158455. Ticket imported from: feature-requests/228.

Attachments (3)

MI1 PCjr ScummVM.mp3 (122.8 KB ) - added by SF/tbcarey 15 years ago.
MI1 PCjr DOSBox.mp3 (122.8 KB ) - added by SF/tbcarey 15 years ago.
MI1 PCjr.mp3 (133.2 KB ) - added by SF/tbcarey 15 years ago.

Download all attachments as: .zip

Change History (15)

by SF/tbcarey, 15 years ago

Attachment: MI1 PCjr ScummVM.mp3 added

by SF/tbcarey, 15 years ago

Attachment: MI1 PCjr DOSBox.mp3 added

comment:1 by SF/tbcarey, 15 years ago

Summary: PCjr/PC Speaker Emulation Sound MuffledPCjr + PC Speaker Emulation Sound Muffled

by SF/tbcarey, 15 years ago

Attachment: MI1 PCjr.mp3 added

comment:2 by SF/tbcarey, 15 years ago

Forgot to mention that I'm using the latest CVS Win32 build
[March 07 12:13:50] and that, obviously, this issue affects
all games using PCjr or PC Speaker emulation.

comment:3 by fingolfin, 15 years ago

Component: --Unset--

comment:4 by eriktorbjorn, 15 years ago

Owner: set to SF/hoenicke

comment:5 by eriktorbjorn, 15 years ago

I assume this is a consequence of the
Player_V2::lowPassFilter() function. If I disable this, and
enable the line that has been commented out from
Player_V2::squareGenerator() "because the lowPassFilter does
it for us", I get a much sharper sound.

But I don't know anywhere near enough about this to say what
should be done. Obviously the filter function was added for
a reason.

comment:6 by SF/hoenicke, 15 years ago

I added the low pass filter because I found in the hardware
description for old PCs that the internal speaker had a low
pass filter. It also helped to minimize the artifacts that
were produced by the square-wave generator.

After hearing you samples I agree that the sound produced by
scummvm is muffled, so the current low pass filter is too
strong. You can easily adapt the low pass filter by
changing the constant PCJR_DECAY. This is a value between 0
and 0xffff, where 0 means no low pass filter at all. The
value is kind of exponential so 0x4000 means almost no low
pass filter and 0xc000 is a weak low pass filter.

Since you have a real PCjr, can you try to get the value
that produces the most similar sound? Maybe it is really 0.
For PC speaker sound the low pass filter is defined by

Both constants are at the beginning of scumm/player_v2.cpp
(and again in scumm/player_v1.cpp for the old V1 games).

comment:7 by SF/tbcarey, 15 years ago

Low-pass filters on actual PC Speakers are for totally
different reasons than you might expect, at least as far as
I'm aware. It's because they frequently used Pulse-Width
Modulation, and Pulse-Width Modulation output requires using
a low-pass filter to convert the signal to analog levels
capable of driving an amplifier and speaker. So, when
emulating the PC Speaker, there should be little reason for
actually employing a low-pass filter except perhaps to
minimize aliasing above a certain frequency.

I'll check into modifying the values and let you know what
sounds most comparable to the original. Thanks for your help.

comment:8 by SF/tbcarey, 15 years ago

0xa000 sounds correct to me on both accounts. I did an audio
recording/comparison and both came out fairly similar to
their hardware counterparts' recordings. Hope this helps.

comment:9 by SF/hoenicke, 15 years ago

With "both accounts" you mean PCjr and PC speaker, right?
I'll change the constants and check it in.

comment:10 by SF/tbcarey, 15 years ago

Yes, I mean for both PCjr and PC Speaker. Thanks.

comment:11 by SF/tbcarey, 15 years ago

Status: newclosed

comment:12 by digitall, 12 months ago

Component: Audio
Note: See TracTickets for help on using tickets.