Opened 2 months ago

Closed 3 weeks ago

Last modified 3 weeks ago

#15092 closed feature request (fixed)

SWORD1: Implement Windows version of the audio engine

Reported by: lenny892 Owned by: AndywinXp
Priority: low Component: Audio
Version: Keywords:
Cc: Game: Broken Sword 1

Description (last modified by lenny892)

In "Broken Sword: The Shadow of the Templars", several scenes are experiencing audio issues where ambient sounds do not adjust appropriately. These problems have been observed in both the German full version and the English demo version for Windows. Key scenes affected include the street outside the café, the alley opposite the café, and outside the pub in Ireland. In all instances, ambient sounds that should fade or disappear remain unchanged in volume, disrupting the game's immersive experience. These issues were not present in versions prior to ScummVM 2.8.0.

Steps to Reproduce:

  1. Café Scene:
    • Start the game and proceed to the opening scene.
    • Enter the café with George.
  2. Alley Scene:
    • From the café, have George walk to the alley across the street.
  3. Ireland Pub Scene:
    • Navigate to the scene in front of the pub in Ireland.

Expected Behavior:

  • Café and Alley: The street noises should diminish or disappear to allow for location-specific ambient sounds.
  • Ireland Pub: The violin music from inside the pub should be very faint when standing outside.

Actual Behavior:

  • Café and Alley: The volume of street noises remains loud and unchanged, as if George were still directly in front of the café.
  • Ireland Pub: The violin music is almost as loud as if one were inside the pub, despite adjustments to the game's audio settings.

System Information:

  • Operating System: Windows 11 Build 22631.3447
  • ScummVM Version: 2.8.1 (issue also observed in 2.8.0)
  • Game: "Broken Sword: The Shadow of the Templars", both German full version and English demo version for Windows.

Change History (23)

comment:1 by lenny892, 2 months ago

Priority: normalhigh

comment:2 by lenny892, 2 months ago

Description: modified (diff)

comment:3 by AndywinXp, 2 months ago

Summary: Persistent Audio Issues Across Multiple Scenes in "Broken Sword: The Shadow of the Templars" on ScummVM 2.8.0 and 2.8.1SWORD1: Persistent Audio Issues Across Multiple Scenes

Thanks, I'll be looking at this right now. Please, for the future, refrain to set the priority to high; that should be for the developers to set, otherwise it would make noise with other tickets which are really blockers for any next release.

comment:4 by AndywinXp, 2 months ago

Priority: highnormal

comment:5 by AndywinXp, 2 months ago

Okay, I have an answer for this: I went through the code, through the game scripts and so on and... as stupid as it sounds, this is how it should behave! 😁

Recently we went through a phase of rewriting some parts of the Broken Sword 1 engine, in order to make it as accurate as possibly achievable with respect to the original executable; to do this we had access to the original source code of the game, so every change we made was motivated by the original code.

Now, what you are hearing in those situations of the game is surely jarring, but I compared this to the original running in DOSBox and it sounds exactly the same as ScummVM 2.8.1 (and as our current master).

One might think: "but it was working fine before!". Well... not really, let's put it this way: what was happening was that we were not interpreting some of the game scripts "instructions" correctly before, so even if sound effects sounded "better" before, there were a number of several side effects which could break the experience. Now with the new changes we are offering exactly what the original release offered, in every single aspect. Which is also good for any sort of preservation aspect. 😉

Also with the imminent release of the new Reforged edition I personally would refrain from doing ScummVM-only changes to the engine code, as I'm sure that at Revolution they will be doing any improvements better than we could ever imagine.

Also, the reason why you seemingly are not able to adjust the sound effect of the violin, is because that's on the Music channel, and not on the SFX channel. Try adjusting the Music fader instead.

I hope this answers your doubts about this ticket, thanks for your inquiry!

I'll be closing this in the meantime, as this does not constitute any bug per-se. If you feel that there is definitely a bug that is ours and is not on the original, feel free to reopen it.

comment:6 by AndywinXp, 2 months ago

Owner: set to AndywinXp
Resolution: invalid
Status: newclosed

comment:7 by lenny892, 2 months ago

Resolution: invalid
Status: closednew

Thank you for the detailed explanation regarding the audio behavior in "Broken Sword: The Shadow of the Templars" as compared to the original DOS version. After your response, I took the initiative to install the original game in DOSBox and can confirm that the audio behaves exactly as you described in ScummVM 2.8.1 and in the original DOS environment.

However, I have also installed and tested the game on Windows 95 and Windows 98 SE systems, using a retro PC setup with a Slot 1 Pentium 2 and a Soundblaster AWE 64 Value. Interestingly, the audio behavior in these Windows versions aligns with how ScummVM functioned prior to version 2.8.0, rather than the DOS version. This discrepancy suggests that the audio behavior might have been different across various platforms for which the game was originally released.

