DOSBox and SB mixer volume steps

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

DOSBox and SB mixer volume steps

Postby James-F » 2017-6-02 @ 18:20

Code: Select all
Mixer   SBPro2   SB16

00,15   -48.5   -57.5
01,15   -48.5   -54.8  *
02,15   -27.3   -51.0
03,15   -27.3   -47.2  *
04,15   -21.5   -43.2
05,15   -21.5   -39.6  *
06,15   -15.7   -35.6
07,15   -15.7   -32.0  *
08,15   -11.0   -28.0
09,15   -11.0   -24.0  *
10,15   -7.0    -20.0
11,15   -7.0    -16.0  *
12,15   -3.0    -12.0
13,15   -3.0    -8.0   *
14,15    0.0    -4.0
15,15    0.0     0.0   *


These are mixer values from the hardware cards, true for MASTER, VOC and FM and normalized to 0db.
Unfortunately DOSBox is not even close.
It's here for future reference.

The * is what the SB16 gives at SBPro addresses 0x04 0x22 0x26 0x28 with write commands.
They (*) are also the 0-7 steps of the SBPro mixer.
Last edited by James-F on 2017-6-06 @ 14:58, edited 5 times in total.
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox and SB mixer volume steps

Postby ripsaw8080 » 2017-6-02 @ 18:50

DOSBox's calculation of the volume steps uses a logarithm, and I've wondered for some time if it was modeled on perception of loudness rather than how samples should be scaled. I find that linear scaling of samples creates a more reasonable volume ramp in practice, although it's probably not correct. As it is now, the lower half of the scale is mostly inaudible unless external amplification is turned up to an unreasonable level.

I found "evidence" in the somewhat obscure adventure game "Trick or Treat", where the FM volume level set by the game can lead one to not realize there is intro music. It is possible to increase the FM volume using an in-game option, but only after the intro, and the game does not remember the setting from one session to the next. Currently, one must use the sbmixer=false setting in DOSBox to hear the intro music.
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4075
Joined: 2006-4-25 @ 23:24

Re: DOSBox and SB mixer volume steps

Postby James-F » 2017-6-02 @ 19:25

A simply look up table is all it takes, PCem uses LUT and it works great, I've tweaked it to match exactly the SB hardware.
I don't see why DOSBox should use an alternative, not according to the SB HW prog guide.

I've also tweaked in PCem the lowpass filters to match exactly the SBPro (Butterworth 2nd order, IIR), for PCM and OPL, and balanced between them, sound virtually indistinguishable from the real card.
Have a look, maybe something be relevant to DOSBox:
https://pcem-emulator.co.uk/phpBB3/viewtopic.php?f=2&t=729
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox and SB mixer volume steps

Postby Qbix » 2017-6-03 @ 16:09

The SB MASTER channel is handled differently from the SB FM channel in DOSBox. So I am sure you will get some mind bogging results if you try to make sense of it.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10363
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox and SB mixer volume steps

Postby Qbix » 2017-6-03 @ 17:23

btw, if we go with the values that you measured, then that specific game will be even more quiet.

wonder if we should boost the overall volume level. (as the mixer defaults in sb hw guide mentions -12- -14 as default)
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10363
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox and SB mixer volume steps

Postby James-F » 2017-6-03 @ 19:30

No, don't boost the volume, DOSBox is way too loud as it is now.

Are you sure about the -12db defaults in doesbox? I see that the mixer is 100% at start on all addresses.
Also, when I send SBP-SET.EXE /M:15 I don't measure volume difference, so the mixer is already maxed at startup.
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox and SB mixer volume steps

Postby Qbix » 2017-6-03 @ 19:42

No, dosbox defaults to 0 db.
But the sb hw guide mentions -12 db as default.
btw if you should check the mixer for /FM:
then you should get better results. There should be regular steps for each value for that.
/M: is not recommended, if I look at the source as that is totally not similar to your measurements.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10363
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox and SB mixer volume steps

Postby James-F » 2017-6-03 @ 19:43

According to the guide Master, Voc, and FM should behave the same.
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox and SB mixer volume steps

Postby Qbix » 2017-6-03 @ 19:46

James-F wrote:According to the guide Master, Voc, and FM should behave the same.

