First of all I am not fluent at speaking English so bear with me...
Every snd0_##.dat and snd1_#.dat file, there's always a header that determines what time the loop will start and end and its length. This header usually starts with the string "mtxs" followed by 12 bytes.
This is the header I made for my custom snd0_2.dat:
6D 74 78 73 DD FB 33 00 EC D6 05 00 DD FB 33 00
1. 6D 74 78 73
Converting the first four bytes of the header into a string will result to "mtxs".
2. DD FB 33 00
The second group of four bytes determines the length of a music file in samples, in little endian order. This means that this sound file has 3,406,813 samples in length.
3. EC D6 05 00
The third group of four bytes determines the starting length of a loop in samples, again in little endian order. This means that this sound file starts looping at 382,700 samples.
(If the sound file doesn't have a starting loop it should be set to 0.)
4. DD FB 33 00
The last group of four bytes determines the ending length of a loop in samples, again in little endian order. Usually this is the same as the second group of four bytes. This means that this sound file ends the loop at 3,406,813 samples.
(If the sound file doesn't have an ending loop it should be set to the length of the sound file in samples.)
To convert seconds to samples, multiply the length of a sound file with the sample rate of a sound file. Example, if the sound file has a length of 32 seconds and the sample rate is 44100 Hz, then the sample length of this sound file is 1,411,200 samples.
And btw ogg file format really works. Hope this helps.