why do shipped audio streams not munge?

Started by Luc2505, August 18, 2025, 02:04:48 PM

Previous topic - Next topic
it's been a problem since the early days of swbf modding, Majin Revan asked psych0fred about it back in 2005 but he seemingly didn't understand that trying to munge the .stm gives the following error:

Quotemunging C:\LucasArts\BFBuilder\DataDanG\Sound\worlds\DanG\DanG_emt.stm
soundflmunge.exe : Error : Unable to read file list C:\LucasArts\BFBuilder\DataDanG\Sound\worlds\DanG\DanG_emt.stm  - while munging C:\LucasArts\BFBuilder\DataDanG\Sound\worlds\DanG\DanG_emt.stm

the only work around i've found is to implement the stream as a custom sound via the ripped sfx, it doesnt really affect or bother me too much but i found it strange how the sfx and asfx work perfectly fine. i'm guessing its something to do with the .bat files

August 19, 2025, 04:59:08 AM #1 Last Edit: August 19, 2025, 05:00:50 AM by Ty294
I've tried to get this to work too, also to no avail.

Interestingly I've seen in some .sfx files (I don't remember if it was for BF1 or BF2) where they even pull a path from a Stream sound to use as a sound effect.

I've never looked into the .bats before, but in looking right now, I think I have found at least some of the relevant information; this is in the soundmungedir.bat:

@rem Munge streams

@rem Localization
@rem Setup the extension of localized stream files (if it's english we'll just use the default extension)
@set LANGVERSION=
@for /F %%A in (%FRONTLINE_LANGVERSION%) do @set LANGVERSION=%%~A
@if /i %LANGVERSION%x==Englishx ( @set LOCALIZEEXT= ) else ( @set LOCALIZEEXT=stm_%LANGVERSION% )

@rem Munge localized stream files
@if /i not %LANGVERSION%x==Englishx @for /R %%A in (*.%LOCALIZEEXT%) do @echo Munging %%~nA%%~xA & @soundflmunge -platform %4 -banklistinput %%A -bankoutput %MUNGEDIR%\%%~nA.str -stream %CHECKDATE% -resample -checkid noabort %SOUNDOPT% %STREAMOPT% 2>>%LOGDIR%\MungeLog.txt 1>>%SOUNDLOGOUT%

@set MUNGE2SUBSTREAMS=0
@if /i %4==xbox @set MUNGE2SUBSTREAMS=1
@if /i %4==pc   @set MUNGE2SUBSTREAMS=1

@rem Build up a list of 1 substream streams to munge,
@rem Filtering the localize streams and if on xbox 4 channel streams
@set MUNGESUBSTREAM1=
@for /R %%A in (*.stm) do @if /i %%~xA==.stm ( @if not EXIST %%~dA%%~pA%%~nA.%LOCALIZEEXT% ( @if /i %MUNGE2SUBSTREAMS%==1 ( @if not EXIST %%~dA%%~pA%%~nA.st4 @set MUNGESUBSTREAM1=!MUNGESUBSTREAM1! %%A ) else ( @set MUNGESUBSTREAM1=!MUNGESUBSTREAM1! %%A ) ) )

@rem Munge 1 substream streams
@for %%A in (%MUNGESUBSTREAM1%) do @echo Munging %%~nA%%~xA & @soundflmunge -platform %4 -banklistinput %%A -bankoutput %MUNGEDIR%\ -stream %CHECKDATE% -resample -checkid noabort %SOUNDOPT% %STREAMOPT% 2>>%LOGDIR%\MungeLog.txt 1>>%SOUNDLOGOUT%

@rem Munge 2 substream streams
@if %MUNGE2SUBSTREAMS%==1 @for /R %%A in (*.st4) do @echo Munging %%~nA%%~xA & @soundflmunge -platform %4 -banklistinput %%A -bankoutput %MUNGEDIR%\ -stream %CHECKDATE% -resample -checkid noabort %SOUNDOPT% %STREAMOPT% -substream 2 2>>%LOGDIR%\MungeLog.txt 1>>%SOUNDLOGOUT%

Contrast that with the comparatively small entry for the other sound files:

@rem Munge configuration files
@rem *.snd - sound library
@rem *.mus - dynamic music configuration
@rem *.ffx - foley effects
@rem *.tsr - sound regions
@configmunge -sourcedir %SOURCEDIR% -platformdir %PLATFORMDIR% -platform %4 -inputfile *.snd *.mus *.ffx *.tsr -outputdir %MUNGEDIR%\ -hashstrings %CHECKDATE% -continue

@if %SOUNDLOG%x==1x ( @set SOUNDOPT=-verbose & @set SOUNDLOGOUT=%LOGDIR%\SoundBankLog.txt ) else ( @set SOUNDOPT= & @set SOUNDLOGOUT=NUL )

@rem Munge sound banks
@for /R %%A in (*.sfx) do @echo Munging %%~nA%%~xA & @soundflmunge -platform %4 -banklistinput %%A -bankoutput %MUNGEDIR%\ %CHECKDATE% -resample -checkid noabort %SOUNDOPT% %BANKOPT% 2>>%LOGDIR%\MungeLog.txt 1>>%SOUNDLOGOUT%
@for /R %%A in (*.asfx) do @echo Munging %%~nA%%~xA & @soundflmunge -platform %4 -banklistinput %%A -bankoutput %MUNGEDIR%\ %CHECKDATE% -resample -checkid noabort %SOUNDOPT% 2>>%LOGDIR%\MungeLog.txt 1>>%SOUNDLOGOUT%

Unfortunately, I do not know this language enough to have a clue what it all really means or if there is a solution that can be fabricated or not. It does seem like there ought to be some way of doing it, since most of the vanilla maps do pull streams from other maps for their music.

Alright, so we need to break this down a little bit.  The sound munge process is fragile but does work as designed - I've used it in my mod maps successfully.

The way batch files work is a chained process. You can't run the bat files by themselves or they will fail because they lose context that gets passed from the original munge.bat file.  You could theoretically build a separate environment and cut out the BFBuilder/chained munge but the environment was built in a way to try to make it seamless.  The bad part is that if something fails, it usually does not give a detailed error.

I'm not 100% sure what you're trying to accomplish though. Some common pitfalls while we're at a high level:
1.) Files marked read-only (shouldn't really matter but the munge can choke)
2.) Files being empty (some of the builders are fragile)

The title implies that we're trying to use shipped audio streams.  The final games audio streams and sfx are not included with the mod tools for legal reasons, and thus only referencing them will cause errors.

I recommend this for some experimentation material:
https://www.moddb.com/games/star-wars-battlefront-ii/downloads/swbf1-swbf2-soundenv-for-modders
This is a recreation of both games entire sound environments and you can see how it is handled in there.  Every audio stream in both games is included and can be moved into your folder if desired.
The BOBclan:  A Rich History


Quote from: Unit 33 on November 29, 2014, 03:44:44 AM'Please, tell me more about the logistics of the design of laser swords being wielded by space wizards' - Some guy on the internet.