Opened 17 years ago

Closed 16 years ago

Last modified 16 years ago

#1094 closed defect (outdated)

MI2 (MAC): Tones of infinite length

Reported by: SF/superqult Owned by: SF/jamieson630
Priority: normal Component: Engine: SCUMM
Keywords: Cc:
Game: Monkey Island 2

Description

This is probably another bug coming from the use (or rather ScummVM's non-use) of the MAC sound data in the mac version of MI2. Anyway, I experience a lot of glitches in the music, where a tone can stretch out forever. Usually, a sound rings until I leave the current area. This occurs in almost every (if not every) area I enter. I didn't find it very annoying at first, but the more I play the more it disturbs me :)

I'm using the latest CVS version (July 31, 18:55).

Ticket imported from: #781025. Ticket imported from: bugs/1094.

Change History (12)

comment:1 by fingolfin, 17 years ago

Owner: set to SF/jamieson630

comment:2 by SF/superqult, 17 years ago

This also appears in Indiana Jones: FOA. I have a feeling that there is a connection there, maybe the iMuse system? I'll check other games too.

comment:3 by SF/jamieson630, 17 years ago

Summary: MI2: Tones of infinite lengthMI2 (MAC): Tones of infinite length

comment:4 by SF/jamieson630, 17 years ago

When testing the Mac MI2 files for bug 780675, I didn't notice any hanging notes. Consequently, it could be one of two things: (1) some endian-unsafe code in the MidiParser, or (2) a quirk specific to the platform sound system.

The former is highly unlikely because event delays are measured with VLQs, and that code is definitely endian safe. Furthermore, the SMF format used by MI2 specifies explicit Note Off events (as opposed to specifying durations for the Note On events like XMIDI does). Explicit Note Off events make it much harder to lose track of when to turn a note off.

The second alternative, a quirk in the sound system, is something we've run into before. We had hanging note problems specific to the Windows Software Synth, and I continue to refine the MidiParser's output to deal with such quirks.

A more specific description of WHERE notes start hanging would be useful. For instance, do hanging notes tend to appear around the time that the music interactively transitions from one passage to another (e.g. when moving in and out of buildings in Woodtick)? If it occurs within a single passage (i.e. no transitions), does it happen consistently at one particular point in the music? Also, does it happen only for the native MIDI driver, or for Adlib mode as well?

A recording of what you're hearing would be especially useful - - I can get a lot more clues from a recording since I can listen for very specific patterns. Are you able to whip up an MP3 or OGG?

comment:5 by SF/superqult, 17 years ago

I've tested it with a few drivers, and it's always the same result. Though, the glitches appear in different places with different drivers; but in the same places with the same driver. Here's a couple of samples, and explanations:

http://markus.samsonrourke.com/infinite_tones_qt.mp3 In the beginning one of the tones plays a G in the third octave forever, while an F-sharp in the fourth octave plays a few notes. After a while, two other tones forms a chord with the first one with an E in the third octave and an F-sharp in the fourth octave. This appears when I walk out of the bar (titled "hatch" in the game) in Woodtick. This one uses the QT driver.

http://markus.samsonrourke.com/infinite_tones_core.mp3 An E-flat in the second octave is playing forever. This appears in the intro, after the first pause in the music (when Guybrush chases away the two monkeys for the second time). This one uses the Core Driver.

comment:6 by SF/jamieson630, 17 years ago

Hmm, the notes that are hanging don't even sound like notes that should have been played in the first place, or like notes that are supposed to be percussion. The latter is theoretically plausible because percussion instruments don't necessarily need a Note Off event -- a smart sound synth will automatically free up synth resources once a percussion instrument has faded to zero or near-zero volume. In reality, the only reason to send percussion instruments over something other than the percussion channel is because they use custom instrumentation. Since I don't know anything about the custom instrumentation capabilities of the Mac, I don't know if custom instruments can specify something (an "auto-off" or skipped Sustain phase of the ADSR cycle) that the sound synth would use to automatically recycle synth resources.

My hunch is that if custom percussion is being used, it may be be in the 10-15 (zero-based) MIDI channel range. Try inserting a check before line 213 of imuse_player.cpp (right after "chan" has been init'd):

if (chan > 9) return;

If that doesn't work, try changing it to:

if (chan != [chan]) return;

...and vary [chan] from 0 to 15. This will filter out all but one channel, allowing you to isolate on what channel(s) extraneous notes are triggering.

The other possibility is the Smart Jump logic, which has been the culprit of numerous issues since its revamp. The Woodtick music, at least, does seem to pick up extraneous notes about the time of a transition. (Actually, most the MP3 clip involved transitions. Does the Woodtick music have extraneous notes when you first walk into town, after the Largo theme, if you don't actually walk in and out of buildings?) Try disabling Smart Jump by changing line 185 of imuse_player.cpp to set property mpSmartJump to 0 instead of 1.

Let me know the results of these tests, and we'll take it from there.

comment:7 by Kirben, 17 years ago

Just adding first suggestion of 'if (chan > 9) return;' to imuse_player.cpp fixes the problem.

comment:8 by Kirben, 17 years ago

To be exact, channel 11 is causing the ringing noise. Channel 10 is been used for another instrument, so best to restrict fix to that particular channel.

comment:9 by fingolfin, 17 years ago

Running MI2 mac intro on my G4/400, with latest ScummVM CVS. I run the MI2 intro with the CoreAudio driver 2 times, and got no hanging notes.

Markus, is the problem *always* reproducible, or just sometimes? Does it still happen with latest CVS?

comment:10 by SF/superqult, 16 years ago

This bug seems to have disappeared somewhere between July 31 and January 29 (today). You can probably close this one now.

comment:11 by SF/jamieson630, 16 years ago

Closing as out-of-date. I'm still not sure this was actually fixed, or just a fluke to begin with. At any rate, I'm glad you don't have to put up with annoying hanging notes anymore, Markus. :)

comment:12 by SF/jamieson630, 16 years ago

Resolution: outdated
Status: newclosed
Note: See TracTickets for help on using tickets.