Jump to content


Photo

Music in Mods


  • Please log in to reply
No replies to this topic

#1 Idobek

Idobek

    Pocket Plane Gibberling

  • Member
  • 429 posts

Posted 30 June 2004 - 01:07 PM

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:

Blank
1
A  @TAG END

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~
SET_2DA_ENTRY 0 2 3 ~J#BLANK.MUS~

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:

IF
  PartyRested()
  Global("J#KelseyMatch","GLOBAL",1)
  See(Player1)
  CombatCounter(0)
  Global("J#LoveTalk","LOCALS",25)
  !Global("Chapter","GLOBAL",5)
THEN
  RESPONSE #100
    PlaySong(0)
    MoveViewObject("J#Kelsey",INSTANT)
    IncrementGlobal("J#LoveTalk","LOCALS",1)
    PlaySound("FWKSong")
    RealSetGlobalTimer("J#KelseyRomance","GLOBAL",1)
    Interact(Player1)
END

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