Custom sound issues

matrixDictator

Chieftain
Joined
Jun 4, 2012
Messages
5
Hello,

I normally don't post much, but I'm having a rather infuriating time working on adding custom music to civilizations I have made and so I'm wondering if someone could help me. I've followed the custom music guide here completely, triple-checking my work, but haven't found why I'm getting a Crash To Desktop error every time I load my mod. There's three pieces of music I want to use across six leaders.

Below is the code I'm attempting to use:

AudioDefines.xml:
Spoiler :
<SoundData>
<SoundID>DIPLO_ScyPeace</SoundID>
<Filename>Sounds/Diplomacy/DIPLO_ScyPeace</Filename>
<LoadType>STREAMED</LoadType>
<bIsCompressed>1</bIsCompressed>
<bInGeneric>1</bInGeneric>
</SoundData>
<SoundData>
<SoundID>DIPLO_PRCPeace</SoundID>
<Filename>Sounds/Diplomacy/DIPLO_PRCPeace</Filename>
<LoadType>STREAMED</LoadType>
<bIsCompressed>1</bIsCompressed>
<bInGeneric>1</bInGeneric>
</SoundData>
<SoundData>
<SoundID>DIPLO_RFGSPeace</SoundID>
<Filename>Sounds/Diplomacy/DIPLO_RFGSPeace</Filename>
<LoadType>STREAMED</LoadType>
<bIsCompressed>1</bIsCompressed>
<bInGeneric>1</bInGeneric>
</SoundData>

Audio2DScripts.xml:
Spoiler :
<Script2DSound>
<ScriptID>AS2D_DIPLO_ScyPeace</ScriptID>
<SoundID>DIPLO_ScyPeace</SoundID>
<SoundType>GAME_MUSIC</SoundType>
<iMinVolume>75</iMinVolume>
<iMaxVolume>75</iMaxVolume>
<iPitchChangeDown>0</iPitchChangeDown>
<iPitchChangeUp>0</iPitchChangeUp>
<iMinLeftPan>-1</iMinLeftPan>
<iMaxLeftPan>-1</iMaxLeftPan>
<iMinRightPan>-1</iMinRightPan>
<iMaxRightPan>-1</iMaxRightPan>
<bLooping>1</bLooping>
<iMinTimeDelay>0</iMinTimeDelay>
<iMaxTimeDelay>0</iMaxTimeDelay>
<bTaperForSoundtracks>0</bTaperForSoundtracks>
<iLengthOfSound>0</iLengthOfSound>
<fMinDryLevel>1.0</fMinDryLevel>
<fMaxDryLevel>1.0</fMaxDryLevel>
<fMinWetLevel>0.0</fMinWetLevel>
<fMaxWetLevel>0.0</fMaxWetLevel>
</Script2DSound>
<Script2DSound>
<ScriptID>AS2D_DIPLO_PRCPeace</ScriptID>
<SoundID>DIPLO_PRCPeace</SoundID>
<SoundType>GAME_MUSIC</SoundType>
<iMinVolume>75</iMinVolume>
<iMaxVolume>75</iMaxVolume>
<iPitchChangeDown>0</iPitchChangeDown>
<iPitchChangeUp>0</iPitchChangeUp>
<iMinLeftPan>-1</iMinLeftPan>
<iMaxLeftPan>-1</iMaxLeftPan>
<iMinRightPan>-1</iMinRightPan>
<iMaxRightPan>-1</iMaxRightPan>
<bLooping>1</bLooping>
<iMinTimeDelay>0</iMinTimeDelay>
<iMaxTimeDelay>0</iMaxTimeDelay>
<bTaperForSoundtracks>0</bTaperForSoundtracks>
<iLengthOfSound>0</iLengthOfSound>
<fMinDryLevel>1.0</fMinDryLevel>
<fMaxDryLevel>1.0</fMaxDryLevel>
<fMinWetLevel>0.0</fMinWetLevel>
<fMaxWetLevel>0.0</fMaxWetLevel>
</Script2DSound>
<Script2DSound>
<ScriptID>AS2D_DIPLO_RFGSPeace</ScriptID>
<SoundID>DIPLO_RFGSPeace</SoundID>
<SoundType>GAME_MUSIC</SoundType>
<iMinVolume>75</iMinVolume>
<iMaxVolume>75</iMaxVolume>
<iPitchChangeDown>0</iPitchChangeDown>
<iPitchChangeUp>0</iPitchChangeUp>
<iMinLeftPan>-1</iMinLeftPan>
<iMaxLeftPan>-1</iMaxLeftPan>
<iMinRightPan>-1</iMinRightPan>
<iMaxRightPan>-1</iMaxRightPan>
<bLooping>1</bLooping>
<iMinTimeDelay>0</iMinTimeDelay>
<iMaxTimeDelay>0</iMaxTimeDelay>
<bTaperForSoundtracks>0</bTaperForSoundtracks>
<iLengthOfSound>0</iLengthOfSound>
<fMinDryLevel>1.0</fMinDryLevel>
<fMaxDryLevel>1.0</fMaxDryLevel>
<fMinWetLevel>0.0</fMinWetLevel>
<fMaxWetLevel>0.0</fMaxWetLevel>
</Script2DSound>

