Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Extracting audios from Hitman Blood Money STR file

Get help on any and all audio formats, or chip in and help others!
Post Reply
maurocio
n00b
Posts: 15
Joined: Tue Jan 26, 2010 8:45 pm
Has thanked: 7 times
Been thanked: 1 time

Extracting audios from Hitman Blood Money STR file

Post by maurocio »

Hi all,

I try to extract all audios on file pc_eng.str file from Hitman Blood money, but the most of files has a type a unknow conversion.

I manage a program (attached on post) to explore str file and extract files. Files appear like wav, but files are not wav. This app extract all files but u only can play a few files that are ogg rest of files has a conversion/compresion.

I know that I can use program towav (this extract files and do a conversion on wav files, anyone knowns that conversion is?)

Could anyone help to analyze this files?
many thanks.
If you need I can attach a wav file or str hitman file.

To extract files from str file uses right button on file, file will extracted on temp folder

Note: Is possible that this program works with Kane and Lynch
You do not have the required permissions to view the files attached to this post.
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Extracting audios from Hitman Blood Money STR file

Post by AlphaTwentyThree »

You should upload some of these unplayable files to take a look at.
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
maurocio
n00b
Posts: 15
Joined: Tue Jan 26, 2010 8:45 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Extracting audios from Hitman Blood Money STR file

Post by maurocio »

The contents of this post was deleted because of possible forum rules violation.
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Extracting audios from Hitman Blood Money STR file

Post by AlphaTwentyThree »

I'm currently writing a script for this particular file. Some of these are plain wav, others ogg as you already metioned, others are headerless IMA adpcm with information provided. I'll try to automatically add valid headers to the individual files or automatically rename them to ogg.
I'll post here again later.
Last edited by AlphaTwentyThree on Thu Jan 12, 2012 2:58 pm, edited 1 time in total.
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
maurocio
n00b
Posts: 15
Joined: Tue Jan 26, 2010 8:45 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Extracting audios from Hitman Blood Money STR file

Post by maurocio »

Sorry, I don't put a dialog message to choose the path for extract. You need to put a folder named 'temp' on same folder of program to extract files on temp folder.

Thanks
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Extracting audios from Hitman Blood Money STR file

Post by AlphaTwentyThree »

Ok, I've quickly written a script that extracts the files including the header information from the source file. I named all files *.rwav (raw wav) for later postprocessing. For this purpose I've just constructed a header consisting the "RWAV" idstring, the data start offset and the header from the str file.
I'll get to the postprocessing later on.
Here's the script so far:

Code: Select all

idstring "IOISNDSTREAM"
goto 0x10
get INFO long
get FILES long
get HEADERSIZE long
goto INFO
for i = 1 <= FILES
	get FILENUMBER long
	get ZERO long
	get OFFSET long
	get ZERO long
	get SIZE long
	get ZERO long
	get INFOPOS long
	get ZERO long
	get INFOLENGTH long
	get UNK long
	get NAMEL long
	get ZERO long
	get NAMEPOS long
	get ZERO long
	get UNK long
	get UNK long
	get ZERO long
	get ZERO long
	savepos MYOFF
	goto NAMEPOS
	getDstring NAME NAMEL
	log MEMORY_FILE 0 0
	set HEADERSIZE INFOLENGTH
	math HEADERSIZE += 8
	PutVarChr MEMORY_FILE 0 0x56415752 long # RWAV
	PutVarChr MEMORY_FILE 4 HEADERSIZE long
	append
	log MEMORY_FILE INFOPOS INFOLENGTH
	log MEMORY_FILE OFFSET SIZE
	append
	get SIZE asize MEMORY_FILE
	string NAME += ".rwav"
	log NAME 0 SIZE MEMORY_FILE
	goto MYOFF
next i
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
Gromber
advanced
Posts: 55
Joined: Tue Oct 05, 2010 9:42 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Extracting audios from Hitman Blood Money STR file

Post by Gromber »

thanks for this! :wink:
maurocio
n00b
Posts: 15
Joined: Tue Jan 26, 2010 8:45 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Extracting audios from Hitman Blood Money STR file

Post by maurocio »

Woahhhh!!

AlphaTwentyThree you're a genius!!!!

I waste two weeks on try to get info about str file and try to explore this correct, and you only need a few a hours.
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Extracting audios from Hitman Blood Money STR file

Post by AlphaTwentyThree »

Well, not finished yet - the IMA adpcm format is a bit tricky...
Be sure to leave a "thanks" while I'm at it. ;)
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
maurocio
n00b
Posts: 15
Joined: Tue Jan 26, 2010 8:45 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Extracting audios from Hitman Blood Money STR file

Post by maurocio »

sure.

Do you have decode info values on file?

I'll try to decode info on file but only see a value that indicate frencuency on Hz

Info

Unk1 long
Unk2 long
Unk3 long (maybe indicate 1 mono 2, stereo)
Frencuency_on_hz long
Unk4 long (maybe bits)
Unk5 long
Unk6 long


I'm continuing analizing this info.

Thanks
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: Extracting audios from Hitman Blood Money STR file

