dosbox-staging / dosbox-staging

DOSBox Staging is a modern continuation of DOSBox with advanced features and current development practices.
https://www.dosbox-staging.org/
Other
1.31k stars 154 forks source link

Inaccuracies with Tandy 3 Voice emulation (Dune 2) #3352

Closed codeflorist closed 8 months ago

codeflorist commented 8 months ago

Are you using the latest Dosbox-Staging Version?

Different version than latest?

No response

What Operating System are you using?

Windows 11

If Other OS, please describe

No response

Relevant hardware info

No response

Have you checked that no other similar issue already exists?

A clear and concise description of what the bug is.

there seem to be some inaccuracies with Tandy 3 music emulation (at least with Dune 2).

(since Dune 2 cannot actually be played in DOSbox with Tandy 3 voice (since there is no machine = tandy_vga), this issue not really has any actual effect. none the less it might show some underlying inaccuracies with Tandy 3 music emulation, that also affects other titles.)

an example would be the Dune 2 intro track, which has some rapidly rising notes a after about 8 seconds in. the last high note should be held for several seconds, but instead a low louder note is played.

at least i think it should be this way (i have no tandy to verify how it actually sounds). but the PC speaker version does it that way. furthermore i extracted the sequence from the XMI file into a midi file using SSplayer. and playing that in windows also has that high tone.

here is a package with the recorded track as mp3, the original xmi file and the extracted midi file: https://drive.google.com/file/d/1DMGwh3mjDYELtWUv6BqoGbkeMdAxYYVc/view?usp=sharing

a lot of tracks sound rather wonky.

here is the full soundtrack: https://drive.google.com/file/d/1y9mAQ2jpVZMESdZjPLC3kaQOA6z_wFvC/view?usp=sharing

and here the PC speaker recording for comparison (imho it sounds ok): https://drive.google.com/file/d/1yaMgiytimvUjclDs6Ok220BogBBXzpiS/view?usp=sharing

i played the tracks in DOSbox using PX player. for dune 2 itself to play the track, you have to set machine = tandy. this will result in Dune2 having no graphical output (since it's a VGA game), but it will play sounds. the Westwood-logo jingle plays fine. it is then followed by the intro.

i have tried regular DOSbox, DOSbox-X as well as the newest RC2 of dosbox-staging. they all sound largely the same.

Steps to reproduce the behaviour.

Explain how to reproduce

  1. set machine = tandy in dosbox config
  2. launch dune 2 (set sound to tandy in setup first)
  3. wait for westwood-logo jingle to play
  4. the incorrect note plays after anout 8 seconds into the intro music.

Alternative reproduction: use PX player (linked above) and play the track from the original XMI file included in the linked package like so: px DUNE0.TAN.XMI TANDY.ADV 2

Download URL of affected game or software

https://archive.org/details/000692-Dune2TheBattleForArrakis

Your configuration

machine = tandy

Provide a Log

No response

Code of Conduct & Contributing Guidelines

johnnovak commented 8 months ago

at least i think it should be this way (i have no tandy to verify how it actually sounds). but the PC speaker version does it that way. furthermore i extracted the sequence from the XMI file into a midi file using SSplayer. and playing that in windows also has that high tone.

That's the problem, you're trying to infer correct behaviour from how other sound drivers of the game play certain tunes. Then you extract some data files from the game, with zero proof that's the data file the game actually uses for Tandy music, play it in some other 3rd party players, and make assumptions from that.

This is not how this works 😄 We could be chasing our tails all day if we took such reports seriously.

Closing, there are too many variables where this reasoning can go completely wrong.

PS: I used PX player before and there are several problems with it. Make no mistake, it's cool and it's great to quickly play some tunes you already know well, so you can be sure it plays the correct MIDI etc., but I would never use it for proving anything.

Many games use very similar but slightly different MIDI files for different audio drivers. That confused me for days initially why some MIDI files sounded subtly different when played with PX... because I picked the wrong file when I used PX! TL;DR, you can't prove much by this method. Also, the game could do some other hardcoded manipulation of the audio hardware and the data stream which is not in the extracted MIDI file, etc. For example, some games have the tempo hardcoded in the game exe or some other data file. PX will play the files at the wrong default MIDI tempo. And so on...

kcgen commented 8 months ago

Well said, @johnnovak :-)

@codeflorist, when possible, compare against real hardware recordings.

How does that Dune 2 track sound when PX Player is run on real hardware with a Tandy SN76496 3-voice card?

after about 8 seconds in. the last high note should be held for several seconds, but instead a low louder note is played

The tandy 3-voice is very simple - there is no such thing as a sound bank / instruments / or commands to play "notes". The three voices are simply waveform frequency generators; it's up to the software to drive them. So I would assume the track itself is the problem or there's something wrong in translation from XMI to 3-voice in PX Player.

When it comes reputable sources of hardware recordings, here are two that push the Tandy 3 voice emulation to its limit:


Nerdy Pleasures captured Zak McKracken and the Alien Mindbenders's intro sequence from his Tandy 1000 TL (time set to intro starting at 251s):

https://www.youtube.com/watch?v=wt-_ashF6EA&t=251s

