Trouble with ambient music [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
ZoomV
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 308
Joined: Thu Aug 15, 2013 11:27 am
Projects :: Old Republic Map pack
Games I'm Playing :: BF2 SWTOR and GW2
xbox live or psn: No gamertag set
Location: Belsavis, Maximum Security Ward

Trouble with ambient music [Solved]

Post by ZoomV »

So I'm trying to add custom ambient, but I have been having issues where only some of the tracks play

ACW.req
Hidden/Spoiler:
[code]ucft
{
REQN
{
"str"
"align=2048"
"ACWtor_music"
}
REQN
{
"lvl"
"ACWtor"
}

}[/code]
ACWtor.req
Hidden/Spoiler:
[code]ucft
{
REQN
{
"bnk"
"align=2048"
}

REQN
{
"config"
"ACWtor_music_config"
"ACWtor_music"
}
}[/code]
ACWtor_music.mus
Hidden/Spoiler:
[code]// ----- alderaan Music -----

Music()
{
Name("ald_start01");
Priority(0.0);
FadeInTime(0.5);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(2.0);
SoundStream("ald_start01");
}
Music()
{
Name("ald_start02");
Priority(0.0);
FadeInTime(0.5);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(2.0);
SoundStream("ald_start02");
}

Music()
{
Name("ald_middle01");
Priority(0.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("ald_middle01");
}

Music()
{
Name("ald_middle02");
Priority(0.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("ald_middle02");
}

Music()
{
Name("ald_middle03");
Priority(0.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("ald_middle03");
}

Music()
{
Name("pub_end");
Priority(0.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("pub_end");
}

Music()
{
Name("imp_end");
Priority(0.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("imp_end");
}

Music()
{
Name("depressing");
Priority(0.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("depressing");
}

Music()
{
Name("victory");
Priority(1.0);
FadeInTime(0.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("victory");
}
Music()
{
Name("defeat");
Priority(1.0);
FadeInTime(0.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("defeat");
}



[/code]
ACWtor_music.stm
Hidden/Spoiler:
[code]// ----- Ambient Bleed Music ----------
Streams\ald_start01.wav ald_start01
Streams\ald_start02.wav ald_start02
Streams\ald_middle01.wav ald_middle01
Streams\ald_middle02.wav ald_middle02
Streams\ald_middle03.wav ald_middle03
Streams\pub_end.wav pub_end
Streams\imp_end.wav imp_end
Streams\depressing.wav depressing
Streams\victory.wav victory
Streams\defeat.wav defeat[/code]
ACWtor_music_config.snd
Hidden/Spoiler:
[code]// ----- Republic Music -----

SoundStream()
{
Name("ald_start");
Pitch(1.0);
PitchDev(0.0);
Gain(1.0);
GainDev(0.0);
ReverbGain(0.0);
Bus("ingamemusic");
Looping(0);
Pan(0.0);
Mode3D(0);
Stream("ACWtor_music"); //.stm file
SegmentList()
{
Segment("ald_start01", 0.5);
Segment("ald_start02", 0.5);
}
}

SoundStream()
{
Name("ald_middle");
Pitch(1.0);
PitchDev(0.0);
Gain(1.0);
GainDev(0.0);
ReverbGain(0.0);
Bus("ingamemusic");
Looping(0);
Pan(0.0);
Mode3D(0);
CyclePlayback(1);
Stream("ACWtor_music");
SegmentList()
{
Segment("ald_middle01", 0.35);
Segment("ald_middle02", 0.35);
Segment("ald_middle03", 0.30);
}
}

SoundStream()
{
Name("imp_end");
Pitch(1.0);
PitchDev(0.0);
Gain(1.0);
GainDev(0.0);
ReverbGain(0.0);
Bus("ingamemusic");
Looping(0);
Pan(0.0);
Mode3D(0);
Stream("ACWtor_music");
SegmentList()
{
Segment("depressing", 0.5);
Segment("imp_end", 0.5);
}
}

SoundStream()
{
Name("pub_end");
Pitch(1.0);
PitchDev(0.0);
Gain(1.0);
GainDev(0.0);
ReverbGain(0.0);
Bus("ingamemusic");
Looping(0);
Pan(0.0);
Mode3D(0);
Stream("ACWtor_music");
SegmentList()
{
Segment("depressing", 0.5);
Segment("pub_end", 0.5);
}
}

SoundStream()
{
Name("victory");
Pitch(1.0);
PitchDev(0.0);
Gain(1.0);
GainDev(0.0);
ReverbGain(0.0);
Bus("ingamemusic");
Looping(0);
Pan(0.0);
Mode3D(0);
Stream("ACWtor_music");
SegmentList()
{
Segment("victory", 1.0);
}
}
SoundStream()
{
Name("defeat");
Pitch(1.0);
PitchDev(0.0);
Gain(1.0);
GainDev(0.0);
ReverbGain(0.0);
Bus("ingamemusic");
Looping(0);
Pan(0.0);
Mode3D(0);
Stream("ACWtor_music");
SegmentList()
{
Segment("defeat", 1.0);
}
}


[/code]
function ScritInit
Hidden/Spoiler:
[code]
function ScriptInit()


ReadDataFile("dc:Load\\ACW_TOR.lvl")

ReadDataFile("dc:ingame.lvl")
ReadDataFile("ingame.lvl")



SetMaxFlyHeight(60)
SetMaxPlayerFlyHeight(60)


SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",50) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",650) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",550) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",6000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",100) -- should be ~1x #combo


ReadDataFile("dc:SOUND\\ACW.lvl;ACWtor")
ReadDataFile("sound\\fel.lvl;fel1cw")
ReadDataFile("dc:SOUND\\tor.lvl;tor_1")
ReadDataFile("dc:SOUND\\rcw.lvl;dc17")
ReadDataFile("dc:SIDE\\clonewar.lvl",
"tur_bldg_laser",
"imp_hero_sithwarrior",
"imp_inf_sithwarrior",
"imp_inf_sithdroid",
"pub_inf_rocketeer",
"pub_inf_rifleman",
"pub_inf_officer",
"pub_inf_engineer",
"pub_inf_sniper",
"pub_inf_commando",
"imp_inf_side",
"imp_inf_officer")
-- "rep_walk_atte")

SetupTeams{
rep = {
team = REP,
units = 68,
reinforcements = 650,
soldier = { "pub_inf_rocketeer",2,8},
assault = { "pub_inf_engineer",2,8},
engineer = { "pub_inf_sniper",10,15},
sniper = { "pub_inf_officer",2,6},
officer = { "pub_inf_commando",2,5},
special = { "pub_inf_vanguard",1,4},
AddUnitClass (2, "pub_inf_rifleman", 25, 57)

},
imp = {
team = IMP,
units = 68,
reinforcements = 650,
soldier = { "imp_inf_rocketeer",2,8},
assault = { "imp_inf_engineer",2,8},
engineer = { "imp_inf_sniper",10,15},
sniper = { "imp_inf_officer",2,6},
officer = { "imp_inf_blackops",2,5},
special = { "imp_inf_hunter",1,4},
AddUnitClass (1, "imp_inf_rifleman",25, 57)
},

--SetHeroClass(IMP, "imp_hero_sithwarrior")
--SetHeroClass(REP, "rep_hero_macewindu")
}
-- Local Stats
SetTeamName(3, "wardroids")
AddUnitClass(3, "imp_inf_sithdroid", 3)
SetUnitCount(3, 3)
AddAIGoal(3, "Deathmatch", 100)
SetTeamAsFriend(3, ATT)
SetTeamAsFriend(ATT,3)
SetTeamAsEnemy(DEF,3)
SetTeamAsEnemy(3,DEF)

SetTeamName(4, "sith")
AddUnitClass(4, "imp_inf_sithwarrior", 2)
SetUnitCount(4, 2)
AddAIGoal(4, "Deathmatch", 100)
SetTeamAsFriend(4, ATT)
SetTeamAsFriend(4, 3)
SetTeamAsFriend(3, 4)
SetTeamAsFriend(ATT,4)
SetTeamAsEnemy(DEF,4)
SetTeamAsEnemy(4,DEF)

SetTeamAggressiveness(IMP, 0.95)
SetTeamAggressiveness(REP, 0.95)


-- Level Stats
ClearWalkers()
AddWalkerType(0, 3) -- 3 Sith War droids (special case: 0 leg pairs)
AddWalkerType(0, 0) -- special -> droidekas
AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
AddWalkerType(2, 0) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 0) -- 3x2 (3 pairs of legs)

local weaponCnt = 1024
SetMemoryPoolSize("Aimer", 300)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityHover", 32)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 148)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 148)
SetMemoryPoolSize("UnitController", 148)
SetMemoryPoolSize("Weapon", weaponCnt)
SetMemoryPoolSize("SoldierAnimation", 400)
SetMemoryPoolSize("Music", 51)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("dc:ACW\\ACW.lvl", "ACW_conquest")
SetDenseEnvironment("false")


-- Sound Stats

voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "des_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_quick", voiceQuick)

OpenAudioStream("dc:SOUND\\ACW.lvl", "ACWtor_music")
OpenAudioStream("sound\\global.lvl", "cw_music")
OpenAudioStream("sound\\fel.lvl", "fel1")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")

SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(REP, IMP, "rep_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, REP, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

--SetLowReinforcementsVoiceOver(REP, REP, "all_off_defeat_im", .1, 1)
--SetLowReinforcementsVoiceOver(REP, IMP, "all_off_victory_im", .1, 1)
--SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
--SetLowReinforcementsVoiceOver(IMP, REP, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(2, "repleaving")
SetOutOfBoundsVoiceOver(1, "Impleaving")

SetAmbientMusic(REP, 1.0, "ald_start", 0,1)
SetAmbientMusic(REP, 0.8, "ald_middle", 1,1)
SetAmbientMusic(REP, 0.2, "pub_end", 2,1)
SetAmbientMusic(IMP, 1.0, "ald_start", 1,1)
SetAmbientMusic(IMP, 0.8, "ald_middle", 1,1)
SetAmbientMusic(IMP, 0.2, "imp_end", 0,1)

SetVictoryMusic(REP, "victory")
SetDefeatMusic (REP, "defeat")
SetVictoryMusic(IMP, "victory")
SetDefeatMusic (IMP, "defeat")[/code]
Right now only pub_end and the victory and defeat music work.
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: trouble with ambient music

Post by jedimoose32 »

Did you normalize those tracks in your sound editor before export?

Also I had a look at some of my custom .mus files and compared them with yours. Why don't you try setting the priority of all of the music to 1.0?
ScriptInit looks fine and your .reqs are fine.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: trouble with ambient music

Post by Marth8880 »

Your .mus file should generally only have one start track, one middle track, one end track, and the victory/defeat tracks. What SoundStream() in the .mus file is calling is the SoundStream() property names from the .snd file, not the individual segments.
ZoomV
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 308
Joined: Thu Aug 15, 2013 11:27 am
Projects :: Old Republic Map pack
Games I'm Playing :: BF2 SWTOR and GW2
xbox live or psn: No gamertag set
Location: Belsavis, Maximum Security Ward

Re: trouble with ambient music

Post by ZoomV »

Marth8880 wrote:. What SoundStream() in the .mus file is calling is the SoundStream() property names from the .snd file, not the individual segments.
So my .mus file now looks like this
Hidden/Spoiler:
[code]// ----- alderaan Music -----

Music()
{
Name("ald_start");
Priority(0.0);
FadeInTime(0.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("ald_start");
}
Music()
{
Name("ald_middle");
Priority(0.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("ald_middle");
}
Music()
{
Name("pub_end");
Priority(0.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("pub_end");
}
Music()
{
Name("imp_end");
Priority(0.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("imp_end");
}
Music()
{
Name("victory");
Priority(1.0);
FadeInTime(0.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("victory");
}
Music()
{
Name("defeat");
Priority(1.0);
FadeInTime(0.1);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("defeat");
}



[/code]
ald_middle now works, however ald_start still does not work.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: trouble with ambient music

Post by Marth8880 »

Like jedimoose said, you're gonna want to change the Priority of the start, middle and end Music() properties to 1.0 and change the Priority of the victory and defeat Music() properties to something greater than 1.0 - I believe the vanilla music files use a value of 9.0.

Also, unless you're using any of the stock hero music for any of your heroes or something, you're gonna wanna remove this line from your LUA:

Code: Select all

OpenAudioStream("sound\\global.lvl",  "cw_music")
ZoomV
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 308
Joined: Thu Aug 15, 2013 11:27 am
Projects :: Old Republic Map pack
Games I'm Playing :: BF2 SWTOR and GW2
xbox live or psn: No gamertag set
Location: Belsavis, Maximum Security Ward

Re: trouble with ambient music

Post by ZoomV »

Ah that fixed it. However its really quiet, is there a parameter to amplify the tracks?
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: trouble with ambient music

Post by Marth8880 »

Well, like jedimoose said as well, have you normalized all of your music tracks in Audacity? :o
ZoomV
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 308
Joined: Thu Aug 15, 2013 11:27 am
Projects :: Old Republic Map pack
Games I'm Playing :: BF2 SWTOR and GW2
xbox live or psn: No gamertag set
Location: Belsavis, Maximum Security Ward

Re: trouble with ambient music

Post by ZoomV »

What do you mean when you say "normalize?"
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: trouble with ambient music

Post by Marth8880 »

Hidden/Spoiler:
Image

Image
ZoomV
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 308
Joined: Thu Aug 15, 2013 11:27 am
Projects :: Old Republic Map pack
Games I'm Playing :: BF2 SWTOR and GW2
xbox live or psn: No gamertag set
Location: Belsavis, Maximum Security Ward

Re: trouble with ambient music

Post by ZoomV »

that fixed it. However I had a issue crop up since setting priority to 1.
When playing as republic it plays ald_start when it should and switches to ald_middle when it should, but it never plays pub_end, instead it plays ald_middle all the way to the end where it correctly plays victory.

When playing as the empire, it goes straight to playing imp_end, and plays that all the way to the victory/defeat.

.mus file
Hidden/Spoiler:
[code]/ ----- alderaan Music -----

Music()
{
Name("ald_start");
Priority(1.0);
FadeInTime(0.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("ald_start");
}
Music()
{
Name("ald_middle");
Priority(1.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("ald_middle");
}
Music()
{
Name("pub_end");
Priority(1.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("pub_end");
}
Music()
{
Name("imp_end");
Priority(1.0);
FadeInTime(1.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("imp_end");
}
Music()
{
Name("victory");
Priority(9.0);
FadeInTime(0.0);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("victory");
}
Music()
{
Name("defeat");
Priority(9.0);
FadeInTime(0.1);
FadeOutTime(1.0);
MinPlaybackTime(20.0);
MinInactiveTime(5.0);
SoundStream("defeat");
}



[/code]
Everything else is as it is in the OP.

I tried staggering the priorities so that ald_start is 1.0, ald_middle is 2.0, pub_end/imp_end is 3.0 and victory/defeat is 9.0, but that was no change.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: trouble with ambient music

Post by Marth8880 »

This:

Code: Select all

SetAmbientMusic(REP, 1.0, "ald_start",  0,1)
    SetAmbientMusic(REP, 0.8, "ald_middle", 1,1)
    SetAmbientMusic(REP, 0.2, "pub_end",    2,1)
    SetAmbientMusic(IMP, 1.0, "ald_start",  1,1)
    SetAmbientMusic(IMP, 0.8, "ald_middle", 1,1)
    SetAmbientMusic(IMP, 0.2, "imp_end",    0,1)
Should look more like this:

Code: Select all

SetAmbientMusic(REP, 1.0, "ald_start",  0,1)
    SetAmbientMusic(REP, 0.8, "ald_middle", 1,1)
    SetAmbientMusic(REP, 0.3, "pub_end",    2,1)
    SetAmbientMusic(IMP, 1.0, "ald_start",  0,1)
    SetAmbientMusic(IMP, 0.8, "ald_middle", 1,1)
    SetAmbientMusic(IMP, 0.3, "imp_end",    2,1)
From soundhooks.txt:

Code: Select all

SetAmbientMusic(
    playerTeam, 
    reinforcementCount, 
    musicName, 
    gameStage, 
    isPercentage);

playerTeam         : player's team number
reinforcementCount : number of reinforcement count of the player's team which 
                     triggers the specified music
musicName          : name of the music configuration 
                     (see section Music Configuration)
gameStage          : value from 0 to 2, where 0 = beginning, 1 = middle and 
                     2 = "end".  
isPercentage       : Optional argument which when set to 1 treats 
                     reinforcementCount as a fraction (0..1.0) of 
                     maximum reinforcements.
http://www.secretsociety.com/forum/down ... dhooks.txt
ZoomV
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 308
Joined: Thu Aug 15, 2013 11:27 am
Projects :: Old Republic Map pack
Games I'm Playing :: BF2 SWTOR and GW2
xbox live or psn: No gamertag set
Location: Belsavis, Maximum Security Ward

Re: trouble with ambient music

Post by ZoomV »

ahhh, I was wondering what those two parameters on the end where.
Post Reply