Opened 12 years ago

Closed 12 years ago

Last modified 11 months ago

#3441 closed defect

MT-32 emu: Low volume

Reported by: SF/tipabu Owned by: fingolfin
Priority: normal Component: Audio: MT32
Keywords: Cc:
Game: Monkey Island 2

Description

Compared to other music drivers, the MT-32 driver is rather quiet. This is easily observed by selecting the MT-32 music driver and listening to the opening sequence of Monkey Island 2. The Adlib driver provides a good reference volume.

This has been observed previously:

http://forums.scummvm.org/viewtopic.php?t=150

http://forums.scummvm.org/viewtopic.php?t=3764

I believe this is caused by the use of a signed master volume level within the MT-32 code. I've made a patch correcting this; it appears to work with no ill effects. Ideally, someone more familiar with the code will review this to make sure all of the necessary changes have been made (and that I didn't go and muck things up).

It occurs to me that I should perhaps have submitted this to Munt instead of ScummVM; if so, sorry to have bothered you.

Tested on Monkey Island 2 with ScummVM 0.11.0svn (Oct 20 2007 01:57:22) on x86_64 Ubuntu, compiled with gcc.

Ticket imported from: #1816901. Ticket imported from: bugs/3441.

Attachments (2)

mt-32.patch (2.7 KB ) - added by SF/tipabu 12 years ago.
MT-32 Volume Patch
revised-mt-32.patch (581 bytes ) - added by SF/tipabu 12 years ago.
Revised MT-32 Volume Patch

Download all attachments as: .zip

Change History (8)

by SF/tipabu, 12 years ago

Attachment: mt-32.patch added

MT-32 Volume Patch

comment:1 by fingolfin, 12 years ago

I can't comment on the issue reported here right now, but the patch itself looks wrong to me (but feel free to convince me of the contrary). The ProduceOutput1() function uses the "volume" parameter to scale sample data, roughly as follows:

out = (in * volume) >> 15;

The right shift corresponds to dividing by 32768. So, it matches the original upscale factor 32767 used for the master volume .

comment:2 by SF/tipabu, 12 years ago

Good point. Looking in partial.cpp (line 642), I see something similar, only using separate left and right volumes. Each is signed, but downshifted by 16-bits. I think if we just change those each to 15 it'll work. Looks like my recommendation worked well purely by chance. Thanks for keeping me from mucking things up, as I'd feared.

by SF/tipabu, 12 years ago

Attachment: revised-mt-32.patch added

Revised MT-32 Volume Patch

comment:3 by SF/tipabu, 12 years ago

Attaching a new patch, which only changes the downshifts for the left and right channels. Output seems correct, and this time for the right reasons.
File Added: revised-mt-32.patch

comment:4 by fingolfin, 12 years ago

Owner: set to fingolfin
Status: newclosed

comment:5 by fingolfin, 12 years ago

This patch looks perfect, it seems the left/right channel indeed use 2^15 as maximal volume. Thanks!

comment:6 by digitall, 11 months ago

Component: Audio: MT32
Game: Monkey Island 2
Note: See TracTickets for help on using tickets.