joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.64k stars 374 forks source link

In Arkanoid game, the distorted sound of music and PC Speaker sound #1722

Open usergithub64 opened 4 years ago

usergithub64 commented 4 years ago

Describe the bug In Arkanoid game, the distorted sound of music and PC Speaker sound. The music sounds somehow rude. This is observed with the following parameters: machine = svga_s3 In cga or cga_mono mode, music and sound are normal. Although, with the same settings in svga_s3 mode in DOSBox-Staging v0.75.0, DOSBox ECE r4338, DOSBox SVN-Daum, the music sounds correctly.

Screenshots 79714897-d4a0a280-82da-11ea-8126-b24d2d9aa765

Environment (please complete the following information):

[sdl] fullscreen = true fullresolution = desktop output = openglnb

[render] aspect = true doublescan = false scaler = advinterp2x forced autofit = true

[dosbox] vmemsize = 8 memsize = 32

[vsync] vsyncmode = on vsyncrate = 60

[cpu] cycles = 240

rderooy commented 4 years ago

I just gave it a quick try, with both dosbox-x and dosbox ece and both PC speaker and Tandy mode sounded pretty much the same to my ears.

p.s. Don't know if this is supposed to be a game specific config that you posted, but settings like vmemsize, memsize, cycles are all unnecessary for Arkanoid.

rderooy commented 4 years ago

And to ensure it was not something in your config, I tried your config with dosbox-x, and it sounded the same.

p.s. that low cycles value really makes the game crawl during gameplay. Was that your intent?

usergithub64 commented 4 years ago

For this game, it is very important that cycles = 240. With this value, the music sounds correctly.

rderooy commented 4 years ago

Really? I did not experience any problems with the cycles=auto value where it gets 3000. With cycles=240 gameplay to me is unbearably slow.

usergithub64 commented 4 years ago

I played this game on a real machine 8088 XT 4.77 MHz. And in order to understand how the music should sound, you need to choose the exact number of cycles. By way of comparison, I got the number of cycles of 240. This number of cycles is suitable for all versions of DOSBox-X, DOSBox ECE, DOSBox-Staging, DOSBox SVN-Daum, if you need to get a real speed of 8088 XT 4.77 MHz.

joncampbell123 commented 4 years ago

Could the game have been coded around the slow video memory of the CGA? DOSBox-X does emulate video memory delay, where other forks do not. machine=cga video memory delay by default is set to (try to) match that of a CGA.

I'm aware of some games like "3D pinball" with music and graphics that seems timed around 8MHz 286 AT speeds, for example. It's not even a very good pinball game. It's hardly 3D, even.

joncampbell123 commented 4 years ago

Also, try setting 'enable pci bus=false' to make sure I/O has ISA bus type delays instead of faster PCI ones.

rderooy commented 4 years ago

Again, I don't hear any difference between the PC speaker output of dosbox-x and dosbox ece with default 3000 cycles. And running it at 240 cycles count does not make a difference to my ears either, other than the gameplay becoming almost a slideshow.

This is DOSBox-X (top) vs DOSBox ECE (bottom) with cycles=auto Screenshot from 2020-07-08 10-14-20

I don't see a real difference. But perhaps its just me.

rderooy commented 4 years ago

Ok, I did another run with dosbox-x, top with cycles=auto (=3000 in this case), and the other with cycles=240 (bottom) Screenshot from 2020-07-08 10-21-32

As you can see the output level is lower and the rise and fall have a nicer curve. So indeed there is some difference. I did not yet try @joncampbell123 tips.

rderooy commented 4 years ago

DOSBox ECE with cycles=240 Screenshot from 2020-07-08 10-28-26

usergithub64 commented 4 years ago

Here's how the music should sound. (both on a real machine 8088 XT 4.77 MHz and in DOSBox with cycles = 240) https://youtu.be/_7mouV05qy0

rderooy commented 4 years ago

This is dosbox-x with "enable pci bus=false". Top is with cycles=240, bottom is with cycles=auto Screenshot from 2020-07-08 10-38-54

rderooy commented 4 years ago

@maximus105 That video is not the same game that I have. Mine looks (and sounds) quite different, even when run in CGA mode.

rderooy commented 4 years ago

