VOGONS


More accurate MUNT (MT32 emulation) patch

Topic actions

First post, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

I've tested MUNT for hours and finally created a more accurate version for DOSBox.

Many things are borrowed from ScummVM project. Some files are borrowed from gulikoza's build source. I removed and modified part of source in ScummVM project so that it can be applied to DOSBox.

- more accurate than previous version of MUNT
- more speed (It detects SIMD and 3DNow technology of CPU)
- a bit louder

You'll of course need ROM files for MT32 emulation.
Note that I disabled log messages so you will not get any errors or warning messages related to munt in DOSBox.

Attachments

  • Filename
    testbuild_20101211.zip
    File size
    1.38 MiB
    Downloads
    1051 downloads
    File comment
    patch and binary (20101121)
    File license
    Fair use/fair dealing exception

Reply 3 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie
collector wrote:

Percussion is much louder than a real MT-32 on QfG2.

I don't have real Roland MT-32 to play with. Can you upload some samples here for comparison?

Changing >>16 to >>15 produced a relatively higher volume level.

--- ./src/gui/partial.cpp	2010-12-11 10:59:58 +0900
+++ ./src/gui/partial.cpp 2010-12-11 02:22:00 +0900
@@ -647,8 +647,8 @@
partialBuf += donelen * 2;
#endif
while (length--) {
- *partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)leftvol) >> 16);
- *partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)rightvol) >> 16);
+ *partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)leftvol) >> 15);
+ *partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)rightvol) >> 15);
mixedBuf++;
}
return true;

Reply 4 of 78, by collector

User metadata
Rank l33t
Rank
l33t

Here is the real MT-32 and from your DOSBox build. I have all of the SCI0 games, which are some of the best for MT-32 music. Let me know if there are others you would like samples of.

Attachments

  • Filename
    QfG2-MT-32.mp3
    File size
    584.2 KiB
    Downloads
    850 downloads
    File license
    Fair use/fair dealing exception
  • Filename
    QfG2-Munt.mp3
    File size
    466.71 KiB
    Downloads
    862 downloads
    File license
    Fair use/fair dealing exception

Reply 5 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie
collector wrote:

Here is the real MT-32 and from your DOSBox build. I have all of the SCI0 games, which are some of the best for MT-32 music. Let me know if there are others you would like samples of.

Thanks for the files. It needs to investigate the cause of the difference.

Updated with binary and patch attached
* Waveform cache will be generated in waveform directory.
* Added more samples rates.
* Added a hack for MegaMan X. (It sounds better though dunno how it differs from real MT-32)
* Detects more versions of ROM files
* Mastertune will be set to 0x4a for CM-64 and 0x40 for MT-32 (confirmed)
* Enabled some important log messages

Attachments

  • Filename
    testbuild (v2).zip
    File size
    1.69 MiB
    Downloads
    695 downloads
    File license
    Fair use/fair dealing exception

Reply 6 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

Updated (v3) with patch and binary attached
* Fixed endless echo while resetting all controllers (e.g., Little Witch)
* Fixed noise on some games (e.g., Lotus, MegaMan X)
- Setting too higher volumes for a note generated noise. (Maximum value is 127 but limited to 100)
* Fixed some minor bugs

@collector: percussion problem might be fixed as of this update.

Attachments

  • Filename
    testbuild (v3).zip
    File size
    1.69 MiB
    Downloads
    711 downloads
    File license
    Fair use/fair dealing exception

Reply 7 of 78, by Darklord42

User metadata
Rank Newbie
Rank
Newbie

Excellent Work!!! I just tried this with Wing Commander, and over all a huge improvement when compared to the last build of munt! There are still sounds missing, most jarringly the guns and other sound effects as well, but the music much better and the thruster noise is now bearable!

If you have that game it would be great if you could take a look, there are clips of actual mt-32 machine test with it on You Tube for comparison.

http://www.youtube.com/watch?v=HV8VvLRV3fA

Reply 9 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

It is hard for me to manipulate this patch since I have no real MT-32. Noise is still there and that will be probably only what I can try to solve. A hack for some games is makeshift.

I think munt maintainers will be interested in this code.

Reply 10 of 78, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

There are a ton of us on this forum that have real MT-32's and would probably be willing to make recordings for you of specific games or MIDI files if you could make use of such things to help in your efforts.

