TONe file extra bytes.

Knight0fDragon

Patron Supporter
Hello everybody, very long time since I have posted here.

I am currently looking into creating an app to create TON files. Currently what is out there as far as I know does not work 100% correctly.

I decided to look at the documentation to see what a TON file consists of.

I have been able to extract all of the information from a TON file, but there is a 34 byte discrepancy. This is where the documents have failed me.

There are a lot of detail as to how each section is broken up, but once you get to the PCM data, it tells you nothing.

I am guessing in this 34 bytes, lies the sample rate.

Now if you look at the non binary version of the format, you will see that the wave data has 1 byte for PCM bit size, 2 bytes for sample rate, and 32 bytes for the name. The PCM bit size is located in the layer, so it is not needed in the wav section, leaving the sample rate and name. Of course, there is nothing in there that I can find to establish this claim. I am curious if anybody has dealt with TONe files, and could shed some light to what these extra bytes are, and exactly how it is laid out in the wave section of the file.

For reference, here is the document I looked at: https://antime.kapsi.fi/sega/files/ST-235-030795.pdf

Also note, I already looked into SEQ2MID+toncnv and SSF to see if I missed anything.
 
I figured it out. There are no extra bytes, toncnv and SSF were using loop address to figure out the length of the wav. This is incorrect. You need to get every unique starting offset, order it, and use the difference to determine the PCM length. To figure out the sample rate, you need to use 44100 and factor in the base note to a mathematical formula in the docs..
 
  • Like
Reactions: vbt
Back
Top