VOGONS


More accurate MUNT (MT32 emulation) patch

Topic actions

Reply 21 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie
Reckless wrote:

Do you plan to merge the updates into the standalone driver codebase? I know that this is less interesting to most users but for those who would like to use this outside of Dosbox..

No, I don't. I am not familiar with the driver codebase.

Reply 22 of 78, by shock__

User metadata
Rank Oldbie
Rank
Oldbie

Awesome 😀
Also seems to unbreak the Theme for Stunts/4D Sports Racing.
Still sounds a bit off (sadly can't compare it to an original MT32) but otherwise this sounds really great compared to earlier builds of MUNT

Reply 23 of 78, by Malignant Manor

User metadata
Rank Newbie
Rank
Newbie

You seem to be overcompensating for the volume being too high by lowering the volume contrast.
Code like that should be modifiable.

if(velocity>100) velocity=100; // FIXME: noise fix on some games

In synth.cpp, you might want to try changing the following in partial.cpp

*partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)leftvol) >> 15);
*partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)rightvol) >> 15);

to

*partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)leftvol) >> 16);
*partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)rightvol) >> 16);

Having it at 15 causes crackle in really high volume music notes. (This is without your "if(velocity>100) velocity=100" changes that reduces the max volume.) Maybe it can help a bit with the noise issue.

EDIT: restoring what I undid

Last edited by Malignant Manor on 2011-01-02, 09:33. Edited 2 times in total.

Reply 24 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie
Malignant Manor wrote:
You seem to be overcompensating for the volume being too high by lowering the volume contrast. Code like that should be modifiab […]
Show full quote

You seem to be overcompensating for the volume being too high by lowering the volume contrast.
Code like that should be modifiable.

if(velocity>100) velocity=100; // FIXME: noise fix on some games

In synth.cpp, you might want to try changing the following in partial.cpp

*partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)leftvol) >> 15);
*partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)rightvol) >> 15);

to

*partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)leftvol) >> 16);
*partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)rightvol) >> 16);

Having it at 15 causes crackle in really high volume music notes. (This is without your "if(velocity>100) velocity=100" changes that reduces the max volume.) Maybe it can help a bit with the noise issue.

Yes, it does but isn't is too low when using >> 16?
If you see first page of this thread, you'll see a change from >> 16 to >> 15 for increasing volume level. That is also part of ScummVM.

Reply 25 of 78, by Malignant Manor

User metadata
Rank Newbie
Rank
Newbie

It was tested with Exult not DOSBox. It doesn't have a completely up to date changes with ScummVM. The volume isn't too low for me there. It really depends on the music though.

I changed some of the code that ScummVM has and the crackle doesn't appear anymore. I tried to edit it away before you replied.

EDIT: I was using the wrong bin. The crackle still happens. It's early morning here and I haven't gone to be yet.

Reply 26 of 78, by Malignant Manor

User metadata
Rank Newbie
Rank
Newbie

It just seems weird to force a volume increase and then lower the higher volumes in a patch that states it is trying to increase accuracy. That could be fixed with a configuration for people who want the volume increase over accuracy.

Reply 27 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie
Malignant Manor wrote:

It's early morning here and I haven't gone to be yet.

It is early morning here, too (about 4:40 AM). 😀 I will go asleep now.

Here is a link to the change to volume level.
http://scummvm.svn.sourceforge.net/viewvc/scu … =20450&r2=29378

That is really weird. Let me know if you get something interesting or finds another solution. Thanks for the information.

Reply 28 of 78, by Malignant Manor

User metadata
Rank Newbie
Rank
Newbie

Wow, I couldn't even spell "bed" properly.

With

if(velocity>119) velocity=119;

I no longer get crackle. That seems like a much more acceptable volume cutoff. Hopefully it works in the games you had problems with.

(6.3% max volume loss vs 21.26%)

Reply 29 of 78, by Malignant Manor

User metadata
Rank Newbie
Rank
Newbie

After testing more songs, 119 isn't low enough.

I currently have it set at

if(velocity>116) velocity=116;

I'll have to go through more songs and reply back.

Edit: For Ultima 7 Part 2 Serpent Isle, I had to drop it way down on song 50.

if(velocity>104) velocity=104;

Reply 31 of 78, by Malignant Manor

User metadata
Rank Newbie
Rank
Newbie

Could you lower the sfx volume instead? That shouldn't be too hard if it is using another card type. Is there a way to separate sfx volume data from the music if both are using MT-32 emulation?

Reply 32 of 78, by canadacow

User metadata
Rank Member
Rank
Member

Oooh! Always excited to see progress with Munt. I've been distracted with so many other projects it's rare for me to have time to revisit it. Even now I'm on the road and can't very easily test your changes.

