Author Topic: Music in Mods  (Read 5947 times)

Offline Idobek

  • Dust Bunny
  • Planewalker
  • *****
  • Posts: 431
  • Gender: Male
Music in Mods
« on: June 30, 2004, 03:40:11 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:
Quote from: j#blank.mus
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:
Quote from: MyMod.tp2
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:
Quote from: j#klsy.bcs
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:
Quote from: Setup-MyMod.tp2
COPY ~mymod/audio~ ~override~
AT_INTERACTIVE_EXIT ~mymod/install-audio.bat~
AT_INTERACTIVE_UNINSTALL ~mymod/uninstall-audio.bat~
Quote from: install-audio.bat
@echo off
mymod\oggdec override\mymod*.ogg
del mymod*.ogg
Quote from: uninstall-audio.bat
@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
The Gibberlings Three Forums

<SimDing0> Did you know G3 has secret forum rules?
<CamDawg> Yep. They're generally of the nature 'don't annoy Idobek.'

Vlad

  • Guest
Re: Music in Mods
« Reply #1 on: July 06, 2005, 07:05:41 AM »
Hi Idobek,

I am curiuos why do you need to supress the background music? I have never noticed that it interferes somehow to playing songs. Also the ACM file is several times smaller than the corresponding WAV decompressed from OGG. For example the song for my NPC in a WAV format is about 80 MB while the same song converted to ACM with -q 50 is about 9 MB, and I hear no difference in sound quality while playing in game. The only problem can be the maximum of 100 songs for the SONGLIST.2DA. Could you please elaborate a little bit on this topic?

Offline NiGHTMARE

  • Idiot
  • Planewalker
  • *****
  • Posts: 1405
  • Gender: Male
Re: Music in Mods
« Reply #2 on: July 06, 2005, 07:47:08 AM »
Idobek's tutorial is for people who want their romance music to play as a "sound effect" rather than be added to the song list, like in the BG1 NPC Project :).
The Gibberlings Three - home to the BG1 NPC Project, BG2 Tweak Pack, Divine Remix, GemRB, Lands of Intrigue, Song & Silence, and many more!

Vlad

  • Guest
Re: Music in Mods
« Reply #3 on: July 06, 2005, 08:14:11 AM »
But it's a nice technique to supress background music. Is there any cases when love songs cannot be heard due to high volume background, for example taverns where the tavern song can dominate?

Vlad

  • Guest
Re: Music in Mods
« Reply #4 on: July 06, 2005, 08:27:49 AM »
I checked several taverns, and unfortunately, in some of them when the tavern song was playing the love song couldn't play. I have never noticed and tested this before. Well, I'm going to use your method Idobek, thanks anyway.  :)

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: