Replacing MIDI soundtrack with MP3: IHNMAIMS

General chat related to ScummVM, adventure gaming, and so on.

Moderator: ScummVM Team

Post Reply
User avatar
Alpheon
Posts: 18
Joined: Sat Mar 21, 2009 7:32 am

Replacing MIDI soundtrack with MP3: IHNMAIMS

Post by Alpheon »

I'm collaborating with GOG user SirAlastor to get the enhanced soundtrack, offered as a bonus with IHNM on GOG and Steam, playing within the game. So far, he's been using trial and error to simply discover whether the ScummVM-compatible filename he's renamed a track to works in any particular scene, then noting the results.

Is there a more efficient way to do this? How can I find out in the code where the game will look for CD audio at what times, instead of just by ear, scene-by-scene?

Any help is great. We'll be offering this to the community when the work's done.
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3525
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

From what I understand, each music track is only identified by a number. You can play music manually from the debug console (Ctrl+D), with the play_music command. The music starts when you return to the game with exit. That should at least be easier than playing through the game to find the music.

(Note that it's not very robust, and will in fact probably crash ScummVM if you type an invalid number.)
User avatar
criezy
ScummVM Developer
Posts: 950
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Post by criezy »

Also if you start ScummVM from the command line with -d 2, when playing IHNM you will get messages like the following while playing when it starts a music:

Code: Select all

Music::play 1, 0
File::open: opening 'track2.flac' failed
File::open: opening 'track2.fla' failed
File::open: opening 'track2.ogg' failed
File::open: opening 'track2.mp3' failed
File::open: opening 'track2.m4a' failed
The first number after play is the resource ID, and for IHNM, it will look for a track number that is the resource ID + 1. That will tell you what track name it expects for the scene you are playing.
User avatar
md5
ScummVM Developer
Posts: 2250
Joined: Thu Nov 03, 2005 9:31 pm
Location: Athens, Greece

Post by md5 »

The game has 40 music tracks.

As eriktorbjorn said, you can play each track with the play_music debugger command, however, the track will start playing immediately, not after exiting the debugger.

Note that music tracks in IHNM start from 0, whereas external tracks start from 1. So, internally the game scripts will call track 5, but the actual external track will be 6.

After quickly listening through the tracks, I remember that there's a pattern:

track 0 (external 1): can't remember... death music? Credits music?
track 1 (external 2): IHNM main theme

Each chapter has 6 tracks, and they are all grouped together with the same logic.

Each chapter's tracks start from track 2 + (6 * (chapter - 1)). So:
- chapter 1 (Gorrister) -> first track is 2 (external 3)
- chapter 2 (Benny) -> first track is 8 (external 9)
- chapter 3 (Ellen) -> first track is 14 (external 15)
- chapter 4 (Nimdok) -> first track is 20 (external 21)
- chapter 5 (Ted) -> first track is 26 (external 27)
- final chapter, character selection -> first track is 32 (external 33)
- final chapter, depending on the character you use: tracks 33 - 37 (external 34 - 38 )
- track 38 (external 39) is the ending, I think
- track 39 (external 40) is also part of the ending, I think (the scene after the main ending)

For each chapter, the tracks are:
- First track: main theme
- Second track: after getting more psych points (doing a good deed)
- Third track: I think that's a track played after getting even more psych points, or progressing more with the chapter's story line
- Fourth track: gaining psych points (doing a good deed)
- Fifth track: losing psych points (doing an evil deed)
- Sixth track: chapter end (If I'm not mistaken)

Now, all these are from memory, so there might be mistakes here and there, but I think that's the way the game's music tracks are used.

Hope it has been helpful :) Adding enhanced music tracks to the game would be most welcome. They should be supported right out of the box in ScummVM. Thanks for your work on this!
User avatar
Alpheon
Posts: 18
Joined: Sat Mar 21, 2009 7:32 am

Post by Alpheon »

Wow, thanks everyone. This is all extremely helpful. I should be able to make use of this by Thursday.
User avatar
Alpheon
Posts: 18
Joined: Sat Mar 21, 2009 7:32 am

Post by Alpheon »

I could get this done really quickly if the "play_music" command was working for me, but when I enter it in the debug console, it simply says "Unknown command or variable". I've tried it in multiple games now, and none of them recognize the command. Any hints?
User avatar
md5
ScummVM Developer
Posts: 2250
Joined: Thu Nov 03, 2005 9:31 pm
Location: Athens, Greece

Post by md5 »

Alpheon wrote:I could get this done really quickly if the "play_music" command was working for me, but when I enter it in the debug console, it simply says "Unknown command or variable". I've tried it in multiple games now, and none of them recognize the command. Any hints?
This command will only work in ITE and IHNM. You can enter the console by pressing "Control-D". What commands do you get when you type "help"?

Also, which version of ScummVM are you using?
User avatar
Alpheon
Posts: 18
Joined: Sat Mar 21, 2009 7:32 am

Post by Alpheon »

md5 wrote:
Alpheon wrote:I could get this done really quickly if the "play_music" command was working for me, but when I enter it in the debug console, it simply says "Unknown command or variable". I've tried it in multiple games now, and none of them recognize the command. Any hints?
This command will only work in ITE and IHNM. You can enter the console by pressing "Control-D". What commands do you get when you type "help"?

Also, which version of ScummVM are you using?
Indeed, Ctrl+D is what I'm using to open the console. I'm using 1.7.0, and here's a screenshot of the "help" list:

Image
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3525
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

Alpheon wrote: Indeed, Ctrl+D is what I'm using to open the console. I'm using 1.7.0
I guess that commant wasn't added until after 1.7.0. I didn't realize it was that recent.
User avatar
Alpheon
Posts: 18
Joined: Sat Mar 21, 2009 7:32 am

Post by Alpheon »

eriktorbjorn wrote:
Alpheon wrote: Indeed, Ctrl+D is what I'm using to open the console. I'm using 1.7.0
I guess that commant wasn't added until after 1.7.0. I didn't realize it was that recent.
No problem. I hadn't considered upgrading to a daily build. I now have, and will be using it, and the play_music command, for this project. Thanks.
User avatar
Alpheon
Posts: 18
Joined: Sat Mar 21, 2009 7:32 am

Post by Alpheon »

It's done! See this thread for deets.
Post Reply