Opened 21 years ago

Closed 20 years ago

Last modified 11 years ago

#1620 closed defect (fixed)

COMI: Music is stuttering. Again

Reported by: eriktorbjorn Owned by: aquadran
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game: Monkey Island 3

Description

A few days ago, I told aquadran on #scummvm that the COMI music was stuttering. (As well as the FT and Dig music.) There was some experimenting, the bug went away and everyone was happy. Or at least I was.

Using today's snapshot, I noticed that the bug was back again: regular buffer underruns, from the sound of it. I added some debugging output to the part of the code where it checks bufferMin against bufferUsage. This was the pattern I saw:

bufferMin: 8820 bufferUsage: 0 bufferMin: 8820 bufferUsage: 8820 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 0 bufferMin: 8820 bufferUsage: 8820 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 0 bufferMin: 8820 bufferUsage: 8820 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 17640 bufferMin: 8820 bufferUsage: 17640

So the buffer usage is hovering at 17640 for a while when it suddenly, without any warning becomes 0. At this point it's gradually pumped up to 17640 again. This looks pretty strange to me. I'm guessing that the bufferUsage calculation isn't as good as it ought to be...

Ticket imported from: #949760. Ticket imported from: bugs/1620.

Change History (10)

comment:1 by eriktorbjorn, 21 years ago

Owner: set to aquadran

comment:2 by eriktorbjorn, 21 years ago

Component: Engine: SCUMM
Game: Monkey Island 3

comment:3 by SF/leerqbasic, 21 years ago

Could this in any way be related to bug #948485 (Speech is stuttering), as I found the stuttering to be related to the speech and music buffering?

comment:4 by eriktorbjorn, 21 years ago

The music does work on my Linux box, but there the bufferMin/bufferUsage pattern looks like this:

bufferMin: 8820 bufferUsage: 15044 bufferMin: 8820 bufferUsage: 6852 bufferMin: 8820 bufferUsage: 15672 bufferMin: 8820 bufferUsage: 7480 bufferMin: 8820 bufferUsage: 16300 bufferMin: 8820 bufferUsage: 8108 bufferMin: 8820 bufferUsage: 16928 bufferMin: 8820 bufferUsage: 16928 bufferMin: 8820 bufferUsage: 8736 bufferMin: 8820 bufferUsage: 17556 bufferMin: 8820 bufferUsage: 9364 bufferMin: 8820 bufferUsage: 9364 bufferMin: 8820 bufferUsage: 1172 bufferMin: 8820 bufferUsage: 9992 bufferMin: 8820 bufferUsage: 9992 bufferMin: 8820 bufferUsage: 1800 bufferMin: 8820 bufferUsage: 10620

So whatever is used to measure bufferUsage, it's not consistent across different platforms. We used to have a similar - perhaps the same - problem with the BS cutscene player. See https://sourceforge.net/tracker/index.php?func=detail&aid=880484&group_id=37116&atid=418820

comment:5 by eriktorbjorn, 21 years ago

With the latest change, the problem appears to be gone, or at least very nearly so. I tried it on the difficulty selection screen, and there times when bufferUsage drops to 0, particularly just around the time the music loops back to the beginning. And at least on some of those occasions the music may have dropped out briefly.

I guess the intro music isn't the best to test with since it's so quiet to begin with, but I don't have the time to try anything else right now.

comment:6 by SF/stonedbones, 20 years ago

Hi, I investigated this bug a bit. In the current version (0.6.0) as well as in the current CVS version (2004-06-02) music and sound is stuttering not only in COMI but in MI1, MI2 and DOT as well (SuSE Linux 8.2 with SDL 1.2.5).

I found out that using the X11/OSS backend instead of the SDL backend fixes the stuttering. I then ported the OSS parts into the SDL backend so that graphics uses SDL and sound uses OSS with the same result: no more stuttering.

Although I waded a few hours through the SCUMMVM sound sources adding lots of debugging output I still can't find the cause for stuttering in SDL, but I hope this info could help you.

comment:7 by SF/stonedbones, 20 years ago

Hi, I investigated this bug a bit. In the current version (0.6.0) as well as in the current CVS version (2004-06-02) music and sound is stuttering not only in COMI but in MI1, MI2 and DOT as well (SuSE Linux 8.2 with SDL 1.2.5).

I found out that using the X11/OSS backend instead of the SDL backend fixes the stuttering. I then ported the OSS parts into the SDL backend so that graphics uses SDL and sound uses OSS with the same result: no more stuttering.

Although I waded a few hours through the SCUMMVM sound sources adding lots of debugging output I still can't find the cause for stuttering in SDL, but I hope this info could help you.

comment:8 by eriktorbjorn, 20 years ago

The MI1, MI2 and DOTT music are handled by a completely different part of ScummVM than the FT, Dig and COMI music so it's almost certainly not related.

I assume you are speaking of the Adlib music, though with MI1 it could be the ripped and compressed CD music as well. If the MIDI music or the real CD music is stuttering, then something's seriously weird.

The only reason I can think of why music would stutter with the SDL backend but not the X11 is audio buffer size. You could try changing desired.samples in OSystem_SDL::setSoundCallback() from 2048 to some larger power of two, e.g. 4096 or 8192. However, I doubt this value has changed since... well, since forever, so I don't see why it should start troubling you now, but not (I assume) earlier.

Hmm... I guess another possible reason is that the X11 backend seems to use OSS, while the SDL backend could be using something else. I think the only way of selecting which audio backend SDL uses is through the SDL_AUDIODRIVER environment variable. I'm not sure of what the valid values are, but "alsa", "artsc", "dma", "dsp", and "esd" seem to be some of them. But I can't test this myself at the moment.

Again, though, all this is almost certainly unrelated to the original bug report.

comment:9 by aquadran, 20 years ago

Resolution: fixed
Status: newclosed

comment:10 by SF/thunderpeel2001, 11 years ago

I wonder if there's been a regression? I'm playing through COMI on 1.6.0 and the music has been consistently intermittently jumping. I've been playing it for about a week now, and it's all through the game, every island. It's very jarring and noticeable.

My machine is more than powerful enough to be playing COMI through ScummVM. I have a Core i7 with 16GB of RAM, and NEVER experience sound issues with any other game.

I took a recording of what it sounds like. This is immediately what I heard when unpausing the game. It only took 20 seconds to hear an example of the music jumping:

https://dl.dropboxusercontent.com/u/30449117/COMI-MusicJumping.mp3 (Jump is heard at 0:20)

I really hope there's some way to fix this. Thanks!

Note: See TracTickets for help on using tickets.