dmusic icon indicating copy to clipboard operation
dmusic copied to clipboard

Music from "Cultures" series (Northland and 8th Wonder of the World)

Open Nithanim opened this issue 9 months ago • 5 comments

Hello,

I am trying (once again...) to convert/play music from the game 8th Wonder of the World. The Steam version has a "DM2" folder with a lot of "*.dls" and "*.sgt" files in it.

At first I tried using https://github.com/libdmusic/libdmusic but it seems really old and the last open issue someone linked to this library/program here. I followed your instruction for building which worked without issues. However, using the provided example binary always results in similar log output like this:

/steam/steamapps/common/Cultures 8th Wonder/DataX/DM2$ /dmusic/build/examples/play-segment Theme_Arabs_Friendly.sgt 
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk segh:[] not fully parsed, 16 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk trkx:[] not fully parsed, 8 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk LIST:[TIMS] not fully parsed, 20 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 812 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 616 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 11428 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 500 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 452 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 19144 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 592 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 1816 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 1768 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 1336 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 5848 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 2940 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk trkx:[] not fully parsed, 8 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bd2h:[] not fully parsed, 8 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMAP] not fully parsed, 470 bytes remaining
2025-03-23 21:32:46 [DirectMusic] (INFO ) › DmBand: Downloading instruments for band 'Theme_Arabs_Friendly'
2025-03-23 21:32:46 [DirectMusic] (ERROR) › DmLoader: Automatic download of segment 'Theme_Arabs_Friendly.sgt' failed
Getting the segment failed

I thought it would be straight forward to just pass a .sgt file. Though, that does not seem to be the case. I am really not sure if I am just using your tool correctly. Running it with an incorrect workingdir it just prints Getting the segment failed, so it reads at least something.

Without knowing anything about these files and your tool at all and trying to interpret the log messages... I guess I am pretty much out of luck? Orphaned data does not sound great and maybe it can't find instruments? From the readme, I get that there are also *.sty files but there aren't any in the game folder.

Not sure if you really need any more issues by introducing another game if you still got issues with the main goal^^ Just wanted to throw it in there for informational purposes, I guess.

Nithanim avatar Mar 23 '25 22:03 Nithanim

Hi @Nithanim, thanks for making an issue about this! First of all, it looks like you've compiled and run the script correctly. I can already spot a couple problems in the log you posted but none of them should result in this specific error. So, could you please answer the following for me:

  1. Which OS are you on? If you're on Windows, you might have to change the "re" in the following snippet to only read "r": https://github.com/GothicKit/dmusic/blob/afc88e19f53563d658d528013c63e5608896fea9/examples/play-segment.c#L169
  2. If that doesn't help, could you please enable debug logging by changing DmLogLevel_INFO to DmLogLevel_DEBUG at the start of play-segment.c, then run it again and post the log output here? https://github.com/GothicKit/dmusic/blob/afc88e19f53563d658d528013c63e5608896fea9/examples/play-segment.c#L19
  3. Could you also send me those files, so I can try to reproduce the issue and implement any missing features?

Thanks!

lmichaelis avatar Mar 24 '25 14:03 lmichaelis

Thank you for getting back to me!

  1. Which OS are you on?

Linux, since I am not insane enough to compile something on Windows^^

  1. If that doesn't help, could you please enable debug logging by changing DmLogLevel_INFO to DmLogLevel_DEBUG at the start of play-segment.c, then run it again and post the log output here?

With the debug log level it looks like this:

2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading segment 'Theme_Arabs_Friendly.sgt'
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk segh:[] not fully parsed, 16 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk trkx:[] not fully parsed, 8 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk LIST:[TIMS] not fully parsed, 20 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 812 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 616 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 11428 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 500 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 452 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 19144 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 592 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 1816 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 1768 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 1336 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 5848 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMPT] not fully parsed, 2940 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk trkx:[] not fully parsed, 8 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bd2h:[] not fully parsed, 8 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk bins:[] not fully parsed, 4 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (WARN ) › DmRiff: Chunk RIFF:[DMAP] not fully parsed, 470 bytes remaining
2025-03-24 21:27:34 [DirectMusic] (INFO ) › DmBand: Downloading instruments for band 'Theme_Arabs_Friendly'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '028.dls'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '027.dls'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '008.dls'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '029.dls'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '030.dls'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '012.dls'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '025.dls'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '002.dls'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '020.dls'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '021.dls'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '032.dls'
2025-03-24 21:27:34 [DirectMusic] (DEBUG) › DmLoader: Loading DLS collection '026.dls'
2025-03-24 21:27:34 [DirectMusic] (ERROR) › DmLoader: Automatic download of segment 'Theme_Arabs_Friendly.sgt' failed
Getting the segment failed

