VOGONS

Common searches


The timbre of PC Speaker sound

Topic actions

Reply 20 of 22, by SquallStrife

User metadata
Rank l33t
Rank
l33t
sliderider wrote:
SquallStrife wrote:

I'm gonna say it now. I don't like the way PC Speaker sound sounds from DOSBox.

I don't like the way PC Speaker sound sounds when it comes from a PC Speaker. Thank heaven the Adlib people came along and took us away from all that horrible tinniness and crackle.

I agree.

However, some games that I quite like (like Duke Nukem 1) only support the old PC honker, and until I found out about the ykhwong build's improvements, I'd been playing it without sound... 😒

VogonsDrivers.com | Link | News Thread

Reply 21 of 22, by bjt

User metadata
Rank Oldbie
Rank
Oldbie
jwt27 wrote:

So, as a volume control, I think a 100 ohm log pot would do fine.

In the end I just added some fixed resistance to get the volume down to a more pleasant level. The speaker in my machine is 8 ohm 0.5w and was really loud. I added two 0.25w 220R resistors in series to the -ve leg of the speaker.

Reply 22 of 22, by ripa

User metadata
Rank Oldbie
Rank
Oldbie
Jepael wrote:
There is a big difference between real hardware and emulation, and the better the emulation, the more it will suck CPU horsepowe […]
Show full quote

There is a big difference between real hardware and emulation, and the better the emulation, the more it will suck CPU horsepower to make it more accurate.

The timer that generates the square wave beeps runs at 1.19318 MHz ("sampling rate" if you prefer), not to mention how the mathematical square wave gets converted into analog sound from the speaker, echoing inside the case. It is not simple to reproduce that with a sound card running "only" at 48 kHz sampling rate. So one simulated sound sample contains about 24.8 speaker timer ticks.

The basic way of simulating this is to just calculate for each 48kHz output sample if the speaker bit is currently high or low and live with all the effects like phase jitter on output edges and the generated audio containing ideal steps that have infinite frequencies. Fast but not very high quality.

Mathematically the correct process would be to actually simulate the 1-bit 1.19318 MHz sound stream and resampling with low pass filtering that to 16-bit 48kHz. As that will suck CPU power way too much, it can be faked with band-limited step resposes (bleps).

I implemented BLEP-based PC speaker emulation for Dosbox a while ago. An early version of it is included in Dosbox-Daum. The latest patch, which sounds pretty good, is available in this thread:
ripa PC Speaker patch (was Want to use PC Speaker and not Sound Blaster in StarControl 1)

I've been thinking about rewriting it because the code is pretty bad. Maybe the improvements could be incorporated in official Dosbox then...