Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

[SOLVED] DSP stereo header

Featured Replies

  • Author
  • Localization

AlphaTwentyThree, posted Thu Jan 20, 2022 5:30 pm (69215)


Hey everybody,

does anyone have a DSP stereo sample file? I need to construct a valid header.
Thanks.
  • Author
  • Localization

DKDave, posted Thu Jan 20, 2022 7:26 pm (69217)


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.

  • Author
  • Localization

AlphaTwentyThree, posted Fri Jan 21, 2022 6:06 am (69239)


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
  • Author
  • Localization

AlphaTwentyThree, posted Fri Jan 21, 2022 6:36 am (69240)


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?
  • Author
  • Localization

DKDave, posted Fri Jan 21, 2022 2:42 pm (69252)


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.
  • Author
  • Localization

AlphaTwentyThree, posted Fri Jan 21, 2022 5:47 pm (69257)


Thanks a lot for looking into this! You understand my endeavor. :)
  • Author
  • Localization

JackTheRipper, posted Sat Jan 22, 2022 12:16 am (69265)


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.
  • Author
  • Localization

AlphaTwentyThree, posted Sat Jan 22, 2022 8:27 am (69271)


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. :)
  • Author
  • Localization

AlphaTwentyThree, posted Sat Jan 22, 2022 8:58 am (69272)


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.
  • Author
  • Localization

AlphaTwentyThree, posted Sun Jan 23, 2022 6:29 am (69294)


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.
  • Author
  • Localization

AlphaTwentyThree, posted Tue Jan 25, 2022 7:20 pm (69358)


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.
  • Author
  • Localization

AlphaTwentyThree, posted Tue Jan 25, 2022 8:03 pm (69360)


As expected, not really hard to write a mono2stereo joiner now:

Code:
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
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.