spenibus.net
2019-03-08 01:11:36 GMT

Extracting the audio from a Metal Gear Solid Ground Zeroes cutscene (FSM file)

I couldn't find the piece of music playing when the helicopters are taking off from camp omega, neither on soundtracks, be they regular or extended, nor in the game audio files. You can hear it here at 7m40s: <center> <iframe width="560" height="315" src="https://www.youtube.com/embed/G80bgC6koq8?start=460" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </center> My last hope was to rip the audio from the cutscene itself, hoping effects and music were mixed dynamically. They weren't. Just making the code public for posterity. Using php (command line) 'cause I'm a weirdo. <?php /******************************************************************************* Rips the audio from a Metal Gear Solid Ground Zeroes cutscene (FSM file) http://metalgearmodding.wikia.com/wiki/FSM ground-zeroes-fsm-sound-extractor │ ground-zeroes-fsm-sound-extractor.phpcli │ ├───files └───tools ├───revorb │ revorb.exe │ └───ww2ogg packed_codebooks_aoTuV_603.bin ww2ogg.exe *******************************************************************************/ echo "Start\n"; $fileIn = './files/p11_010100_000.fsm'; $fileOut = $fileIn.'.wem'; $bufSize = 256*1024; $chunksPos = array(); $fh = fopen($fileIn, "rb"); //********************************************** build sound chunks offsets list echo "Building chunks list\n"; while($fh && !feof($fh)) { $bufPos = ftell($fh); $buf = fread($fh, $bufSize); $off = 0; while(true) { $pos = strpos($buf, 'SND ', $off); if($pos === false) { break; } $off = $pos+1; $chunksPos[] = $bufPos + $pos; } } echo "Found chunks: ".count($chunksPos)."\n"; //*************************************************** recompose wwise audio file echo "Recomposing sound file\n"; $file = 0; file_put_contents($fileOut, ''); foreach($chunksPos as $pos) { ++$file; // first chunk has a larger header $headerSize = ($file === 1) ? 32 : 16; fseek($fh, $pos); $buf = fread($fh, $headerSize); $data = unpack( 'A4sig/Vclen/Vs1/Vs2/H*', $buf ); $chunk = stream_get_line($fh, $data['clen'] - $headerSize); file_put_contents( $fileOut, $chunk, FILE_APPEND ); } fclose($fh); //********************************************************* convert wwise to ogg echo "Converting sound file\n"; `"./tools/ww2ogg/ww2ogg.exe" "$fileOut" -o "$fileOut.ww2ogg.ogg" --pcb "./tools/ww2ogg/packed_codebooks_aoTuV_603.bin"`; //***************************************************************** optimize ogg echo "Optimizing sound file\n"; `"./tools/revorb/revorb.exe" "$fileOut.ww2ogg.ogg" "$fileOut.revorb.ogg"`; echo "done\n";