Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUS emulation: digital audio is still mono #171

Closed
GranMinigun opened this issue Feb 13, 2020 · 8 comments
Closed

GUS emulation: digital audio is still mono #171

GranMinigun opened this issue Feb 13, 2020 · 8 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@GranMinigun
Copy link
Contributor

Long time ago upstream DOSBox had a problem in topic. I remember that there was a patch accepted into SVN, but maybe it was just for MIDI output.

Games like Crusader: No Remorse utilize GUS' HW mixing feature, but even those games still output digital audio in mono. Another could-be-problem is that sound is real quiet compared to SB, PC Speaker and, well, General MIDI output (can't remember if GUS' MIDI's quiet too, will need to check).

Checked Doom, Crusader dilogy, Duke Nukem 3D, Daggerfall (though it's broken there - because MSS). It doesn't matter whether I use stable release, SVN, ECE or Staging. Maybe there's something in DOSBox-X fork? Or could it be me with incorrect setup?

@kcgen
Copy link
Member

kcgen commented Feb 13, 2020

jmarsh on vogons mentioned:

gusrate shouldn't really be a thing, it has a side-effect of messing up stereo separation in some games if it's not a multiple of the internal gus frequency.

Although jmarsh doesn't share what that frequency is, we can figure it out from the Gravis_UltraSound_Manual.pdf.

Gravis' manual mentions powers-of-two multiples of 11025 when discussing their recording software (bundled with the card):

"10. Frequency: Sets the speed for your file; 44100 Hz, 22050 Hz, or 11025 Hz"

It further narrows this recommendation on page 31:

The default setting is 22050 Hz, or 22 kHz. You can set the frequency anywhere from 0–48000 Hz. UltraSound programs use 22 kHz as a default.

So although the hardware supports variable frequencies, there are two places in the manual specifically recommending using 22 kHz.

The card's frequency response appears to drop off very close to 11 kHz, which would require a Nyquist sampling frequency of double that; which is more evidence that it's 22 kHz:

gusmix
gusout

So the fix for this might simply be to limit the [gus] gusrate = to 44100 Hz, 22050 Hz, or 11025 Hz, with the default being 22050.

@kcgen kcgen added the good first issue Good for newcomers label Feb 13, 2020
@GranMinigun
Copy link
Contributor Author

Nice, thanks for the insight.

Checked all of the available gusrate settings - only 22050 Hz and 11025 Hz give stereo output. But it's still pretty quiet. I never had any of SBs nor GUS so I can't tell whether that's how it is on real hardware or not. I'm fine with SB/GUS combo, but GUS in that case is barely heard when something's going on in game (and in Crusader it's almost barely audible).

Side note: when using SB on HDMA which gives 16bit sound output, it's also noticeably quieter than when it's output on DMA. (Again, Crusader. Needs more test-cases. Should we split volume question into another issue?)

On the other hand, MIDI output is affected by gusrate in terms of quality (obviously), but it always gives stereo music no matter the setting. I don't think that limiting setting is a way to go. As I understand, splitting it for SFX and MIDI is not possible because of how GUS works?

Tested Crusader a little bit more. Turns out it never gives stereo output with GUS no matter the rate.

@kcgen
Copy link
Member

kcgen commented Feb 14, 2020

Yes, I also need to boost the GUS mixer level many-fold on almost all of my GUS games; typically between 400% and 800%, if I recall. I haven't used GUS MIDI though (always send it out to timidity or munt); nor have I checked GUS stereo in detail.

But these all sound like pretty major emulation flaws (if it's not how the real hardware worked).

Do you have a vogons account? You could describe what you're experiencing in in the hardware soundcard thread and see if anyone with real hardware experiences the same behavior - and hopefully people will confirm or refute the issues.

From there, assuming there is an emulation-gap vs hardware GUS, you could follow up with a ticket on SVN and post the issue in the DOSBox thread.

@kcgen
Copy link
Member

kcgen commented Feb 14, 2020

If the original hardware had poor or no stereo separation at frequencies other than 11 or 22kHz, and if the GUS produces significantly lower output power/volume versus the same game playing back output via 8-bit Sound Blaster, then both of these appear to be defects from a user-experience perspective.

Unlike tube amps adding 'warmth' to the sound, I would say there is nothing endearing or charming about truthfully emulating the loss of stereo separation at 44.1 and 48 kHz. Likewise, it's benefiting no one to 'accurately' dimish output volume - to the point where you can't hear it over other emulated sound devices.

So these are areas ripe for 'supra-emulation', that benefit the user experience by deliberately breaking from strictly reproducing authentic but detrimental hardware behavior.

(me: bracing for counter-arguments from hardware purists who claim the loss of stereo-separation output is actually better)

@kcgen kcgen self-assigned this Mar 2, 2020
@kcgen kcgen added the bug Something isn't working label Mar 2, 2020
@kcgen
Copy link
Member

kcgen commented Mar 2, 2020

@GranMinigun , thanks for the report.
Confirmed this and addressed it by constraining the GUS's configurable playback frequencies.
(See #193)

@dreamer
Copy link
Member

dreamer commented Mar 3, 2020

Fixed in 2d76132 :)

@dreamer dreamer closed this as completed Mar 3, 2020
@GranMinigun
Copy link
Contributor Author

Honestly, I wouldn't consider that as a real fix (and it was already pointed out that it workarounds just a very limited number of cases). Guess I'll just open up another issue for general sound emulation problems, as it seems that there's a whole lot of them.

@dreamer
Copy link
Member

dreamer commented Apr 6, 2020

Well, "the limited number of cases" was asserted by several people without actually giving any example of a specific program or use-case, that is not correctly emulated.

I am ok with opening follow-up issue for GUS emulation problems, but we need to have real test cases to address (and not merely claims about capabilities of the original GUS hardware).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants