joncampbell123 / dosbox-x

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

The famous game Tyrian2000 , the problem of abnormal sound effects. #2381

Open crashGG opened 3 years ago

crashGG commented 3 years ago

When using the dosbox-x to play the game Tyrian2000, the sound effects of the game (click the menu, the explosion sound) are noisy. (Tested dosbox-x 0.83.11, dosbox-x 0.83.10, sdl, sdl2 ,vc,32bit,64bit) But when use the official dosbox0.74.3, dosbox-ece 4441, dosbox-daum, but there is no such problem.([sdl]output=surface or overlay)

Here is the latest 3.0 version of the game https://mega.nz/file/Y1I3QY5C#Nm9DZwxXsrEa0zLrpUxUOQterEm1IN7q_PjLFz9kKBk

grapeli commented 3 years ago

@crashGG Moving from item to item in the menu sounds much worse compared to SVN. I agree. It can be seen and heard. dosbox-svn sample dosbox-svn.sample.wav.txt dosbox-x sample dosbox-x.sample.wav.txt

The dosbox-x sample contains a lot of distortion. Vertical lines on the spectrogram. In the case of dosbox-x I set disable filtering=true, because in my opinion it gives better sound.

Tyrian2000 sound level was set to max, music level to minimum.

joncampbell123 commented 3 years ago

The game is using Sound Blaster DMA in a manner that start and stops DMA per block that DOSBox-X cannot quite handle yet:

LOG: 220728936 SBLASTER:limiting amount masked to sb.dma.min LOG: 220728936 SBLASTER:DMA masked,stopping output, left 235 LOG: 220728972 SBLASTER:DMA unmasked,starting output, auto 0 block 382 LOG: 220729047 SBLASTER:DMA unmasked,starting output, auto 0 block 382 LOG: 220729047 SBLASTER:DMA Transfer:8-bits PCM Mono Single-Cycle freq 10989 rate 10989 size 384 gold 0 LOG: 220782299 SBLASTER:limiting amount masked to sb.dma.min LOG: 220782299 SBLASTER:DMA masked,stopping output, left 226 LOG: 220782335 SBLASTER:DMA unmasked,starting output, auto 0 block 382 LOG: 220782430 SBLASTER:DMA unmasked,starting output, auto 0 block 382 LOG: 220782430 SBLASTER:DMA Transfer:8-bits PCM Mono Single-Cycle freq 10989 rate 10989 size 384 gold 0

jaroslavl1 commented 3 years ago

I noticed this issue as well on Dosbox-x 0.83.13 (sdl, 32bit). Audio works fine on Dosbox 0.74.3 and also on 86Box (12th May 2021). It's not just movement in menu but also sound effects while playing. For the moment it seems the latter emulators are a better choice until this issue is fixed.

grapeli commented 2 years ago

git bisect bad 21c98db bad 1d11d7e optimize addSamples slightly by lifting two conditional checks out of the loop bad 3174dd5 DOSBox-X mixer rewrite. Higher precision sample rate conversion and channel rendering. good 5966667 ess bugfix: dma count in bytes is assigned to total as-is, because 8-bit DMA. sorry. good 7841f5a fix "advanced power management"

In my opinion, this commit 3174dd5 "DOSBox-X mixer rewrite" is responsible for the deterioration of the sound quality in the Tyrian2000 game menu.

Good. This is what it sounds like in dosbox-x, last good 5966667.

https://user-images.githubusercontent.com/452325/159039718-572bbdc8-fc26-48b9-8b05-a9ad48c339db.mp4

Bad. This is what it sounds like in dosbox-x, first bad 3174dd5.

https://user-images.githubusercontent.com/452325/159039775-54d888df-52a9-4eab-b983-30e109eb53c7.mp4

Bad. Current.

https://user-images.githubusercontent.com/452325/159039809-77c9ed1d-5c7d-45ee-acc8-edbe867a7d80.mp4

grapeli commented 2 years ago

Opentyrian (linux) running on DOSBox-X shows similar symptoms. Even more intense. They also apply to music.

opentyrian.zip

I run like this. dosbox-x -fastlaunch -set memsize=24 -set cputype=pentium -set cycles=max -set core=dynamic_x86 -c "mount c tyrian" -c "c:" -c "tyrian.bat"

In the same opentyrian run under qemu, sound and music resound without any distortion. qemu-system-x86_64 -machine pc,accel=kvm -cpu pentium -vga std -display sdl -m 32 -net none -device sb16,iobase=0x220,irq=7,dma=1,dma16=5 -kernel ./tyrian/vmlinuz -initrd ./tyrian/tyrian.sqf -append 'root=/dev/ram0 video=vesafb:ypan,mtrr:0 ro vga=889 ide-core.noprobe=0.1 ide-core.noprobe=1.0 ide-core.noprobe=1.1 snd-sb16.isapnp=0 snd-sb16.port=0x220 snd-sb16.irq=7 snd-sb16.dma8=1 snd-sb16.dma16=5 quiet loglevel=1' -monitor stdio When using tcg, it may be useful to reduce the resolution to a lower 640x400x32, i.e. the vga parameter vga=833.

grapeli commented 2 years ago

With this setting dosbox-x -set "mixer sample accurate=true"

after all, the sound in Tyrian2000 and Opentyrian is as good as it should be.

Oh! It took an awfully long time to find the right settings.

edit: Git bisect pointed to the 3174dd5 commit well. However, this change was so extensive that I skipped browsing it, believing that I would not read anything wise from it. Only after looking again I noticed that the new mixer settings had arrived - sample accurate.