Closed KynikossDragonn closed 1 year ago
I think there is something wrong with the sampling rate conversion.
Try IT m32000
(or any value smaller than 44100)
Yeah, that makes things play at the proper "pitch".
Weird, I'm not getting this problem in games set to use "44100 Hz", like Blood and Duke Nukem 3D. And also Z.A.R. when run with the special MMX version.
Is it because of IT outputting at "45454" like the driver screen reports?
Looking at the code (sblaster.cpp), the upper limit is set to 44100Hz. You can disable that by adding the following option to the [sblaster] section in the conf file. This may also fix the pitch problem of ZSNES mentioned here #3178
[sblaster]
sample rate limits = false
#default is true
Adding this to the [sblaster] section does indeed make it work correctly at the full sample rate, thanks!
Someone did mention there's two ways to specify a sampling rate on a SB16, the "old" method which ends up with that weird 45454hz setting, and then a "direct" method which will result in actual 44100hz. I'm guessing IT and ZSNES uses the "old" method and games using Miles Sound System, HMI, Apogee Sound System, etc use the "direct" method atleast if you're using the actual Sound Blaster 16 drivers with those middlewares and not "SoundBlaster or 100% Compatible" or "SoundBlaster Pro or 100% Compatible".
FastTracker II, atleast 8bitbubsy's patched versions, didn't require this setting under [sblaster] and sounded correct already.
Some DOSLIB tests done a few years ago suggest that the sblaster.cpp sample rate limits should be updated. Sound Blaster cards max out at 45454Hz whether SB16 DSP commands or SB Pro commands.
If you're wondering what the visible spikes are in the graphs, well... older SB16 cards have a bug in the DSP firmware that can miscalculate the sample rate when given very specific sample rate values, also note the visible stairstep since SB16 cards internally convert the DSP time constant to sample rate and then round to the nearest rate it can support. Later SB16 cards don't have those sample rate bugs.
Also notice that on SB16 cards, sample rates up to 45454Hz are possible without ever using the special "high speed" DSP playback commands.
Sound Blaster Live! PCI cards (with the resident MS-DOS SB16 emulation driver) don't cap the sample rate at all. Using the old DSP time constant commands you can go up to about 165KHz.
ESS AudioDrive chipsets cap the sample rate at 44.1KHz if you talk to it like a Sound Blaster. If you use the ESS-specific DSP commands instead, you can go as high as 200KHz, though on the laptop I tested on, any disk I/O causes drops in the sample rate because the ISA bus within can't handle both disk I/O and DMA that fast.
If you have a mid to late 90s laptop with the Yamaha OPL3-SAx chipset, which is Sound Blaster Pro compatible, the chipset does not cap the sample rate and you can go as high as 325KHz, though again, disk I/O will cause contention with the ISA bus and cause drops in sample rate.
Code of Conduct & Contributing Guidelines
Have you checked that no other similar bug report(s) already exists?
What operating system(s) this bug have occurred on?
Void Linux x86_64 (Linux Kernel 5.15.28)
What version(s) of DOSBox-X have this bug?
0.83.24 SDL2 x86_64 commit 05ed306681e212121ba211c45c1e404804ce8a36
Describe the bug
In Impulse Tracker using Sound Blaster 16 (it doesn't matter if you use the regular driver or the MMX driver) the audio is played back at a incorrect pitch, almost like the sample rate is wrong.
IT reports the mixing rate is 45454 Hz. But, the audio sounds 25% slower.
I've tested the normal, dynamic_x86 and dynamic_rec cores and machine type pentium and pentium_mmx, audio sounds slow regardless of these settings.
cputype=pentium_mmx is required for ITSB16.MMX driver.
This problem doesn't occur in mainline DOSBox 0.74.3 however.
Expected behavior
Audio shouldn't sound slowed down as if the audio sample rate is mismatched between IT and the SB16 emulation.
Steps to reproduce the behaviour
Used configuration
Emulator log
Additional context
DOSBox-X does not crash or hang when using pentium_mmx with Impulse Tracker. Resonance filters work as intended without errors/hangs/crashes. The only thing that's incorrect is the slowed down audio pitch. CPU cycles don't seem to matter in this either.