Post by AlphaTwentyThree »

Ok, finished the script after a while. Had so find a working IMA ADPCM header first. Apparently I found one. :)
So here's the script to post-process the *.rwav files. Resulting *.lwav files can be played with the vgmstream plugin for Winamp.

Code: Select all

# post-process *.rwav files from Hitman: Blood Money (PC)
# (c) 2012-02-17 by AlphaTwentyThree of XeNTaX

idstring "RWAV"
get OFFSET long
get SIZE asize
math SIZE -= OFFSET
get TYPE long
get UNK long
get CH long
get FREQ long
get BITS long
	
if TYPE == 2 # uncompressed PCM, 0x18 header
	set TYPE "WAV"
elif TYPE == 0x11
	set TYPE "WAV"
elif TYPE == 3 # IMA ADPCM, 0x20 header
	set TYPE "IMA"
elif TYPE == 4 # ogg
	set TYPE "OGG"
endif

if TYPE == "WAV"
	get BLOCKALIGN long
	callfunction PCM 1
	get SIZE asize MEMORY_FILE
	get NAME basename
	string NAME += ".wav"
	log NAME 0 SIZE MEMORY_FILE
elif TYPE == "IMA"
	get INTERLEAVE long
	get UNK long
	callfunction IMA 1
	get SIZE asize MEMORY_FILE
	get NAME basename
	string NAME += ".lwav"
	log NAME 0 SIZE MEMORY_FILE
elif TYPE == "OGG"
	get NAME basename
	string NAME += ".ogg"
	log NAME OFFSET SIZE
endif

startfunction PCM
	set PRE SIZE
	math PRE += 0x2c
	putVarChr MEMORY_FILE PRE 0
	log MEMORY_FILE 0 0
	set MEMORY_FILE binary "\x52\x49\x46\x46\x00\x00\x00\x00\x57\x41\x56\x45\x66\x6d\x74\x20\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x61\x74\x61\xff\xff\xff\xff"
	append
	log MEMORY_FILE OFFSET SIZE
	append
	set RIFFSIZE SIZE
	math RIFFSIZE += 36
	set AVGBYTES FREQ
	math AVGBYTES *= BLOCKALIGN

	putvarchr MEMORY_FILE 4 RIFFSIZE long
	putvarchr MEMORY_FILE 20 1 short          # wFormatTag: Microsoft PCM Format (0x0001)
	putvarchr MEMORY_FILE 22 CH short   # wChannels
	putvarchr MEMORY_FILE 24 FREQ long   # dwSamplesPerSec
	putvarchr MEMORY_FILE 28 AVGBYTES long    # dwAvgBytesPerSec
	putvarchr MEMORY_FILE 32 BLOCKALIGN short # wBlockAlign
	putvarchr MEMORY_FILE 34 BITS short       # wBitsPerSample
	putvarchr MEMORY_FILE 40 SIZE long
endfunction

startfunction IMA
	set PRE SIZE
	math PRE += 0x2c
	putVarChr MEMORY_FILE PRE 0
	log MEMORY_FILE 0 0
	set MEMORY_FILE binary "\x52\x49\x46\x46\x28\xCC\x0B\x00\x57\x41\x56\x45\x66\x6D\x74\x20\x14\x00\x00\x00\x11\x00\x01\x00\x44\xAC\x00\x00\x94\x83\x01\x00\x00\x04\x04\x00\x02\x00\x40\x00\x64\x61\x74\x61\x00\xCC\x0B\x00"
	set RIFFSIZE SIZE
	math RIFFSIZE += 0x28
	putVarChr MEMORY_FILE 0x4 RIFFSIZE long
	putVarChr MEMORY_FILE 0x16 CH short
	putVarChr MEMORY_FILE 0x18 FREQ long
	putVarChr MEMORY_FILE 0x20 INTERLEAVE short
	putVarChr MEMORY_FILE 0x2C SIZE long
	append
	log MEMORY_FILE OFFSET SIZE
	append
endfunction
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)
maurocio
n00b
Posts: 15
Joined: Tue Jan 26, 2010 8:45 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Extracting audios from Hitman Blood Money STR file

Post by maurocio »

woah!!!!! Amazing!!!!

Thanks 4 your work
master20
ultra-n00b
Posts: 1
Joined: Thu Apr 12, 2012 8:35 pm

Re: Extracting audios from Hitman Blood Money STR file

Post by master20 »

sorry.how can i use this script? explain please
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 682 times
Contact:

Re: Extracting audios from Hitman Blood Money STR file

Post by Mr.Mouse »

viewtopic.php?f=28&t=1270 Please review the new forum rules everyone.
InnocentSam2
n00b
Posts: 15
Joined: Thu Apr 05, 2012 2:06 pm
Has thanked: 4 times
Been thanked: 2 times

Re: Extracting audios from Hitman Blood Money STR file

Post by InnocentSam2 »

Your scripts work fine however the file I output gets clipped off at the end and start with a large amount of static briefly. I used the vgmstream plugin for VLC and the vgmstream "test.exe" but they both produce the same sound.
Post Reply