VOGONS


Reply 20 of 47, by VileR

User metadata
Rank Oldbie
Rank
Oldbie

Now however, the death sound in Digger seems to break.

Samples attached; the "original" one is how it should sound.

Attachments

  • Filename
    digger_death_newpatch.ogg
    File size
    22.4 KiB
    Downloads
    229 downloads
    File comment
    Digger death sound w/ newest speaker patch
    File license
    Fair use/fair dealing exception
  • Filename
    digger_death_original.ogg
    File size
    21.25 KiB
    Downloads
    225 downloads
    File comment
    Digger death sound w/ original speaker emulation
    File license
    Fair use/fair dealing exception

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]

Reply 21 of 47, by NY00123

User metadata
Rank Member
Rank
Member
ripsaw8080 wrote:

There's a bit more than a simple relocation; the added spkr.mode condition is what helps Digger

Oh right I've missed it 😁
Just tested the same patch but without the spkr.mode check. Looks like the digger fanfare sounds malformed again, although the Dave sound effects are fine. So, I guess Digger does turn the sound off (and on) from time to time.

ripsaw8080 wrote:

Some other early games by id Software like Dangerous Dave in The Haunted Mansion, Rescue Rover, and Shadow Knights sound more like what I remember. Not too surprising because the sound code was probably reused amongst their games.

Great to read that! Especially as I wanted this long ago and not just in the latest few months.

EDIT: Ah, just seen your recent reply VileRancour. Guess a (sufficiently) perfect way of emulation still stays unsolved then. Should listen to the digger death sound on a real PC Speaker maybe.

EDIT 2: Alright, I've tested Digger on a different PC with a real speaker. Was a bit hard to determine in this case though (being a little silent or not). I *think* that the patch actually makes it more like the real thing. However, it'd be better if someone may check it on an actual PC Speaker and validate.

Reply 22 of 47, by VileR

User metadata
Rank Oldbie
Rank
Oldbie

Don't have a machine that can run Digger natively, but the "original" one is definitely how I remember it sounding.

Also, found a video of Digger running on a real IBM PC (except for the video card) - http://www.youtube.com/watch?v=pFU1_ijINXc ; check out 3:49 for the death sound. The recording makes it sound all tinny, but it sure is much closer to the vanilla DOSBox sample.

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]

Reply 23 of 47, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I don't dislike the different death sound, though. 😀

It's increasingly hackish, but I didn't see anything else in the speaker variable values to leverage that works:

if (spkr.mode==SPKR_PIT_ON && cntr<10000) spkr.pit_index=spkr.pit_max;

Sounds OK with Keen and the other id games, Digger (all square wave sounds I know of), and a few other games I've tried... but there is little chance it will handle any and all games.

Reply 24 of 47, by VileR

User metadata
Rank Oldbie
Rank
Oldbie

Yeah that was a cool "new" death sound, very C64/SID-like ;)
There were a few quirks in other games as well, was going to post but then I noticed your latest change - it fixes those too. Nice!

One thing still sounds different with your newest change, the "grabbing" sound in Alley Cat (when you hang onto something).
However, this time I think the patched version is actually closer to how it's supposed to sound... can anyone confirm?

samples attached; they don't sound wildly different or anything, but for some reason it's easier to notice when you're actually playing.

Attachments

  • Filename
    alleycat_WAV.zip
    File size
    13.28 KiB
    Downloads
    200 downloads
    File comment
    Alley Cat "grab" sound w/ ripsaw8080's latest change vs. original DOSBox emulation
    File license
    Fair use/fair dealing exception

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]

Reply 25 of 47, by Calvero

User metadata
Rank Member
Rank
Member

Some other early games by id Software like Dangerous Dave in The Haunted Mansion, Rescue Rover, and Shadow Knights sound more like what I remember. Not too surprising because the sound code was probably reused amongst their games.

There are quite a lot of games that use the same file format for the PC speaker sound effects as Commander Keen:
Catacomb 1 and 2, Commander Keen 1-3, Cosmo's Cosmic Adventures, Dangerous Dave, Dangerous Dave in Copyright Infringement, Dangerous Dave 2, Duke Nukem, Duke Nukem II, Hovertank 3D, Math Rescue, Major Stryker, Monster Bash, Paragon (aka Street Ball), Pickle Wars, Realms of Chaos (beta version only), Rescue Rover, Shadow Knights, Slordax, Word Rescue and Xenopods.
Source.

