[SOLVED] DSP stereo header
-
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
[SOLVED] DSP stereo header
Hey everybody,
does anyone have a DSP stereo sample file? I need to construct a valid header.
Thanks.
does anyone have a DSP stereo sample file? I need to construct a valid header.
Thanks.
Last edited by AlphaTwentyThree on Tue Jan 25, 2022 7:20 pm, edited 1 time in total.
-
- Posts: 136
- Joined: Mon Nov 23, 2020 6:01 pm
Re: DSP stereo header
Not sure if this is exactly what you're looking for. These are a few examples of stereo DSP files (extension .sdt) from the GameCube version of Baldur's Gate: Dark Alliance.
-
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: DSP stereo header
Yes, thank you.
However, I'm having problems figuring out how to calculate certain values with the info I got. Could you take a look?
I've uploaded the resulting file I made with my script as well as the info given: https://1fichier.com/?b7u36fdsrg8c3btot7x9
Maybe some kind of interleave is missing? I don't know how to get the value at 0x30
However, I'm having problems figuring out how to calculate certain values with the info I got. Could you take a look?
I've uploaded the resulting file I made with my script as well as the info given: https://1fichier.com/?b7u36fdsrg8c3btot7x9
Maybe some kind of interleave is missing? I don't know how to get the value at 0x30
-
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: DSP stereo header
Checked a little bit - I need an interleave at 0x98, which in my file is zero, that's why it doesn't play. However, every other value than 0x8000 (wrong interleave) won't let me play the file. Can you help me?
-
- Posts: 136
- Joined: Mon Nov 23, 2020 6:01 pm
Re: DSP stereo header
It's a tricky one, this. Thought it would be simple! Obviously your sample plays properly if you use a .txth file, but I guess you'd want an actual proper container format so that you just have 1 file per sound. It looks like the .sdt file only accepts 0x8000 as interleave for some bizarre reason - I tried a few other values and it won't play at all. And stereo .dsp files have the data for both channels completely separate. So neither of those would work for your data unless you reorganised it, but you shouldn't have to do that ...
I'll see if I can see another format that would work with that data as-is.
I'll see if I can see another format that would work with that data as-is.
-
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: DSP stereo header
Thanks a lot for looking into this! You understand my endeavor.
-
- Posts: 51
- Joined: Mon Jan 10, 2022 12:12 am
Re: DSP stereo header
Vicious Engine games (Wii U, 2012-2015) [*.str] file is not playable, implement txth, find coefs possible sample rate is 32000hz. Unlike any other Vicious Engine game on Wii, format is different.
File is from Ben 10: Omniverse
A2M games (GC/Wii, 2004-2008) [*.sst/int/str/the] file is not playable, implement txth, find coefs, sample rate is at 32000, possible interleave is 0x3200 on earlier games, but Iron Man or any other Wii game is different. BTW, the headers are must be stored in .gc/wii files.
File is from Teen Titans
When using 0xFFFFF0X0 (insert any number) method, it sounds a little better but not much.
File is from Ben 10: Omniverse
A2M games (GC/Wii, 2004-2008) [*.sst/int/str/the] file is not playable, implement txth, find coefs, sample rate is at 32000, possible interleave is 0x3200 on earlier games, but Iron Man or any other Wii game is different. BTW, the headers are must be stored in .gc/wii files.
File is from Teen Titans
When using 0xFFFFF0X0 (insert any number) method, it sounds a little better but not much.
Last edited by JackTheRipper on Sun Jan 23, 2022 9:35 pm, edited 1 time in total.
-
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: DSP stereo header
Thanks for these, however I'm really looking for a format that is playable from the start. If everything fails, I'll use this method though.
I have time to research other GC/Wii games, don't worry, I'll find something suitable eventually and post it here.
I have time to research other GC/Wii games, don't worry, I'll find something suitable eventually and post it here.
-
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: DSP stereo header
Alright, found a (true) stereo DSP in "Cabela's Big Game Hunter: 2005 Adventure" - https://1fichier.com/?bwzbl843sqx6rhgh9lqg
0xc0 header right there. I wanted to see if there are games from this specific time period that use this format.
Will try to construct this header this weekend, will be back if I succeed or have problems. Seems hard to construct though - I mean 0xc0? Really?! Oh and btw, THP DSP has a similar 0xc0 header.
0xc0 header right there. I wanted to see if there are games from this specific time period that use this format.
Will try to construct this header this weekend, will be back if I succeed or have problems. Seems hard to construct though - I mean 0xc0? Really?! Oh and btw, THP DSP has a similar 0xc0 header.
-
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: DSP stereo header
Absolutely lost here... Added a header that should work, set all values that don't change anything to zero. I'm left with some values that I don't know what they mean but changing them won't change the sound either. Last time I made a silly mistake with the second coefficients by the way - they are at 0x3e in the header information of course, the first byte has to be < 0x10.
Anyway, here are the files I fiddled around with: https://1fichier.com/?72fxp9tbtcvtoecbp1n9
01.dsp - playable stereo dsp, interleave 0x800
js_count_olafs01.dsp - the unplayable dsp I created by hand
js_count_olafs01.hdr - the info section from the main archive
If everything fails, I might use the genh format and just slap the original data in there so the files are at least playable...
I also found a complicated script I once wrote to re-interleave streams and add a genh: viewtopic.php?t=2512. No idea how I did that back then to be honest - reading this script just gives me a headache now.
Anyway, here are the files I fiddled around with: https://1fichier.com/?72fxp9tbtcvtoecbp1n9
01.dsp - playable stereo dsp, interleave 0x800
js_count_olafs01.dsp - the unplayable dsp I created by hand
js_count_olafs01.hdr - the info section from the main archive
If everything fails, I might use the genh format and just slap the original data in there so the files are at least playable...
I also found a complicated script I once wrote to re-interleave streams and add a genh: viewtopic.php?t=2512. No idea how I did that back then to be honest - reading this script just gives me a headache now.
-
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: DSP stereo header
Alright, finally solved this! After much trial-and-error I found out that the only thing I was missing was the sample count. In case of GC ADPCM that is "SIZE - (SIZE/8)". Why? Well, the format consists of 8-byte frames - one header byte and 7 sample bytes. There are SIZE/8 frames so that's also the size of all header bytes that need to be subtracted.
What's also interesting is that the interleave isn't given by a number but instead by the header byte of the first frame for left and right channel. These values are stored as a 4-byte variable after each coefficient. So the value directly after the left channel coefficient is always the header of the first (left channel) frame. Accordingly, the long value after the right channel coefficient is the header of the first right channel frame.
It's quite obvious that this format can only be used for streams with small interleaves because header values repeat quite frequently.
I've uploaded a pack consisting of the raw stream, the in-archive header and the final (playable) dsp file: https://1fichier.com/?2gmy4sc9yij8u08olb7p
All in all, this is somewhat of a dream come true for me as it opens many possibilities that I didn't have back then.
Of course I can now also join those pesky channel-split dsp files into neat stereo files.
What's also interesting is that the interleave isn't given by a number but instead by the header byte of the first frame for left and right channel. These values are stored as a 4-byte variable after each coefficient. So the value directly after the left channel coefficient is always the header of the first (left channel) frame. Accordingly, the long value after the right channel coefficient is the header of the first right channel frame.
It's quite obvious that this format can only be used for streams with small interleaves because header values repeat quite frequently.
I've uploaded a pack consisting of the raw stream, the in-archive header and the final (playable) dsp file: https://1fichier.com/?2gmy4sc9yij8u08olb7p
All in all, this is somewhat of a dream come true for me as it opens many possibilities that I didn't have back then.
Of course I can now also join those pesky channel-split dsp files into neat stereo files.
-
- Posts: 909
- Joined: Sat Aug 09, 2014 11:21 am
Re: [SOLVED] DSP stereo header
As expected, not really hard to write a mono2stereo joiner now:
Code: Select all
get NAME basename
string NAME -= 1
string N1 p "%sl.dsp" NAME
string N2 p "%sr.dsp" NAME
open FDSE N1 0
open FDSE N2 1
endian big
get SAMPLES long 0
get NIBBLES long 0
get FREQ long 0
get SIZE asize 0
xmath SSIZE "SIZE-0x60"
xmath PSIZE "2*SSIZE"
putVarChr MEMORY_FILE2 PSIZE 0
log MEMORY_FILE 0 0
callfunction interleave 1
get MSIZE asize MEMORY_FILE2
callfunction DSP 1
startfunction interleave
xmath FRAMES "SSIZE/8"
set OFF 0x60
for i = 0 < FRAMES
goto OFF 0
getDstring DATA 8 0
putDstring DATA 8 MEMORY_FILE2
goto OFF 1
getDstring DATA 8 1
putDstring DATA 8 MEMORY_FILE2
math OFF += 8
next i
endfunction
startfunction DSP
xmath PSIZE "2*SSIZE + 0xc0"
putVarChr MEMORY_FILE PSIZE2 0
log MEMORY_FILE 0 0
putVarChr MEMORY_FILE 0 SAMPLES long
putVarChr MEMORY_FILE 4 NIBBLES long
putVarChr MEMORY_FILE 8 FREQ long
putVarChr MEMORY_FILE 0x10 2 long
putVarChr MEMORY_FILE 0x14 NIBBLES long
putVarChr MEMORY_FILE 0x18 0 long
append
log MEMORY_FILE 0x1c 0x24 0
append
putVarChr MEMORY_FILE 0x50 0xc5233200 long
putVarChr MEMORY_FILE 0x54 0x90913200 long
putVarChr MEMORY_FILE 0x58 0x90913200 long
putVarChr MEMORY_FILE 0x5c 0x90913200 long
putVarChr MEMORY_FILE 0x60 SAMPLES long
putVarChr MEMORY_FILE 0x64 NIBBLES long
putVarChr MEMORY_FILE 0x68 FREQ long
putVarChr MEMORY_FILE 0x70 2 long
putVarChr MEMORY_FILE 0x74 NIBBLES long
putVarChr MEMORY_FILE 0x78 2 long
append
log MEMORY_FILE 0x1c 0x24 1
append
putVarChr MEMORY_FILE 0xa8 0x3200 long
putVarChr MEMORY_FILE 0xbf 0 byte
append
log MEMORY_FILE 0 MSIZE MEMORY_FILE2
append
string NAME += ".dsp"
log NAME 0 PSIZE MEMORY_FILE
endfunction