And here's the relevant LeaderHeadInfos.xml:
Spoiler :
<DiplomacyMusicPeace>
<DiploMusicPeaceEra>
<EraType>ERA_ANCIENT</EraType>
<DiploScriptId>AS2D_DIPLO_ScyPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_CLASSICAL</EraType>
<DiploScriptId>AS2D_DIPLO_ScyPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_MEDIEVAL</EraType>
<DiploScriptId>AS2D_DIPLO_ScyPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_RENAISSANCE</EraType>
<DiploScriptId>AS2D_DIPLO_ScyPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_INDUSTRIAL</EraType>
<DiploScriptId>AS2D_DIPLO_ScyPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_MODERN</EraType>
<DiploScriptId>AS2D_DIPLO_ScyPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_FUTURE</EraType>
<DiploScriptId>AS2D_DIPLO_ScyPeace</DiploScriptId>
</DiploMusicPeaceEra>
</DiplomacyMusicPeace>

...

<DiplomacyMusicPeace>
<DiploMusicPeaceEra>
<EraType>ERA_ANCIENT</EraType>
<DiploScriptId>AS2D_DIPLO_RFGSPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_CLASSICAL</EraType>
<DiploScriptId>AS2D_DIPLO_RFGSPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_MEDIEVAL</EraType>
<DiploScriptId>AS2D_DIPLO_RFGSPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_RENAISSANCE</EraType>
<DiploScriptId>AS2D_DIPLO_RFGSPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_INDUSTRIAL</EraType>
<DiploScriptId>AS2D_DIPLO_RFGSPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_MODERN</EraType>
<DiploScriptId>AS2D_DIPLO_RFGSPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_FUTURE</EraType>
<DiploScriptId>AS2D_DIPLO_RFGSPeace</DiploScriptId>
</DiploMusicPeaceEra>
</DiplomacyMusicPeace>

...

<DiplomacyMusicPeace>
<DiploMusicPeaceEra>
<EraType>ERA_ANCIENT</EraType>
<DiploScriptId>AS2D_DIPLO_PRCPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_CLASSICAL</EraType>
<DiploScriptId>AS2D_DIPLO_PRCPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_MEDIEVAL</EraType>
<DiploScriptId>AS2D_DIPLO_PRCPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_RENAISSANCE</EraType>
<DiploScriptId>AS2D_DIPLO_PRCPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_INDUSTRIAL</EraType>
<DiploScriptId>AS2D_DIPLO_PRCPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_MODERN</EraType>
<DiploScriptId>AS2D_DIPLO_PRCPeace</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_FUTURE</EraType>
<DiploScriptId>AS2D_DIPLO_PRCPeace</DiploScriptId>
</DiploMusicPeaceEra>
</DiplomacyMusicPeace>


I'd provide the full LeaderHeadInfos for the seven leaders, but I hit the character cap when I tried. Any help would be deeply appreciated.
 
That appears to be the case, yes. The game worked fine before my audio changes and works fine when the code is removed.

I checked the .wav files for comments, found none. Audacity exports them with no comments by default anyway. Was worth a shot though.
 
I meant the audio XML files, not the audio files themself, sorry :blush:.

Oh, and I think Civ normally uses mp3 for the audio, and not .wav.
While I'm not sure if this is true, the values in your AudioDefines are set to 1 for bIsCompressed, so I'm pretty sure that this entry will not work with a .wav file.

I know Audacity will need the lame.dll for encoding mp3, but you should have one somewhere on your system, in one of the folders for your media players (VLC, Winamp, or so). Don't download one from untrusted sources, because then you have a good chance of getting an infected .dll.
 
Oh, comments in the audio xmls? No, I posted those exactly as I have them.

Wasn't aware civ4 used .mp3s by default. I have mp3 copies, so I'll try that.

Edit: Tried, crash to desktop.
 
As I understand it:
XML is case sensitive, when creating a reference name which will be defined in another XML file it should be all uppercase, for example
Code:
<SoundID>DIPLO_SCYPEACE</SoundID>

I was able to reproduce a crash by using a mixed case SoundID and ScriptID
as in your code
Code:
<SoundID>DIPLO_ScyPeace</SoundID>
<ScriptID>AS2D_DIPLO_ScyPeace</ScriptID>
Code:

BTS uses .wav files as well as .mp3.
main advantage of .mp3 smaller file size but places a small silence at the end of each file which can cause a problem when the audio is looped,
.wav does not.
 
Wow, I didn't expect that. I should've, since the civilopedia xml files are case-sensitive too, but...

Well, thanks. That solved it.
 
Back
Top Bottom