It seems there where 2 versions of Arkanoid for DOS (and I'm not referring to Arkanoid 2). One is the Taito version which opens with a "Taito Fun time arcade" title screen. This is the version I have.

The other is by Imagine software, and that is the version from the video you linked.

A bit of info on the different versions: http://nerdlypleasures.blogspot.com/2015/11/arkanoid-and-arkanoid-again.html

Since I don't have the Imagine version of the game, I cannot test with it.

usergithub64 commented 4 years ago

@rderooy Check out this version of the game: http://dl.old-games.su/get/gCVIU4v6_z1kfb1aaKISRw==,1594374277/pc/arkanoid/files/Arkanoid.rar

rderooy commented 4 years ago

DOSBox-X with cycles=240, machine=cga and PCI disabled: dosbox-x cga pci=false

DOSBox ECE with cycles=240, machine=cga dosbox ece cga

rderooy commented 4 years ago

p.s. that video link you posted, seems to be from an emulator. So that does not tell us how it really should sound like on real retro hardware.

usergithub64 commented 4 years ago

I played on a real machine 8088 XT 4.77 MHz and believe me, it just sounds like that in that video.

rderooy commented 4 years ago

dosbox staging gives a strange looking output... perhaps @kcgen could comment on that.

dosbox staging machine=cga

rderooy commented 4 years ago

When I play the YT video through audacity, it seems more similar to that of dosbox staging. But since it's a YT encoded video of an emulator, I don't fully trust it's authenticity.

kcgen commented 4 years ago

ECE includes a pc speaker patch by the vogons user Ripa that's been out there since 2011. It does a number of things differently; like using sine curves, and taking several passes through the audio sequence, and additionally applying a filter. It's very cpu intensive (relatively speaking) versus the existing pcspeaker code; so much so that I can't use it on my 1.3 GHz pi3.

For the most part, it makes many games sound essentially perfect versus original hardware. (Like various sounds in keen and duke 1), although some users have reported specific regressions too. That said, it overwhelmingly fixes more than it breaks vs the SVN implementation.

Given the patch came our in 2011, users have recently asked why it hasn't been incorporated into DOSBox SVN, but an answer has not been provided.

I have made some small changes so far to dosbox staging's pc speaker, but nothing drastic; mostly what I feel are cleanups (trying to hold DC centerline, fast DC offset reduction, and equal power output for square waves vs pwm waves, for more comfortable listening).

The next round, I hope to lift out the key influencing aspects from ripa's patch and see if we can get similar sound without too much change or cpu usage. But that remains to be seen :-)

Both X and staging's speaker code came from SVN, and both are functionally extremely similar; so I think there's excellent opportunity for both groups to tinker with this effort of teasing apart ripa's patch code just to some fundamental bits than we can add, with little runtime cpu code or drastically altering the code structure.

rderooy commented 4 years ago

Thanks for the reply @kcgen . You may want to add the original 1987 Arkanoid by Imagine (European Release), linked above, to your PC Speaker test list (not to be confused with the far more common 1988 Arkanoid by NovaLogic released in the US).

kcgen commented 4 years ago

Will do, thanks @rderooy !

usergithub64 commented 4 years ago

Also, try setting 'enable pci bus=false' to make sure I/O has ISA bus type delays instead of faster PCI ones.

After setting "enable pci bus = false", nothing has changed in terms of sounding music in the mode svga_s3. I once again checked the sound of music in Arkanoid game with cycles = 240 in DOSBox-X v0.83.3 x64 SDL1, DOSBox-Staging v0.75.0, DOSBox ECE r4338, DOSBox SVN-Daum. There are differences in all versions of the DOSBox in the svga_s3 mode. The music sounds differently (a little rough or wheezing). In сga or cga_mono mode, in all DOSBox versions the music sounds the same and more correct.

rderooy commented 4 years ago

The

[dosbox]
enable pci bus=false

option is dosbox-x specific, it has no effect (is ignored) on other dosbox flavours. And to me it did have an effect if you look above as it causes the ramp-up and down to be smoother, but the overall level to be lower.

Torinde commented 1 year ago

VOGONS ripa thread with .diff file - would really like to have that as an option!

Torinde commented 1 year ago

http://j-o.users.sourceforge.net/qemu/ tone generation only by playing square waves through the host's sound card https://dosbox-staging.github.io/v0-79-0/#ripasPCspeakerPatch