Skip to content

Commit

Permalink
Finish Adult/Child voice packs
Browse files Browse the repository at this point in the history
  • Loading branch information
rrealmuto committed Dec 24, 2024
1 parent b0cac17 commit 278c939
Show file tree
Hide file tree
Showing 221 changed files with 10 additions and 169 deletions.
19 changes: 10 additions & 9 deletions Voices.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def process_pak_sfx_by_id(pak_sfx_id: int, sfx_id_map, pak_sounds, age):
name, decompressed = pak_opts[0]
_file = io.BytesIO(decompressed)
soundData, numSampleFrames, sampleRate = process_sound_file(name, _file, trim=True)
to_add.append((name, rom_targets[0], soundData, numSampleFrames, sampleRate, patch))
to_add.append((name, 0, rom_targets[0], soundData, numSampleFrames, sampleRate, patch))
_file.close()
else:
raise Exception("Unsupported sfx type")
Expand All @@ -477,7 +477,6 @@ def _patch_voice_pack(rom: Rom, age: VOICE_PACK_AGE, voice_pack: str, settings:
if settings.generating_patch_file:
return

bank0 = rom.audiobanks[0]
# Build voice pack path
voice_pack_dir = os.path.join(data_path(), "Voices", "Child" if age == VOICE_PACK_AGE.CHILD else "Adult", voice_pack)

Expand Down Expand Up @@ -558,23 +557,25 @@ def _patch_voice_pack(rom: Rom, age: VOICE_PACK_AGE, voice_pack: str, settings:
with zf.open(sample_file) as f:
# Read and process the file
soundData, numSampleFrames, sampleRate = process_sound_file(sample_file, f)
sfxs.append((sample_file, index, soundData, numSampleFrames, sampleRate, None))
sfxs.append((sample_file, bank, index, soundData, numSampleFrames, sampleRate, None))
zf.close()

sfx_data_start = len(rom.audiotable)

# Patch each sfx that we have
for _, sfx_id, soundData, numSampleFrames, sampleRate, patch in sfxs:
for _, bank_index, sfx_id, soundData, numSampleFrames, sampleRate, patch in sfxs:
# Calculate the tuning as sampling rate / 32000.
tuning = sampleRate / 32000

# Pad the data to 16 bytes
soundData += bytearray((16 - (len(soundData)%16))%16)

bank = rom.audiobanks[bank_index]

# Sort-of problem. We need to update audiotable in multiple different spots.
# So instead of making the new file, maybe just add a new variable to Rom called new_audiotable_data and write it all at the end.
# Update sample address to point to new data in audiotable.
sfx: SFX = bank0.SFX[sfx_id]
sfx: SFX = bank.SFX[sfx_id]

# Compare sound data to existing to see if it fits
if len(soundData) > sfx.sample.size:
Expand All @@ -600,9 +601,9 @@ def _patch_voice_pack(rom: Rom, age: VOICE_PACK_AGE, voice_pack: str, settings:
loopBytes = sfx.sample.loop.get_bytes()

# Write the new sample into the bank
bank0.bank_data[sfx.sampleOffset:sfx.sampleOffset+0x10] = sfx.sample.get_bytes()
bank0.bank_data[sfx.sfx_offset:sfx.sfx_offset+0x08] = sfx.get_bytes()
bank0.bank_data[sfx.sample.loop_addr:sfx.sample.loop_addr+len(loopBytes)] = loopBytes
bank.bank_data[sfx.sampleOffset:sfx.sampleOffset+0x10] = sfx.sample.get_bytes()
bank.bank_data[sfx.sfx_offset:sfx.sfx_offset+0x08] = sfx.get_bytes()
bank.bank_data[sfx.sample.loop_addr:sfx.sample.loop_addr+len(loopBytes)] = loopBytes


dma_entry = rom.dma[AUDIOSEQ_DMADATA_INDEX]
Expand Down Expand Up @@ -631,7 +632,7 @@ def process_sound_file(file_name: str, file, trim: bool = False) -> tuple[bytear
elif ext == ".bin":
soundData, numSampleFrames, sampleRate = process_bin_file(file)
else:
raise Exception("Unsupported file format")
raise Exception(f"Unsupported file format {ext} in custom voice pack.")

return soundData, numSampleFrames, sampleRate

Expand Down
Binary file removed data/Voices/Adult/Feminine/00-0000.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0001.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0002.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0003.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0004.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0005.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0006.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0007.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0008.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0009.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-000A.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-000B.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-000C.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-000D.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-000E.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-000F.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0010.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0011.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0012.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0013.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0015.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0016.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0017.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0018.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0019.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-001A.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-001B.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0037.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0038.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-003C.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-003D.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-004D.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-004E.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-004F.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0050.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0051.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0052.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0053.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0054.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0055.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0056.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0057.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0058.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine/00-0086.bin
Binary file not shown.
Binary file added data/Voices/Adult/Feminine/FeminineAdult.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_New/Adult Link - Hup.aifc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 0 additions & 11 deletions data/Voices/Adult/Feminine_New/rename.sh

This file was deleted.

46 changes: 0 additions & 46 deletions data/Voices/Adult/Feminine_New/voice_map.json

This file was deleted.

Binary file removed data/Voices/Adult/Feminine_directbank/00-0000.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0001.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0002.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0003.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0004.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0005.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0006.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0007.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0008.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0009.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-000A.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-000B.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-000C.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-000D.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-000E.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-000F.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0010.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0011.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0012.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0013.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0015.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0016.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0017.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0018.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0019.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-001A.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-001B.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0037.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0038.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-003C.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-003D.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-004D.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-004E.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-004F.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0050.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0051.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0052.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0053.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0054.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0055.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0056.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0057.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0058.bin
Binary file not shown.
Binary file removed data/Voices/Adult/Feminine_directbank/00-0086.bin
Binary file not shown.
Binary file not shown.
61 changes: 0 additions & 61 deletions data/Voices/Adult/Feminine_directbank/voice_map.json

This file was deleted.

Binary file removed data/Voices/Child/Feminine/00-0014.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-001C.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-001D.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-001E.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-001F.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0020.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0021.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0022.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0023.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0024.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0025.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0026.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0027.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0028.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0029.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-002A.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-002B.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-002C.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-002D.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-002E.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-002F.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0030.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0031.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0032.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0034.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0035.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0036.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-003E.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-003F.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0040.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0041.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0042.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0043.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0045.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0047.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0048.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0049.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-004A.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-004B.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-004C.bin
Binary file not shown.
Binary file removed data/Voices/Child/Feminine/00-0087.bin
Binary file not shown.
Binary file added data/Voices/Child/Feminine/FeminineChild.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
42 changes: 0 additions & 42 deletions data/Voices/Child/Feminine_New/voice_map.json

This file was deleted.

0 comments on commit 278c939

Please sign in to comment.