Jump to content

Music in Mods

Recommended Posts

This tutorial is designed to help people play their romance love songs using a WAV file without the game music playing over the top of it.


NOTE: If you are planning to use an ACM for your music none of this applies.


There have been problems in the past with adding music to mods. While the game's ACM music format is smaller than WAV, it is much larger than MP3 or OGG files, leading to longer downloads. The main problem is that game music will play over the love song if it is not switched off somehow. The current method of switching off the game music for the duration is to add a blank entry to the songlist, using WeiDU's ADD_MUSIC, facility to make use of the blank music file that BioWare kindly provided. Unfortunately there is a problem with this method in that the songlist has limited space, (a total of 100 song slots of which 84 are already filled by the game) and several mods adding blank music entries is not a good thing.


Help is at hand, there is an entry is the songlist that is not currently used by the game or other mods. If you look at row 0 of songlist.2da you will see **** listed as the resource, if we replace this with a mus file that plays blank.acm we can have a universal entry for a blank song.


Here's what you need to do. First you need a mus file that plays blank.acm here is an example:




It doesn't have to be called j#blank.mus, this is just an example. Second we need to copy it to the music folder and then add it to the songlist, here it the tp2 code to do this:

COPY ~mymod/j#blank.mus~ ~music~

COPY_EXISTING ~songlist.2da~ ~override~


Now to play your love song without the game music running over it simply use PlaySong(0) before using PlaySound("LOVESONG"). Here is an example I lifted (and then altered) from Kelsey:

















To finish, a bit of basic sound file stuff. The best way to package your sounds is as 22 Khz mono OGG files, quality level 4 is usually sufficient for both voice and music. To install them use oggdec to covert them to WAV files. This is quite simple, here is a quick overview:

COPY ~mymod/audio~ ~override~

AT_INTERACTIVE_EXIT ~mymod/install-audio.bat~

AT_INTERACTIVE_UNINSTALL ~mymod/uninstall-audio.bat~

@echo off

mymod\oggdec override\mymod*.ogg

del mymod*.ogg

@echo off

del override\mymod*.wav

In this example oggdec is kept in the MyMod folder and the ogg files are held in the MyMod/audio folder.


Useful Links

For encoding: http://winlame.sourceforge.net/

For oggdec: http://www.rarewares.org/ogg.html

Edited by Idobek
Link to comment

Just making a wild guess, but I imagine this is profoundly out of date.

Any current mod that adds area audio (not just NPC dialog accompaniment)?

Edited by Awachi
Link to comment

Yes. For one thing, the 100-song limit is definitely not in effect; there are either 106 or 107 entries in BG2EE's songlist, depending on whether you look at the 2DA or the IDS. I don't know what the actual limit is now, but you can assume it's plenty.

Link to comment

I'm more wary about entry 0 getting used, that's why I asked how to find row numbers in a 2da (and then use that in a script). 

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...