Converting `.wav` to `.event`

Trying to convert a .wav to an .event to insert as a sample. I’ve looked at WAV2EA, but it seems to produce songs instead of samples.

I have this .wav that I exported from OpenMPT. Right before the footer begins there’re these values:
BB B2 78 38 01 00
Which seem to correspond to the last values in the sappy file I get when I export the .s from sappy after importing the .wav:
.byte 0x3B,0x32,0xF8,0xB8,0x81,0x80,0x63,0x6B

Seems to be the same, except with 0x80 XORed with every byte? There also are these two values (seemingly appended?) in the .s file right at the end: 0x63,0x6B. I can’t find their corresponding values in the .wav.

Could someone help me understand what these last two bytes represent? I wanted to make something that can take a .wav and produce a corresponding .event to insert with the Advanced music installer because right now I’m constantly importing .wavs into sappy and exporting .s for lack of a better tool.

Here are the files I’m referring to.

1 Like

I think I figured it out. A different sample had an extra 6 bytes added instead. I think the extra bytes are simply padding to ensure the sample is a multiple of 16 bytes. The reason why the padding looks like garbage is because those values were from a previous sample I inserted before. I’ve been using this one ROM to insert samples into for exporting, and overwriting from the same address over and over again.

Still am curious why all bytes seem to have their MSB XORed in the .s file when compared to the .wav though.

Padding at the end of samples is also used for interpolation; for example, the byte at the end of the sample will “look ahead” to the next byte rather than going back to the loop start, so a sequence of 0x80 [go to loop start] 0x81 0x82 0x83 might end up being expressed as 0x80 0x00 0x82 0x83 without the padding. Anecdotally, I remember hearing clicking sounds in the loops when I formatted samples without any padding bytes.

I swear, this rabbit hole just goes deeper & deeper…

I have a noob mode solution I found while looking to see if critical quotes would sound good. In the song track editor, you can directly import wav files in FEBuilder. It doesn’t answer the specific question, but it works for inserting it as a sample.