Coders and would-be coders alike, this is the place to talk about programming.
-
OrangeC
- double-veteran

- Posts: 865
- Joined: Sun Apr 20, 2008 2:58 am
- Has thanked: 5 times
- Been thanked: 34 times
Post
by OrangeC » Fri Oct 15, 2010 12:29 am
AlphaTwentyThree wrote:Script updated, should work now.

Strange, when import the menu track in audition it starts playing but then it cuts off and crashes the program. in explorer dbpoweramp shows a runtime of over 6minutes, that can't be right unless if the file is compressed really small.
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 639 times
Post
by AlphaTwentyThree » Fri Oct 15, 2010 12:33 am
EA_ASF_scan.bms
Just scans for the older EA *.asf files. Can be used on the other *.mus containers that don't contain any header information.
Code: Select all
get BNAME basename
string BNAME += "_"
set OFFSET 0
for i = 1
goto OFFSET
FindLoc OFFSET string "\x53\x43\x48\x6c\x2c\x0\x0\x0" 0 ""
goto OFFSET
FindLoc SIZE string "\x53\x43\x45\x6c\x8" 0 ""
math SIZE += 5
math SIZE -= OFFSET
set NAME BNAME
string NAME += i
string NAME += ".asf"
log NAME OFFSET SIZE
math OFFSET += SIZE
next i
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 639 times
Post
by AlphaTwentyThree » Fri Oct 15, 2010 12:35 am
OrangeC wrote:AlphaTwentyThree wrote:Script updated, should work now.

Strange, when import the menu track in audition it starts playing but then it cuts off and crashes the program. in explorer dbpoweramp shows a runtime of over 6minutes, that can't be right unless if the file is compressed really small.
Ah ok, still something wrong... will take a look tomorrow.
-
OrangeC
- double-veteran

- Posts: 865
- Joined: Sun Apr 20, 2008 2:58 am
- Has thanked: 5 times
- Been thanked: 34 times
Post
by OrangeC » Thu Oct 28, 2010 11:07 pm
The contents of this post was deleted because of possible forum rules violation.
-
mauzerX
- advanced
- Posts: 57
- Joined: Thu Jul 01, 2010 1:48 pm
- Has thanked: 22 times
- Been thanked: 10 times
Post
by mauzerX » Thu Nov 04, 2010 8:20 pm
Hello Аlpha,сan you write a script for converting from at3 to msf\MSF?
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 639 times
Post
by AlphaTwentyThree » Mon Nov 08, 2010 7:03 am
mauzerX wrote:Hello Аlpha,сan you write a script for converting from at3 to msf\MSF?
Hm, I can try but some of the variables are unknown to me so I have no idea which value they should hold. But maybe it works nevertheless - I have no possibility to test it, though. Will drop you a PM when I get to coding it.
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 639 times
Post
by AlphaTwentyThree » Mon Nov 08, 2010 7:04 am
Updated the script to add PS2 ADPCM (*.ss2) headers - a test was missing if the interleave and stream size fit together.
-
mauzerX
- advanced
- Posts: 57
- Joined: Thu Jul 01, 2010 1:48 pm
- Has thanked: 22 times
- Been thanked: 10 times
Post
by mauzerX » Mon Nov 08, 2010 3:36 pm
AlphaTwentyThree wrote:
Hm, I can try but some of the variables are unknown to me so I have no idea which value they should hold. But maybe it works nevertheless - I have no possibility to test it, though. Will drop you a PM when I get to coding it.
Thx,I'll be waiting impatiently