I would like to add that ScummVM has always indicated that it emulates the Windows version of "Broken Sword: The Shadow of the Templars", not the DOS version. Therefore, I believe it would be most accurate for ScummVM to continue to emulate the Windows version faithfully. Those who prefer the DOS experience have the option to use DOSBox.

Considering this, it seems that the game's audio presentation might vary depending on the original system setup, which could be an important aspect for historical accuracy and preservation. I thought this information might be relevant for your ongoing efforts to emulate the game as authentically as possible.

Thank you again for your commitment to maintaining the fidelity of classic games. I appreciate your time and detailed feedback.

Last edited 2 months ago by lenny892 (previous) (diff)

comment:8 by AndywinXp, 2 months ago

Thanks, this is very insightful. As a matter of fact, the fact that we stated that we support the Windows version is kind of incorrect. When we were given the source code by Revolution in the early 2000s, we were given access to whatever was preserved at the time: the source code (which at its core is DOS based) also contains several Windows specific code; the code of the engine is then tied to some OS specific libraries (to put it simply: drivers).

We were given the DOS version of those drivers, so whichever work was always being done, it was derived from the DOS version. As far as we and Revoluton know, the folder for the Windows 95 engine drivers has long been lost.

The DOS version used a library called Miles Sound System for audio, I don't know about the Windows version, but the high level code controlling the level of the various sounds is apparently the same, so I wouldn't know what's happening there...

I'm not saying that a Windows specific reimplementation will never happen (this really sounds interesting), but it would involve reverse engineering efforts on the executable, so a lot of time and will to do the work.

comment:9 by AndywinXp, 2 months ago

Maybe down the line, it would be nice to have ;)

comment:10 by AndywinXp, 2 months ago

Priority: normallow
Summary: SWORD1: Persistent Audio Issues Across Multiple ScenesSWORD1: Implement Windows version of the audio engine
Type: defectfeature request

comment:11 by lenny892, 6 weeks ago

I would like to add that the differing audio behavior of the Windows version of "Broken Sword: The Shadow of the Templars" compared to the DOS version is something I have observed not only on my retro PC but also in various Windows 9x emulators. Specifically, I installed Windows 95 in DOSBox X (I also tried Windows 98 SE, but the installation failed). Additionally, I tested the game in RetroArch with Windows 98 SE and the RetroArch DOSBox core, as well as with Windows 95/98 SE in PCem.

Emulation could be a viable option to observe the different audio behaviors between the DOS and Windows versions of "Broken Sword" without needing a retro PC. In fact, in the current version of Windows 11, "Broken Sword" can also run natively if the game files are manually copied to the hard drive and Winsword.exe is executed. Note that to play the game on Windows 11, a "Broken Sword" game CD must be inserted in a virtual or physical optical drive.

Furthermore, while you mentioned that ScummVM’s support for "Broken Sword" is based on the DOS version, the graphical user interface in ScummVM suggests otherwise. The Game ID displayed in ScummVM indicates that it is emulating the Windows version, which is somewhat misleading.

Lastly, "Broken Sword" has been the most important and influential game in my life. Therefore, it is crucial to me that the original version remains playable in its authentic form for as long as possible.

Thank you again for your ongoing efforts and dedication to preserving classic games.

comment:12 by lenny892, 6 weeks ago

I have noticed that in both the Irish Pub and the "Poste de police" scenes in "Broken Sword: The Shadow of the Templars," certain sound effects are overly dominant and intrusive. For example, in the Irish Pub, the sound of the dishwasher behind the bar is much more prominent than the music played by the violinist. Similarly, in the "Poste de police," the noise of the fan in the inspector's back office is very loud and distracting. These issues were not present in the Windows version of the game or in ScummVM versions prior to 2.8.0. Despite adjusting the audio settings in ScummVM to make the music louder than the sound effects, the problem persists.

As we have established, the current behavior in ScummVM is accurate to the DOS version, which is likely why these sound effects are more prominent. The dominance of certain sound effects, such as the dishwasher in the Pub and the fan in the police station, negatively impacts the game's atmosphere and immersion. These problems suggest that the balance between music and sound effects is not functioning correctly in the current version of ScummVM when compared to the Windows version.

Thank you for your attention to this matter. I hope this information helps in addressing the audio balance issues and brings the ScummVM experience closer to that of the original Windows version.

comment:13 by AndywinXp, 6 weeks ago

Thanks! But... did you just repeat everything you just said on the opening post and the first few comments? I already got it the first time 😂 Don't worry! I physically (and I literally mean physically, as right now I'm ill) cannot do this now, but I will do it eventually.

comment:14 by lenny892, 6 weeks ago