I know, but we don't do that (currently), hence my remark to not test that any further, as it doesn't behave any where near the specs. So your tests will be in vain, as we don't use a LOG in there. (Which I will probably correct)

FM should behave better as that has at least a LOG scale :) although it will probably be off as well a bit
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10363
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox and SB mixer volume steps

Postby James-F » 2017-6-04 @ 04:10

I tested changing FM volumes 0-15.
It does work but not up to specification as you said, sometimes there's more than 10db difference between the spec and dosbox.
I still suggest using a lookup table for the most accurate results.
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox and SB mixer volume steps

Postby Qbix » 2017-6-08 @ 18:04

corrected all mentioned problems in r4022:
1) master uses db scale as well.
2) sbpro1,2 use scale very similar to the one posted
3) sb16 uses a scale very similar to the one posted.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10363
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox and SB mixer volume steps

Postby James-F » 2017-6-08 @ 18:27

Tested and Confirmed, SB16 and SBPro mixers now work 1:1 like the real hardware.
Thanks Qbix!
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox and SB mixer volume steps

Postby Yesterplay80 » 2017-6-08 @ 21:37

James-F wrote:Tested and Confirmed, SB16 and SBPro mixers now work 1:1 like the real hardware.
Thanks Qbix!

Yes, thank ou Qbix79! And thank you James-F for your meticulous work to improve Soundblaster emulation!
My full-featured DOSBox SVN builds (without debugger) for Windows: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)
User avatar
Yesterplay80
Member
 
Posts: 240
Joined: 2016-2-23 @ 11:02
Location: Germany

Re: DOSBox and SB mixer volume steps

Postby ripsaw8080 » 2017-6-09 @ 01:05

It is still necessary to set sbmixer=false to hear the FM intro music in Trick or Treat, so that mystery remains.

The game uses only SBPro mixer registers, so testing with sbtype=sbpro1, increasing host amplification until the FM music is at a normal level results in DAC volume that is far too loud. With sbtype=sb16 the situation is worse, with FM almost inaudible even at maximum host amplification.

These are the mixer register values used:

reg 0x22 (SBPro Master) = 0xEE
reg 0x04 (SBPro DAC) = 0xCC
reg 0x26 (SBPro FM) = 0x66

Is it really the case that the game's initial value of 6 should produce such a low FM volume level? If so then the lower half of the range seems rather useless. Again, the FM volume can be increased with an in-game setting, but the intro is stuck with the initial value.
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4075
Joined: 2006-4-25 @ 23:24

Re: DOSBox and SB mixer volume steps

Postby James-F » 2017-6-09 @ 03:48

I've tested the games on the hardware and it shows exactly the same results.
On SBPro2 the FM music is quiet compared to PCM but still audible.
On SB16 the FM is at -50db and pretty much non-audible.
It's a game programming problem, as DOSBox mixer is now 1:1 with the hardware.
User avatar
James-F
Oldbie
 
Posts: 1405
Joined: 2015-11-30 @ 04:10

Re: DOSBox and SB mixer volume steps

Postby KainXVIII » 2017-6-09 @ 08:26

Yesterplay80 wrote:
James-F wrote:Tested and Confirmed, SB16 and SBPro mixers now work 1:1 like the real hardware.
Thanks Qbix!

Yes, thank ou Qbix79! And thank you James-F for your meticulous work to improve Soundblaster emulation!

And thank YOU for regularly uploaded dosbox ECE versions =)
User avatar
KainXVIII
Member
 
Posts: 216
Joined: 2015-5-20 @ 15:04
Location: Yaroslavl

Re: DOSBox and SB mixer volume steps

Postby ripsaw8080 » 2017-6-09 @ 08:51

Perhaps the developers of Trick or Treat, not exactly on the A-list, had a SBPro clone card that behaves differently in the mixer. That would at least make sense, and then a hardware compatibility issue rather than bad programming in the narrow sense. So sbmixer=false remains the solution in this game's case, and it actually allows some music to be heard that otherwise could not be (FM volume set to zero in the mixer).
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4075
Joined: 2006-4-25 @ 23:24


Return to DOSBox Development

Who is online

Users browsing this forum: No registered users and 2 guests