Now here's DOSBox Staging recording of that same intro:

https://github.com/dosbox-staging/dosbox-staging/assets/1557255/efb7c174-71b5-4bb5-9f0c-6ba6130183c5

Note that Nerdy Pleasures mentions timing of the video is also critical:

"here is a sample of them running at their ideal speed with their ideal graphics and sound. The intro for Zak McKracken is particularly timed so that the music ends when Zak walks off the final screen with the giant face mask. The music for the non-enhanced version of Zak is identical and similarly timed on both the PC and the C64."

Notice that the DOSBox Staging recording matches this ideal timing, with the audio and video events lining up perfectly against the Nerdy Pleasures video.

Here are the settings to get that in Staging ``` ini [cpu] core=normal cycles=920 [dosbox] machine=tandy memsize=1 startup_verbosity = quiet [render] cga_colors = tandy 50 [mixer] reverb = on chorus = on [midi] mididevice = none [ethernet] ne2000 = off [speaker] pcspeaker = off tandy = on lpt_dac = none ps1audio = false tandy_filter = lpf 1 4800 tandy_dac_filter = off [render] aspect=true [sblaster] sbtype = none oplmode = none [joystick] joysticktype = disabled [dos] xms = false ems = false umb = false [composite] composite = off era = auto [autoexec] @echo off imgmount a floppies/disk1.img floppies/disk2.img floppies/disk3.img -t floppy a: zak ```

Cloudschatze captured Skate or Die's intro sequence from his Tandy 1000 RL:

https://www.youtube.com/watch?v=I8_z_CI37JE

He mentions:

"SN76496 "3-voice" tones, noise-channel drums, and 4-bit playback of PCM digital samples. Audio recorded directly from a Tandy 1000 RL system, with additional stereo-chorus and EQ effects applied."

Now here's DOSBox Staging recording of that same intro:

https://github.com/dosbox-staging/dosbox-staging/assets/1557255/26900121-f52f-450f-bf19-14f4b24e972d

Notice Staging's guitar riffs and pitch bends are all accurate.

Here are the settings to get that in Staging ```ini [dosbox] machine=tandy memsize=1 startup_verbosity = quiet [cpu] core=dynamic cycles=1000 [mixer] rate = 48000 crossfeed = on reverb = light chorus = strong [midi] mpu401 = none mididevice = none [gus] gus = off [sblaster] sbtype = none oplmode = none [speaker] pcspeaker = none disney = false tandy = on tandy_filter = lfp 1 14000 [joystick] joysticktype = none [dos] xms = false ems = false umb = false [autoexec] @echo off mount c . c: cd SkateorD mixer tandy 150 autotype -w .3 t , enter @skate exit ```
johnnovak commented 8 months ago

Those are some good examples @kcgen. The Skate or Die example in particular uses very advanced low-level tricks to play PCM samples using the Tandy PSG (it does not use the optional Tandy DAC). Given the most technically impressive Tandy tunes play perfectly in Staging compared to real-hardware recordings, you have a tall task ahead of you to prove something is indeed wrong with our Tandy emulation 😎

I'm not saying there is zero chance you're right, but the chance is rather low. And extraordinary claims need extraordinary proofs 😎

codeflorist commented 8 months ago

@johnnovak and @kcgen

forget all the third party stuff. you don't need it to listen to the Tandy version of the intro, notice that it sounds very strange, and compare it the the PC speaker.

just follow the reproduction steps i posted:

  1. set machine = tandy in dosbox config
  2. launch dune 2 (set sound to tandy in setup first)
  3. wait for westwood-logo jingle to play
  4. the incorrect note plays after about 8 seconds into the intro music. the whole track sounds weird, also the main menu track sounds weird.

no third party app necessary.

i don't have proof of how the game should sound on real Tandy hardware - that is true.

zero proof that's the data file the game actually uses for Tandy music

i extracted the files from SOUND.PAK from the original Dune 2 game files. the files ending with TAN are the xmi-files for Tandy - as documented here: https://github.com/OpenDUNE/OpenDUNE/wiki/Dune-II-file-formats

i'm the current maintainer of Dune Dynasty by the way. so i know a bit about Dune 2's filestructure.

johnnovak commented 8 months ago

i don't have proof of how the game should sound on real Tandy hardware - that is true.

Please come back if you can provide a real hardware Tandy recording. As minimum proof, check the Tandy output in PCem / 86box. Maybe the Tandy driver is broken, or the devs thought, "lol, this is fine" for all we know 😄

Btw, the soundtrack was clearly composed for MIDI and high polyphony. The AdLib conversion is surprisingly good, but I guess that's because you can still do relatively high polyphony on the OPL. What I think most likely they just ran the original MIDI through some automated process, or spent a few hours doing a stripped-down Tandy version so they can slap the "Tandy support" label on the box, and called it a day... Probably they just did not care.

Many of the MIDI to AdLib (and similar) conversions in games originally composed for MIDI are absolutely atrocious. Many devs just "ticked a box" so to speak and threw something to those people stuck on AdLib without much thought, that's very clear.

I find that much more likely than you finding a bug in the Tandy playback, to be honest. Again, hardware recording please, and then we're talking.