News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Henke37's SDAT reader  (Read 4947 times)

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Henke37's SDAT reader
« on: March 05, 2011, 03:10:32 pm »
I've done some work on making a SDAT reader myself. But I gave up rather quickly because I couldn't figure one thing out: how to deal with ADPCM data. All I got out was something that was 99 % ear bleed.

If anyone feels like pointing out my mistake then I would be grateful. But I doubt that I will do a lot of work on this one.

Find the WIP here. It's in actionscript 3.
« Last Edit: March 06, 2011, 05:47:38 pm by henke37 »

Low Lines

  • Full Member
  • ***
  • Posts: 173
    • View Profile
    • lowlines
Re: Henke37's SDAT reader
« Reply #1 on: March 06, 2011, 02:10:24 pm »
Wow I didn't know you could open binary files in actionscript :o

Last time I tried decoding the ADPCM I didn't have much luck either. I don't believe it is just straight ADPCM like you would find in a PC audio file, my only resource site that I know of that has had some discussion on the ADPCM is at http://hcs64.com/ but I can't navigate my way around it all too well.

If you have any breakthroughs, let me know, I would love to add full support for SDATs in my project :p

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Henke37's SDAT reader
« Reply #2 on: March 06, 2011, 05:47:25 pm »
You'd be amazed what Flash can do these days. Adobe even dropped a developer only WIP release with hardware accelerated 3D rendering this week.

I did see the vgmstream project actually, I even peeked at the source code. While I easily found the relevant code, I sadly didn't gain anything from it.

Also, I did more work on the project today, the download link has been updated.

Auryn

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: Henke37's SDAT reader
« Reply #3 on: March 07, 2011, 07:10:06 pm »
I don't know if it's usefull to u but better post it and u choose :p

It's looking more like GBA
http://gsf.caitsith2.net/


And this is NDS:
http://nocash.emubase.de/gbatek.htm#dssound

Good luck

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Henke37's SDAT reader
« Reply #4 on: March 08, 2011, 03:08:31 am »
Thanks for the links, but I actually already had the later one already.

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Henke37's SDAT reader
« Reply #5 on: March 20, 2011, 03:37:43 pm »
Great news, I finally got some help and have gotten the adpcm decoding working properly. The looping/ending logic is still left to clean up, but it works!

Low Lines

  • Full Member
  • ***
  • Posts: 173
    • View Profile
    • lowlines
Re: Henke37's SDAT reader
« Reply #6 on: April 04, 2011, 09:43:10 am »
Was just having a look at your WIP and I can open up the actionscript files just fine however the fla won't open with Flash CS3. I'll assume my version of Flash is too outdated...curse you yearly non-backwards compatible software updates >_<

Can you include a built swf so the app can be viewed without the need for compiling it?

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Henke37's SDAT reader
« Reply #7 on: April 04, 2011, 11:19:47 am »
The code requires a compiler that can compile for FP 10, CS 3 does not qualify. CS 4 is the minimum version there. As for the FLA, it only links to a document class and does nothing else.

Glad that you asked, because I was about to post something half decent right now actually.

EDIT: Here it is
« Last Edit: April 04, 2011, 11:27:48 am by henke37 »

Low Lines

  • Full Member
  • ***
  • Posts: 173
    • View Profile
    • lowlines
Re: Henke37's SDAT reader
« Reply #8 on: April 04, 2011, 11:39:08 am »
Dunno about the background color ($_$) but it definitely works :)

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Henke37's SDAT reader
« Reply #9 on: April 04, 2011, 11:49:31 am »
Well, there is still that issue with streams not ending correctly, I wish I could fix that one. It's annoying me.

EDIT: I could have sworn that I had already posted the link to the repository, but here it is.
« Last Edit: April 04, 2011, 04:34:40 pm by henke37 »

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Henke37's SDAT reader
« Reply #10 on: September 10, 2011, 06:45:03 pm »
Well, I got the mono/stereo bug fixed now.

But I still have one left in the STRM player.

The issue is that my code introduces a noise after the file has reached the loop point. And it is not just a single pop due to an inappropriate seek, but a far more frequent error. I have figured this much:
  • The decoding works perfectly until the loop point
  • The error is an ADPCM predictor corruption, the right samples are still being decoded, but with way wrong amplitude.
  • The error period is closely related to how many samples I decode in each method call.
  • The error is not caused by the resampler.
  • The error happens both for stereo and mono streams.

All my code looks fine, I just can't figure out what is going wrong here. I've been at this for months now. :banghead:

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Henke37's SDAT reader
« Reply #11 on: January 15, 2012, 11:40:41 am »
For those who cares I solved the decoding error long ago and added support for waves from wavebanks while at it.

But I started working on a sequence player yesterday. This one is going to take more than a little time.

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Henke37's SDAT reader
« Reply #12 on: October 05, 2012, 10:12:30 am »
I recently (last month) had a request to export the instruments in a SDAT file.

I made a little tool to do exactly that.

Source code here. Prebuilt AIR app here.