Reply 26 of 47, by NY00123

User metadata
Rank Member
Rank
Member
Calvero wrote:

Oh wait, haven't I already written about the quoted page? Well, time to do it! I should thank anybody responsible for figuring out the Inverse Frequency Sound format, as well as making the information available on the web; This is the basis for the attempt to improve the PC Speaker emulation in DOSBox. A few guides for PC Speaker programming were clearly helpful as well.
Basically, I've checked out the "trophy" sound from Dangerous Dave and attempted to convert it to a playable RAW wave file, in two different ways. The results of this: One converted file sounds more like the original (and patched DOSBox), while the other sounds like vanilla DOSBox v0.74.
So, now you should know the real source of the fix.

Back to Digger, I've checked the death sound on yet another PC with an internal speaker. It may still be a bit hard to determine, but I can now confirm that it actually sounds like the vanilla DOSBox v0.74 way, more than that "C64-like" way.

Reply 27 of 47, by Myloch

User metadata
Rank Member
Rank
Member

I've found at least one game that is broken by the patch, using "ykhwong 3 september 2011" build: it's teenage mutant ninja turtles, speaker music is ugly (it's difficult to explain but sound is not clean and crisp), official dosbox is not affected (in this case the speaker emulation is good).

Reply 28 of 47, by Myloch

User metadata
Rank Member
Rank
Member

monkey island 1 is totally broken (see attachment recordings)
monkey_000 is from vanilla 0.74
monkey_001 is from latest ykhwong build with the experimental patch.

Attachments

  • Filename
    CAPTURE.rar
    File size
    619.99 KiB
    Downloads
    166 downloads
    File license
    Fair use/fair dealing exception

Reply 29 of 47, by VileR

User metadata
Rank Oldbie
Rank
Oldbie

ouch... sounds like insane ring modulation going on 😀

Guess the "experimental" config switch (as in bloodbat's patch) is still needed then.

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]

Reply 30 of 47, by Myloch

User metadata
Rank Member
Rank
Member

yep. And imho teenage mutant ninja turtles sounds "wrong" in some ways too (I had the game on a 386sx during my childhood, so I'm using my memory and ear), albeit less evident (see attachment). Other games are not affected though and play the same way (no noticeable sound rendition difference) on vanilla or experimental build.

edit: monkey island 2 tagged as broken too (attachment available) 😀

edit2: another fine example is taken from prince of persia 1 (see attachment again)

Attachments

  • Filename
    prince.rar
    File size
    142.39 KiB
    Downloads
    160 downloads
    File license
    Fair use/fair dealing exception
  • Filename
    monkey2_speakerbug.rar
    File size
    160.36 KiB
    Downloads
    168 downloads
    File license
    Fair use/fair dealing exception
  • Filename
    tmntega.rar
    File size
    592.19 KiB
    Downloads
    170 downloads
    File license
    Fair use/fair dealing exception

Reply 31 of 47, by NY00123

User metadata
Rank Member
Rank
Member

Ouch. I've just tried with the Monkey Island 1 Demo and basically got the same artifact already reported. The prince of persia example is another clear case.

Now, sure, an easy way to "solve" this is playing a bit with that condition added by ripsaw with the "cntr" value, by modifying the value. Unfortunately and unsurprisingly, what makes MI sound better makes Keen 1 sound worse (i.e. less true to the original)...

I still have some feeling that a proper way of fixing this is a whole re-implementation of the PC Speaker emulation, as well as the emulation of some timer. And so, indeed, a switch between "vanilla" and "experimental" modes or a similar thing would be better for now.

To clear things up, here's a short comparison of behaviors between a real speaker, DOSBox v0.74's emulated speaker and a proposed new way of emulation:
1. On an actual PC with a speaker, an internal timer is used to determine which bit to "send" in some way. It can be sent in square waves (e.g. 1 for tenth a sec, 0 for another tenth...). As for the speaker, it can be "attached" to the timer. And then, 1 would stand for the speaker moving in one way (up), while 0 would mean moving in the other (down). This is how square waves can be generated. Different patterns can also be generated, similarly; Digitized sound effects are just one example of that.
2. In the current DOSBox sources, looks like what really generates the square waves is the PC Speaker emulator, not the timer. When it comes to digitized sound, things are working a bit differently, and I haven't fully checked these.
3. In a proposed new emulator, it'd work more like the real thing: The timer would be responsible for sending stuff, while the speaker would wait for this. An input of 1 to the speaker would tell it to move up (but gradually!), while 0 would trigger it to move down.

Reply 32 of 47, by VileR

User metadata
Rank Oldbie
Rank
Oldbie

yeah, I was thinking of watching the value of cntr and trying to obtain some stats on what's happening with it in each case (sounds that the patch fixes, sounds that the patch breaks, and sounds that work either way).

Haven't had the time to do that yet, but as you just said - if the current code isn't really based on a single working model of hardware behavior then I doubt it would help.

but that begs the question, is it even feasible to implement a completely accurate model?

Not talking just about the timer issues... there's also the whole approach behind generating the waveforms - aka the aforementioned "clicks and pops" issue (an accurate model would fix it by always treating silence as a straight line either at the "top" or "bottom" of the waveform, rather than the center, but that would screw things up for the mixer by introducing a permanent offset/bias).
A different issue, but it's yet another example of how problematic a 100% accurate model could be.

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]

Reply 33 of 47, by NY00123

User metadata
Rank Member
Rank
Member

Ah, there's something I've forgotten to tell in my last post:
The current DOSBox PC Speaker emulation seems to create accurate square waves (when "square wave" mode is used). That is, the emulated speaker is always on extreme top or bottom.
With a real speaker, though, this is clearly not the case.

That could be a great cause for several inaccuracies - mainly if a program (game) changes the relevant timer value really quickly.

As for the clicks and the pops - well, yeah, a speaker always on the top or bottom (at least if unused) may be the way, at least if that's how it works with a real one. It may be problematic in DOSBox only if the PC Speaker emulation is actually shut down at some point, I guess.

Reply 35 of 47, by digistorm

User metadata
Rank Member
Rank
Member

What NY00123 means is that the original speaker has some inertia that causes the sharp edges to soften. You could also describe it this way: the physical speaker acts as an bandpass filter because it cannot follow very fast changes, and it is too small to reproduce very low frequency's. Most PC speakers were little more than the cheap units that you found in the pocket transistor radio's of those days.
When you connect a modern hifi or pc sound system to the same raw voltage that is emulated here, there is waaaay more bass and treble than was present in the original system. Hence, games will not sound 100% as you may remember them.

Reply 36 of 47, by NY00123

User metadata
Rank Member
Rank
Member

Well, just to ensure things are clearer, here's what I've referred to (again for square waves):
My guess is that the emulated speaker in DOSBox moves from maximum to minimum in zero time (and back). To compare, a real speaker, obviously, can't do that.

Reply 38 of 47, by digistorm

User metadata
Rank Member
Rank
Member

How is the PWM effect emulated in DOSBox? This effect was based on the fact that the speaker is so slow that the pulse waves are averaged and 4 - 6 bit sample playback is possible. I have some old demo's that can use the PC speaker, and it works so this "speaker slowness thing" seems to work, at least for PWM audio.

Reply 39 of 47, by VileR

User metadata
Rank Oldbie
Rank
Oldbie
digistorm wrote:

How is the PWM effect emulated in DOSBox? This effect was based on the fact that the speaker is so slow that the pulse waves are averaged and 4 - 6 bit sample playback is possible. I have some old demo's that can use the PC speaker, and it works so this "speaker slowness thing" seems to work, at least for PWM audio.

Yeah, most games using digitized audio / speech work just fine with the current code (off the top of my head, only Perestroika aka Toppler doesn't). DOSBox handles all this PWM/digital sample playback stuff under a different speaker/timer "mode" (mode 3; not sure what this is based on, or what it corresponds to in real hardware).
The games discussed in this thread apparently use the timer differently ("mode 0") even though the physical effect exploited ("speaker slowness") may be the same.

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]