Reply 11 of 78, by Cloudschatze

User metadata
Rank Oldbie
Rank
Oldbie
ykhwong wrote:

* Mastertune will be set to 0x4a for CM-64 and 0x40 for MT-32 (confirmed)

Interesting. I checked an MT-32 and CM-64 a number of years ago, and both returned the expected 4Ah value (442.0 Hz). 440.0 Hz is not the default for any MT-32 I've encountered.

A number of games set the master tuning to 440.0 Hz. I wonder if one of these was played prior to your test results?

Reply 12 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie
Cloudschatze wrote:
ykhwong wrote:

* Mastertune will be set to 0x4a for CM-64 and 0x40 for MT-32 (confirmed)

Interesting. I checked an MT-32 and CM-64 a number of years ago, and both returned the expected 4Ah value (442.0 Hz). 440.0 Hz is not the default for any MT-32 I've encountered.

A number of games set the master tuning to 440.0 Hz. I wonder if one of these was played prior to your test results?

Yes, you're right. I found MT-32 uses 0x4A for mastertune. That is my mistake.

The LAPC-I documentation claims a range of 427.5Hz-452.6Hz. The MT-32 documentation claims a range of 432.1Hz-457.6Hz and "Standard pitch" is 442Hz. I am currently using 440.0 for that anyway.

Reply 13 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

Updated (v4) with patch and binary attached
* Mastertune is set to 0x4a for MT-32. (reported by Cloudschatze)
* Borrowed recent changes from SVN branch of ScummVM.
- Fix uninitialised memory reads in MT-32 Emulator, reported by Valgrind.

Attachments

  • Filename
    testbuild (v4).zip
    File size
    1.69 MiB
    Downloads
    714 downloads
    File license
    Fair use/fair dealing exception

Reply 14 of 78, by Darklord42

User metadata
Rank Newbie
Rank
Newbie

Excellent work, I noticed that things weren't quite in tune, but this fixed it. 😀

I'm not sure what you mean by "standard." concert A4 IS 440hz. Some orchestras tune it up slightly though to give the impression of being brighter.

I noticed with wing commander a lot of the soundfx seem to be working but are too quiet for instance the klaxon while your running to your ship or the cockpit closing, can almost be heard, but doesn't come out trough the music. Even the soundfx that are heard aren't balanced well with the music. Here is a mp3 file of what I am hearing so you can compare it against the real one shown in the youtube link i posted earlier.

This makes me wonder if some of those sounds which we think aren't being loaded are, but simply can't be heard at all?

Attachments

  • Filename
    wc_000.mp3
    File size
    3.06 MiB
    Downloads
    1201 downloads
    File comment
    WC1 v4 patch test
    File license
    Fair use/fair dealing exception

Reply 15 of 78, by Cloudschatze

User metadata
Rank Oldbie
Rank
Oldbie
ykhwong wrote:

The MT-32 documentation claims a range of 432.1Hz-457.6Hz...

This is a typographical error; the MT-32 and CM-variants share the same master turning range.

I generated a master tuning list some time back (see the "Errata" sheet), if it helps at all:

CMWaves.jpg

Reply 16 of 78, by frobme

User metadata
Rank Member
Rank
Member

This is a great little patch ykhwong. I just fired up several of the Origin games and I had a great time with the better music. It seems to run fine on my main machine, my clunky old box though was having issues with buffer starvation in MUNT, although CPU usage didn't really show maxed out, seemed kind of odd.

In any case thanks very much! I'm off to fiddle with some Sierra stuff =)

-Frob

Reply 17 of 78, by paincakes

User metadata
Rank Newbie
Rank
Newbie

Yes this build ran great on my Core 2 Duo 3.0ghz but my old Pentium 4 2.6ghz was unable to get into Wing Commander 2. It looked like it might have been bogged down but my cpu usage was very low. Great project keep up the good work!

Reply 18 of 78, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Apart from fixing all this it is great that you provide us with a patch that is for actual Dosbox. All the other patches for munt are so old that it's hard to integrate them in current Dosbox

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 19 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

Some updates:
* Disables multi-threading support on single core CPU without hyperthreading.
* Added another hack for noise.

Attachments

  • Filename
    testbuild_(v5).zip
    File size
    1.69 MiB
    Downloads
    790 downloads
    File license
    Fair use/fair dealing exception