VOGONS


VSBHDASF: Fork of VSBHDA with Soundfont support

Topic actions

First post, by Cacodemon345

User metadata
Rank Newbie
Rank
Newbie

GitHub repository: https://github.com/Cacodemon345/VSBHDASF

This is a fork of VSBHDA that is equipped with the open-source TinySoundFont software synthesizer (with a few fixes incorporated from two PRs (one with dealing centibels-to-decibels conversion and other supporting the MIDI sustain command) and my own modifications to account for over-attenuation) in conjunction with MPU-401 support.

One could ask the question "Why did I make this?" or "Why the need when SBEMU's MPU-401 passthrough to real hardware is sufficient?".

I made this because:

  1. My system (motherboard Gigabyte B150M-WIND) has no PCI slots on-board.
  2. The case I'm using has no space for a PCIe-to-PCI adapter so it'd become a hassle I don't want to be dealing with.
  3. Although I could theoretically get the PCIe C-Media sound cards, I don't want to deal with the hassle of setting up the TSRs and the potential compatibility issues thereafter.
  4. Baron Von Riedesel has indicated no plans in the future for VSBHDA (not even AWE32 support, which would allow soundfonts to be loaded, and which I don't plan on, to be honest), and SBEMU development is seemingly halted at the moment outside the sound drivers.
  5. Most systems with onboard AC97/HD Audio since 2001 does not provide MPU-401 emulation (unless redirecting it to one of serial ports like SBEMU), and many desktop systems released today with CSM support does not come with the serial port on the backside, instead requiring the pins to be manually wired up to a real one which can be a hassle to deal with.
  6. Many laptops even before the Skylake/Kaby Lake era have no serial port outside for obvious reasons, making MPU-401 redirection impossible.
  7. Paying for real SC-55 units on eBay in my country is too expensive for me, and doing a smartphone setup with MIDI on one side and serial port on the other would be too much effort for too little gain anyways.
  8. I also wanted to make this for fun purposes and also to save money since I have no working PCs with PCI slots proper.

There are three executables to use. One is optimized for SSE2 instructions (named vsbhdap4.exe), one is targeted at all x86 CPUs with FPU (named vsbhda.exe) and one is targeted at CPUs supporting MMX. There's also a zip attached for easy setup.

MPU-401 emulation is UART-only. There's also no support for 16-bit HDPMI hosts and it does not compile with Open Watcom at the moment, only with DJGPP makefiles.

Set environment variable SOUNDFONT to the path of the soundfont you want to load, and then launch any one of either vsbhda.exe, vsbhdamx.exe or vsbhdap4.exe with the appropriate arguments.

Tested with Duke Nukem 3D Atomic Edition, Vanilla DOOM 2, MBF source port and the DOSMID MIDI playback program. Tested on Gigabyte B150M-WIND motherboard with FreeDOS 1.4 RC1 installation using Intel i5-6500 (not virtualization). It also works on VirtualBox (although make sure to run Duke Nukem 3D on VESA 2.0 modes to avoid severe slowdown and audio glitches). I don't know if it will work very well with Pentium 4s (although TinySoundFont is said to work well for ARM systems) but it should work well on Pentium Dual-Core systems at the very least.

Note that bug reports from non-HD Audio systems (and especially AC97-related ones from certain SiS chipsets) are given lower priority due to my inability to maintain them.

Contributions are welcome.

Last edited by Cacodemon345 on 2025-01-29, 06:02. Edited 1 time in total.

Reply 1 of 104, by Cacodemon345

User metadata
Rank Newbie
Rank
Newbie

I updated the README file on the repository with instructions on setting up the path to soundfont, as well as adding information on compiling it.

There's also a new point release adding GS Master Control sysex support.

Reply 3 of 104, by Cacodemon345

User metadata
Rank Newbie
Rank
Newbie

New release fixing some attenuation bugs of TinySoundFont is out. There's also a change related to attack duration of voices to be more spec-compliant.

Reply 4 of 104, by ViTi95

User metadata
Rank Oldbie
Rank
Oldbie

Finally, I tested it on my eBox (Vortex86MX @ 933 MHz with 512 MB RAM). It works, but there are random performance hiccups. For example, FastDoom with 2GMGSMT.SF2 (the 2 MB soundfont from the AWE32) runs perfectly fine at 35 FPS, but occasionally the game slows down to 2-3 FPS. Sometimes it even crashes during these slowdowns. Perhaps you could provide an executable with MMX support, as this CPU supports it.

https://www.youtube.com/@viti95

Reply 5 of 104, by Cacodemon345

User metadata
Rank Newbie
Rank
Newbie

Pentium MMX executable is now provided. Batch files, however, now default to using IRQ 2 instead of IRQ 5/7, to avoid problems with certain games.

@viti95, you can try setting the IRQ used by VSBHDASF to 2 and see if it helps.

Reply 6 of 104, by ViTi95

User metadata
Rank Oldbie
Rank
Oldbie

I've tested the new MMX executable, it's a bit faster, but there are still huge slowdowns. Also changing IRQ 5 to IRQ 2 didn't make any difference.

I guess this cpu is not fast enough

EDIT: It might be a good idea to add a command-line parameter to select a custom frequency for MIDI rendering in TinySoundFont. Using a lower frequency could potentially reduce the CPU time required for rendering MIDI.

https://youtu.be/klvMr7NKQq8?si=0WnGLpWaklKW6BLT

https://www.youtube.com/@viti95

Reply 7 of 104, by Cacodemon345

User metadata
Rank Newbie
Rank
Newbie

It's probably crumbling down under heavy voice processing loads or heavy disk I/O. I'll probably add a parameter to set the maximum limit for voices.

At least my estimations were on-track, seems like it's going to work way better on Pentium 4+ systems with SSE2.

Reply 10 of 104, by digger

User metadata
Rank Oldbie
Rank
Oldbie

Oooh, nice! 🤩 Having an integrated wavetable MIDI softsynth is a great addition, but it's also just awesome that some new life is being breathed into VSBHDA in general.

I'll definitely take a look at this when I'm home from work. Good job, and thanks for sharing this!

Reply 11 of 104, by Nemo1985

User metadata
Rank Oldbie
Rank
Oldbie

Hello and sorry for the dumb question, I use sbemu on my p4 platform (motherboard: P4S5A/DX+) but it had issues with build engine games, can this fork used as replacement of sbemu?

Reply 12 of 104, by digger

User metadata
Rank Oldbie
Rank
Oldbie

Any chance that you could integrate munt into VSBHDASF as well, so so that it could also emulate the Roland MT-32 and CM-32 synthesizers as well? 😇 That, along with PCjr/Tandy 3-voice synth emulation, would make it a universal "one-stop shop" emulation solution for pretty much every DOS game out there.

Again, impressive work!

@Nemo1985 Yes, VSBHDA (and by extension VSBHDASF) is an alternative for SBEMU. All these emulators serve basically the same purpose. SBEMU does have one advantage over VSBHDA(SF) in that is supports a number of additional PCI and PCIe-based sound cards as well. But VSBHDA already supports the most important and common ones.

Reply 13 of 104, by Cacodemon345

User metadata
Rank Newbie
Rank
Newbie
Kamerat wrote on 2025-01-27, 12:45:

Very nice, Cacodemon345!

Do you have any plans for adding support for hardware synths like the ones on Sound Blaster Live!, Audigy and X-Fi?

I don't have hardware on-hand for those, so I wouldn't be able to properly add support for those. So, unfortunately it's a no.

digger wrote on 2025-01-27, 13:02:

Any chance that you could integrate munt into VSBHDASF as well, so so that it could also emulate the Roland MT-32 and CM-32 synthesizers as well? 😇 That, along with PCjr/Tandy 3-voice synth emulation, would make it a universal "one-stop shop" emulation solution for pretty much every DOS game out there.

I probably can add Munt emulation, but I'm not sure about adding Tandy emulation.

I will think about the latter later.

Nemo1985 wrote on 2025-01-27, 13:00:

Hello and sorry for the dumb question, I use sbemu on my p4 platform (motherboard: P4S5A/DX+) but it had issues with build engine games, can this fork used as replacement of sbemu?

I also fixed the Sound Blaster sample rate bugs in this fork so Build Engine games from 3D Realms should work well (especially Duke Nukem 3D Atomic Edition), as well as Rise of the Triad.

Reply 14 of 104, by Nemo1985

User metadata
Rank Oldbie
Rank
Oldbie
Cacodemon345 wrote on 2025-01-27, 14:28:
Nemo1985 wrote on 2025-01-27, 13:00:

Hello and sorry for the dumb question, I use sbemu on my p4 platform (motherboard: P4S5A/DX+) but it had issues with build engine games, can this fork used as replacement of sbemu?

I also fixed the Sound Blaster sample rate bugs in this fork so Build Engine games from 3D Realms should work well (especially Duke Nukem 3D Atomic Edition), as well as Rise of the Triad.

Thank you I will try it later today and report back, I had issues with both Duke Nukem 3d and Blood

Reply 15 of 104, by Lualb

User metadata
Rank Newbie
Rank
Newbie

if only this worked with windows 3.1, it would be amazing!

Reply 16 of 104, by digger

User metadata
Rank Oldbie
Rank
Oldbie
Lualb wrote on 2025-01-27, 15:25:

if only this worked with windows 3.1, it would be amazing!

See this answer in the SBEMU thread for the reasons why this is neither feasible nor useful. These reasons apply equally to VSBHDA and VSBHDASF.

TL;DR: These are emulators to get sound in DOS games to work on modern hardware, since such games were written to access (specific, now obsolete) sound hardware directly. Windows (even Windows 3.1) doesn't have this problem, since it has a hardware abstraction layer, allowing newer hardware to be supported by writing drivers for them. Windows applications and Windows games don't access sound hardware directly, but instead do so through Windows APIs.

Reply 17 of 104, by Nemo1985

User metadata
Rank Oldbie
Rank
Oldbie
Cacodemon345 wrote on 2025-01-27, 14:28:
Nemo1985 wrote on 2025-01-27, 13:00:

Hello and sorry for the dumb question, I use sbemu on my p4 platform (motherboard: P4S5A/DX+) but it had issues with build engine games, can this fork used as replacement of sbemu?

I also fixed the Sound Blaster sample rate bugs in this fork so Build Engine games from 3D Realms should work well (especially Duke Nukem 3D Atomic Edition), as well as Rise of the Triad.

Bad news, the utility doesn't detect my soundcard.
as a side information: Sbemu beta5 was able to detect it while the beta3 no.
According to the ecs websites it uses: C-Media CMI9738 4-channel audio CODEC

Reply 18 of 104, by Cacodemon345

User metadata
Rank Newbie
Rank
Newbie

That's a lot of commits to traverse. Does it work on SBEMU 1.0beta4?

Reply 19 of 104, by Nemo1985

User metadata
Rank Oldbie
Rank
Oldbie
Cacodemon345 wrote on 2025-01-27, 16:06:

That's a lot of commits to traverse. Does it work on SBEMU 1.0beta4?

A troublesome configuration apparently, sorry...
I just tried the beta4 it detects the soundcard correctly but has the very same issues of beta5 with build engine.
If I can be of any help with troubleshooting and test I'm available.

Last edited by Nemo1985 on 2025-01-27, 16:17. Edited 3 times in total.