A little more helpful but not really, I guess.

  1. Could you also send me those files, so I can try to reproduce the issue and implement any missing features?

Would you take a Steam key of the game? Not that it probably matters realistically but not that keen on sending game files around.

Nithanim avatar Mar 24 '25 21:03 Nithanim

Thanks, I'd rather not have you buy something for me though. I'll look into getting the game myself, it isn't that expensive anyway. Indeed, these new log messages are not that helpful. ~~In the mean time, could you check the exit code of the script please?~~

lmichaelis avatar Mar 25 '25 13:03 lmichaelis

Okay, I've managed to find the offending piece of code and I've also found that as it stands currently, this library is not able to play that soundtrack. The issue boils down to missing support for the full capabilities of DLS Level 2 as well as the newer DirectMusic Version used with the soundtrack. In particular: some note events seem to be missing, rythms aren't processed correctly, DirectMusic toolgraphs are unsupported and various other issues.

Depending on what you want to do, you could try to render the audio using DirectMusic Producer or look into Wine's DirectMusic implementation, although that too is very incomplete. Another option of course, would be to wait for me to implement it here (that could take some time) or implement it yourself and make a PR.

I've pushed some experimental changes to the feat/new-dmusic-versions branch that you could try out. I am able to play some sounds but clearly not what was intended (WARNING: The output is VERY LOUD).

lmichaelis avatar Mar 25 '25 17:03 lmichaelis

I've pushed some experimental changes to the feat/new-dmusic-versions branch that you could try out. I am able to play some sounds but clearly not what was intended (WARNING: The output is VERY LOUD).

Oh WOW, thank you! The modifications you did on the feature branch does indeed make it play something, really cool!

Okay, I've managed to find the offending piece of code and I've also found that as it stands currently, this library is not able to play that soundtrack. The issue boils down to missing support for the full capabilities of DLS Level 2 as well as the newer DirectMusic Version used with the soundtrack. In particular: some note events seem to be missing, rythms aren't processed correctly, DirectMusic toolgraphs are unsupported and various other issues.

To be completely honest, playing anything is more than I expected since I gave up on that file format multiple times. I think I looked into the source code of libdmusic once and decided that there is a reason that everything surrounding that format is really complicated :)

Depending on what you want to do, you could try to render the audio using DirectMusic Producer

Oh, that looks interesting, thank you! My main issue with these files is that I stumble over them randomly time and time again and have no idea what they contain and I can't just play them. Although, the names are somewhat descriptive I have no idea what music they are supposed to be or where they are even used. The most curious part - IF I remember correctly - is that they are not there in the original CD distribution. And it is also weird that I cannot find the original music files. For the CD version, it was as audio part on the CD but obviously, this is obsolete for the Steam version. On the other hand, I cannot map the .sgt names to the original music. So in essence, in reality it is something completely different that makes me crazy.

or look into Wine's DirectMusic implementation, although that too is very incomplete.

I did not know that there was anything integrated. I think with winetricks it "just" installs the microsoft distribution.

Another option of course, would be to wait for me to implement it here (that could take some time)

It is not like I need it. I just stumbled upon this and found the invitation to make an issue about other games ;D It's only curiosity.

or implement it yourself and make a PR.

I would really love to make something work. But, as you probably might guess, there are a lot of other projects I want to do. And another complicated file format is not really what I need additionally. My biggest issue, though, are my ongoing health issues that prevent me pretty much doing any programming and even writing this is approaching my limits. Therefore, I am not going to be of any use in the near future.

Thanks, I'd rather not have you buy something for me though.

I have gifted so many games and plan do do a lot more (I already bought a ton for a giveaway) so one more does not make a difference :)

Nithanim avatar Mar 25 '25 21:03 Nithanim