Conversation
|
Does mk64 use unconventional aifc? Is the sample data itself different from sm64? Maybe oot supports aifc? |
|
I tried the oot decoder and couldn't handle the files. mk64 does store a flag value of in some of the samples, which in the latest commit I have managed to extract and store in the aiff files. The aifc non matching is likely because the permute logic in the decoder is good enough to handle the ~5 frames of samples which can't be directly matches as aiff. |
There was a problem hiding this comment.
Copied straight from the sm64 repo
There was a problem hiding this comment.
adpcm copied straight from sm64, though vadpcm_enc.c has been modified for handling the VADPCMFLAGS header
| if (strcmp("VADPCMFLAGS", ChunkName) == 0) | ||
| { | ||
| fread(&vadpcmFlags, sizeof(vadpcmFlags), 1, ifile); | ||
| BSWAP32(vadpcmFlags) | ||
| } |
| strnLen = sizeof("VADPCMFLAGS") - 1; | ||
| AppChunk.ckID = 0x4150504c; // APPL | ||
| AppChunk.ckSize = 4 + 1 + strnLen + 4; | ||
| AppChunk.formType = 0x73746f63; // stoc | ||
| BSWAP32(AppChunk.ckID) | ||
| BSWAP32(AppChunk.ckSize) | ||
| BSWAP32(AppChunk.formType) | ||
| fwrite(&AppChunk, sizeof(Chunk), 1, ofile); | ||
| fwrite(&strnLen, 1, 1, ofile); | ||
| fwrite(appFlagName, strnLen, 1, ofile); | ||
| fwrite(&vadpcmFlags, sizeof(vadpcmFlags), 1, ofile); |
There was a problem hiding this comment.
Write the value into the aifc so that it can be read by assemble_sound.py
| } else if (strcmp("VADPCMFLAGS", ChunkName) == 0) { | ||
| checked_fread(&vadpcmFlags, sizeof(u32), 1, ifile); | ||
| BSWAP32(vadpcmFlags); |
There was a problem hiding this comment.
Read the flag from the aifc file generated by disassemble_sound.py
| write_header(ofile, "APPL", 4 + 12 + sizeof(vadpcmFlags)); | ||
| fwrite("stoc", 4, 1, ofile); | ||
| fwrite("\x0bVADPCMFLAGS", 12, 1, ofile); | ||
| fwrite(&vadpcmFlags, sizeof(vadpcmFlags), 1, ofile); |
There was a problem hiding this comment.
Store the VADPCMFLAGS value in the aiff file
| if len(pos) == 1: | ||
| rom_offset = None | ||
| block_offset = None | ||
| elif pos[0] == "@sound": |
There was a problem hiding this comment.
Changes ported over from sm64
There was a problem hiding this comment.
Copied in from sm64 with minor changes
| if (++iter > 1000000) { | ||
| printf("Failed to match frame %d after 1000000 attempts\n", currPos); | ||
| break; | ||
| } |
There was a problem hiding this comment.
TODO: remove this once we can figure out a way to match A0.aiff and 63.aiff
| $(BUILD_DIR)/data/sound_data/audiobanks.o: $(SOUND_BIN_DIR)/sound_data.ctl | ||
| $(BUILD_DIR)/data/sound_data/audiotables.o: $(SOUND_BIN_DIR)/sound_data.tbl | ||
|
|
||
| # TODO: the rest of these rules are currently not used by the build since sequences.json has not been dissambled |
There was a problem hiding this comment.
Not sure how to create a sequences.json. It would be cleaner if we could but I can't see any scripts to do this.
|
Also, Torch supports extracting aiff, aifc, and m64. |
|
If you join the Discord it might be easier to chat. |
|
Getting closer to a match. I realised that I think I messed something up before and the |
|
Matches :) |
|
Btw I checked and if I used torch for extraction, the decoder does not produce matching aiff's due to this ( Also I'm not sure about the the banks because to me it looks like the BanksFactory write a custom format asset file output |
I'm using this to help me port to the PS2, but I thought that it might be useful to upstream this change.
A0.aiffand68.aiffsamples cannot be matching decoded yet. The permutation has to give up after 1 million tries. For now, these are extraced as compressed aifc but not decoded.The files for dissasmbly come from the sm64 project and have been hand modified to handle the format of the files for mk64. Specifically:
drums_listcan contain null values in mk64 so those need to be included in the json filesflagsvalue of non zero (was always zero in sm64), so we decode that value and store it in theaiffas a customVADPCMFLAGSheader. I had to update the decoder, vadpcm encoder, and the sound assembler to handle this