-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 639 times
Post
by AlphaTwentyThree » Tue Nov 09, 2010 3:16 pm
func_header_SS2.bms
My second and more sophisticated approach to add a custom PS2 ADPCM SS2 header for vgmstream. I've used the include function and kept the main function as small as possible so that most of the actions needed are done in the function. Thus, scripts for other PS2 headers can be very easily and quickly assembled (just some 'go' and 'get' commands). As you can see I also updated the script with a memory pre-allocation to make it _way_ faster.
Code: Select all
# append SS2 header (PS2 ADPCM) to any data and write to disk
# needed variables:
# OFFSET, SIZE, FREQ, CH, INTERLEAVE, NAME (optional)
# (c) 2012-04-10 by AlphaTwentyThree of XeNTaX
startfunction SS2
set MSIZE SIZE
math MSIZE += 0x38
putVarChr MEMORY_FILE MSIZE 0
log MEMORY_FILE 0 0
set MEMORY_FILE binary "\x53\x53\x68\x64\x18\x00\x00\x00\x10\x00\x00\x00\xb0\x36\x00\x00\x02\x00\x00\x00\xc0\x2f\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x53\x53\x62\x64\x00\xe8\x11\x00"
append
log MEMORY_FILE OFFSET SIZE
append
putVarChr MEMORY_FILE 0xc FREQ long
putVarChr MEMORY_FILE 0x10 CH byte
putVarChr MEMORY_FILE 0x14 INTERLEAVE long
putVarChr MEMORY_FILE 0x24 SIZE long
if NAME == ""
get NAME basename
string NAME += ".ss2"
endif
get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE
endfunction
Example for external access:
Code: Select all
# create a manual SS2 header (PS2 ADPCM)
# (c) 2012-04-10 by AlphaTwentyThree of XeNTaX
include "func_header_SS2.bms"
set FREQ 44100
set CH 2
set INTERLEAVE 0x2400
set OFFSET 0x800
set NAME ""
get SIZE asize
math SIZE -= OFFSET
callfunction SS2 1
Last edited by
AlphaTwentyThree on Tue Apr 10, 2012 7:39 pm, edited 2 times in total.
-
OrangeC
- double-veteran

- Posts: 865
- Joined: Sun Apr 20, 2008 2:58 am
- Has thanked: 5 times
- Been thanked: 34 times
Post
by OrangeC » Tue Nov 09, 2010 8:50 pm
Once again OJ here with another riveting format
Call Of Duty black ops this time around treyarch did not add any headers to there ms adpcm audio. well RIFF headers, instead there is another custom header with sample and channel count.
but can't get any other info to decode to add a proper header in genh.
http://www.megaupload.com/?d=K9PA9KQH
Your ima adpcm header did not work.
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 639 times
Post
by AlphaTwentyThree » Wed Nov 10, 2010 1:19 am
OrangeC wrote:Once again OJ here with another riveting format
Call Of Duty black ops this time around treyarch did not add any headers to there ms adpcm audio. well RIFF headers, instead there is another custom header with sample and channel count.
but can't get any other info to decode to add a proper header in genh.
http://www.megaupload.com/?d=K9PA9KQH
Your ima adpcm header did not work.
Of course it doesn't work when it's MS ADPCM...

Well, this finally looks like I have to write some MS_ADPCM heasder adder. Such a coincidence that I was taking a look at Two Worlds (PC), which also has a MS ADPCM header variant. But I couldn't figure it out yet, seems like some variable is in the wrong place. Playing time is correct, it's just not played properly. Don't use GENH, development has stopped there and who knows how long those *.genh files are still playable. I've changed to the original headers, too.
-
OrangeC
- double-veteran

- Posts: 865
- Joined: Sun Apr 20, 2008 2:58 am
- Has thanked: 5 times
- Been thanked: 34 times
Post
by OrangeC » Wed Nov 10, 2010 1:51 am
aha i see now, will wait for your header.

-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 639 times
Post
by AlphaTwentyThree » Thu Nov 11, 2010 6:19 pm
Quake_4_X360_xpr.bms
Just coded a script to extract those *.xpr sound containers of Quake 4 for the Xbox 360.

The extracted XMA files have an XMA header variant so I'll write another script that converts these to decodable XMA files with seek table.
Code: Select all
IDSTRING XPR2
endian big
get INFOSIZE long
get DATASIZE long
get FILES long
set OFFCORR INFOSIZE
math OFFCORR += 0xc
for i = 1 <= FILES
getDstring EXT 4
get HEADER long
get HEADERSIZE long
get OFFSET long
get SIZE long
get NAMEPOS long
math HEADER += 0xc
math NAMEPOS += 0xc
math OFFSET += OFFCORR
savepos MYOFF
goto NAMEPOS
get NAME string
string NAME += "."
string NAME += EXT
savepos NAMEPOS
goto MYOFF
log MEMORY_FILE 0 0
append
log MEMORY_FILE HEADER HEADERSIZE
log MEMORY_FILE OFFSET SIZE
get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE
append
next i