Thank you for your response and for taking the time to look into this issue, especially while you're not feeling well. I appreciate your efforts and understand that these things take time. My intention was not to be repetitive or to add pressure but simply to provide as much detail as possible to help with troubleshooting.

I hope you get well soon. I'm looking forward to any updates you might have when you're able to work on this. Thank you again for your dedication and for addressing these issues despite your current situation.

comment:15 by AndywinXp, 3 weeks ago

In 6097f386:

SWORD1: Implement alternative Windows audio driver behavior

Implements feature request #15092, bringing the DirectSound driver
as an option for the game.

For now this is toggleable by editing scummvm.ini and adding:

Differences between the DOS and Windows audio drivers:

  • DOS:
    • Apparently uses linear volume curves, as per the AIL/Miles drivers;
    • Music can fade in and out;
    • Fades sound effects in and out at each scene change;
    • Lowers the volume of the music each time a speech line is playing;
  • Windows:
    • Uses DirectSound with volume tables for game volume -> decibel volume conversion; the resulting logarithmic curve and slightly different volume scaling for sound effects ensures audibly different intensities for some sounds;
    • Music can only fade out, not in;
    • Does NOT sound effects in and out at each scene change;
    • Does NOT lower the volume of the music each time a speech line is playing;

comment:16 by AndywinXp, 3 weeks ago

Resolution: fixed
Status: newclosed

This is now implemented. As of right now I'm not sure how to add a GUI option to ScummVM to toggle this audio driver, but for now you can open the scummvm.ini file and add windows_audio_mode=true within your sword1 entry. I will add a GUI option when I'll figure out how.

I have performed the same comparison you listed and I was able to verify that these changes indeed sound accurate.


comment:17 by AndywinXp, 3 weeks ago

Just to give an heads up: this is now available as a GUI option as well. Launch the game, then close it and go to ScummVM game options: it should show up as a checkbox.

comment:18 by lenny892, 3 weeks ago

The Windows audio driver behavior now works almost perfectly.

Here's what I did to test the new feature in ScummVM:

I downloaded the daily build version "windows-x86-64-master-49e6390f" of ScummVM and edited the scummvm.ini file according to your instructions. So far, I haven't been able to find the checkbox in ScummVM's GUI. By adjusting the scummvm.ini file, Broken Sword 1 now behaves almost everywhere in the game as the Windows version of the game should in terms of sound. However, there seems to be one spot where it still doesn't work perfectly.

When entering Hotel Ubu, piano music plays. When you go up the stairs of the hotel, the piano music should still be very quiet in the background. However, no music plays at all when I go up the stairs of the hotel. I checked this against the original Windows version of the game. The piano music should definitely be quiet in the background (not as disproportionately loud as in the DOS version). However, at another location, the quiet background music works just as expected from the Windows version.

When standing in front of the pub in Ireland, the music is correctly quiet in the background and gets louder when I enter the pub.

During testing, I turned up the volume in the Windows settings and also adjusted the music volume in ScummVM to rule out incorrect settings.

I sincerely appreciate the attention given to my request and the support provided in enhancing the gaming experience in ScummVM.

comment:19 by lenny892, 3 weeks ago

I would like to add a clarification to avoid potential misunderstandings. When I mentioned "stairs of the hotel," I was referring to the staircase in the lobby of the hotel leading to the next floor. The original wording may have caused confusion, as there are both steps at the entrance of the hotel and within the lobby in the game. Therefore, I wanted to clarify that my description pertains to the staircase in the lobby, where the piano music should remain in the background when ascending. I hope this clears up the situation.

comment:20 by lenny892, 3 weeks ago

I have now found the solution myself. It appears that in order to hear the music on the upper floor of the hotel, one needs to set the FX volume slider to the maximum. If the slider is even one notch below the maximum, the background music in the upper floor is completely inaudible. In the original Windows version of the game, while the music was indeed extremely quiet when the FX slider was below the maximum, it was still audible.

However, I still cannot find a way in the GUI to enable the sound behavior of the Windows Audio Driver in ScummVM. I have followed the steps exactly, but I cannot find a checkbox at the described location.

comment:21 by AndywinXp, 3 weeks ago

Man, have some mercy :P any change I performed today won't be available until tomorrow's daily build. I'll look into the other issue when I can.

comment:22 by AndywinXp, 3 weeks ago

I fixed the other bug you were referring to. Check back tomorrow.

comment:23 by lenny892, 3 weeks ago

I downloaded today's daily build of ScummVM and tested the specific area. The piano music that plays quietly in the background when you are on the upper floor of the hotel is now correctly played, even when the FX volume slider is not set to the maximum but at the default values set by the game after adding it to ScummVM. The checkbox in ScummVM's GUI to switch between the DOS and Windows versions of the audio behavior is also now present.

From my perspective, there are no more issues currently. I am happy and grateful for the outcome. Thank you!

Note: See TracTickets for help on using tickets.