Welcome to the broken rubix cube that is MT-32 emulation. Get one thing right for most instruments find that a hand full are still wrong. Correct for the edge cases, fixing sound for some and breaking others. *sigh*

Reply 33 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

Hi, canadacow. Glad to see you here.

I reverted the volume modification from ScummVM and removed all hacks for noise fix now. (but you'll encounter a bit low volume level)
I found ScummVM is focusing only on MT-32, so there could be something missing for CM-64 emulation.

Attachments

  • Filename
    mt32.diff
    File size
    213.09 KiB
    Downloads
    329 downloads
    File license
    Fair use/fair dealing exception

Reply 34 of 78, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Hmm, I'm using the CM32 roms, might need to check whether it all sounds correcter with the mt32 ones...

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 35 of 78, by Malignant Manor

User metadata
Rank Newbie
Rank
Newbie

Unfortunately, I got around to testing and you might still hear crackle on some tracks. Track 50 in Serpent Isle still crackles a little bit. Tracks like these are probably pretty rare. What you have as a default now is probably good for most games.

For no quality loss.

*partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)leftvol) >> 17);
*partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)rightvol) >> 17);

This was needed to reduce the volume if at >> 16. (~2.36% max volume loss)

if(velocity>124) velocity=124;

This is still with Exult but should be the same result as DOSBox (even though Exult might not patch it properly). I'll have to build DOSBox with the patch. Then use U7Wizard to set a music egg to play the track and finally start the game to test.

EDIT: DOSBox doesn't have the crackle on track 50. It does happen at one point in the starting menu. I haven't tested any other music since it is a pain.

The cuttoff for that is:

if(velocity>125) velocity=1256;
[code]

Reply 36 of 78, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Can't compile it on OS X 🙁

/usr/bin/g++-4.2 -arch i386 -DHAVE_CONFIG_H -I. -I../..  -I../../include -I/opt/local/include -O2 -arch i386 -I/opt/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE  -I/opt/local/include -O2 -arch i386  -MT midi.o -MD -MP -MF .deps/midi.Tpo -c -o midi.o midi.cpp
In file included from midi.cpp:79:
midi_mt32.h: In function ‘int MT32_Thread(void*)’:
midi_mt32.h:91: warning: comparison is always true due to limited range of data type
midi_mt32.h: In member function ‘virtual void MidiHandler_mt32::PlayMsg(Bit8u*)’:
midi_mt32.h:213: warning: comparison is always true due to limited range of data type
In file included from midi.cpp:84:
midi_coreaudio.h: In member function ‘virtual bool MidiHandler_coreaudio::Open(const char*)’:
midi_coreaudio.h:57: warning: ‘AUGraphNewNode’ is deprecated (declared at /System/Library/Frameworks/AudioToolbox.framework/Headers/AUGraph.h:673)
midi_coreaudio.h:57: warning: ‘AUGraphNewNode’ is deprecated (declared at /System/Library/Frameworks/AudioToolbox.framework/Headers/AUGraph.h:673)
midi_coreaudio.h:63: warning: ‘AUGraphNewNode’ is deprecated (declared at /System/Library/Frameworks/AudioToolbox.framework/Headers/AUGraph.h:673)
midi_coreaudio.h:63: warning: ‘AUGraphNewNode’ is deprecated (declared at /System/Library/Frameworks/AudioToolbox.framework/Headers/AUGraph.h:673)
midi_coreaudio.h:73: warning: ‘AUGraphGetNodeInfo’ is deprecated (declared at /System/Library/Frameworks/AudioToolbox.framework/Headers/AUGraph.h:687)
midi_coreaudio.h:73: warning: ‘AUGraphGetNodeInfo’ is deprecated (declared at /System/Library/Frameworks/AudioToolbox.framework/Headers/AUGraph.h:687)
midi_mt32.h: In function ‘void cpuID(unsigned int, unsigned int*)’:
midi_mt32.h:13: error: can't find a register in class ‘BREG’ while reloading ‘asm’
midi_mt32.h:13: error: ‘asm’ operand has impossible constraints
make[3]: *** [midi.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

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 38 of 78, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

Here is cpuID reference used in the munt code.
http://stackoverflow.com/questions/2901694/pr … hyper-threading

This code seems to be for MacOS but I haven't tested it yet.
http://stackoverflow.com/questions/853798/pro … s-from-mac-os-x

You may use midi_mt32.h from v4 instead if it is okay to always utilize multithreaded support.

Reply 39 of 78, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

yes, with midi_mt32.h from v4 it compiled. Thanks

Intro for Ultima 7 with Dosbox+Mt32emu is slightly wrong, the bird chirping is very muted and not the right sound... Otherwise it sounds a lot closer than Exult's usage of a real MT32 (we are doing something wrong there) 😀