Fix sounds compilation problems

Stopped copying over peach's lines from the mario folder to wario/luigi sound folders
Stopped compiling peach's lines for wario/luigi sound folders
Created a tool to precompile the aiffc tables and append them into custom sounds
    this matches what mario's sound files are like

I believe the issue is that previously we would copy over the sound files and
they were either incomplete or would be compiled during the copying process

I noticed that Mario's sounds had their sound tables inserted into the aiff
file already, and none of our custom sounds did. This caused a different path
to be taken for mario sounds than the rest of ours. In order to prevent the
possibility that there was a problem with that seperate path, I've created
a tool that can insert the table into the file to match how mario sounds are.
This commit is contained in:
MysterD 2023-04-25 11:25:46 -07:00
parent 6ed3c2cc60
commit 93a1b7af8c
87 changed files with 84 additions and 19 deletions

View file

@ -486,11 +486,12 @@ ifeq ($(TARGET_BITS), 32)
_ := $(shell rm -rf sound/samples/sfx_custom_luigi_peach/*.aiff) _ := $(shell rm -rf sound/samples/sfx_custom_luigi_peach/*.aiff)
_ := $(shell rm -rf sound/samples/sfx_custom_wario/*.aiff) _ := $(shell rm -rf sound/samples/sfx_custom_wario/*.aiff)
_ := $(shell rm -rf sound/samples/sfx_custom_wario_peach/*.aiff) _ := $(shell rm -rf sound/samples/sfx_custom_wario_peach/*.aiff)
endif
# Copy missing character sounds from mario sound banks # Copy missing character sounds from mario sound banks
_ := $(shell $(PYTHON) $(TOOLS_DIR)/copy_mario_sounds.py) _ := $(shell $(PYTHON) $(TOOLS_DIR)/copy_mario_sounds.py)
endif
# Copy missing instrument samples from the music sound banks # Copy missing instrument samples from the music sound banks
_ := $(shell $(PYTHON) $(TOOLS_DIR)/copy_extended_sounds.py) _ := $(shell $(PYTHON) $(TOOLS_DIR)/copy_extended_sounds.py)

View file

@ -81,55 +81,55 @@
"sound": "0D" "sound": "0D"
}, },
"inst14": { "inst14": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "0E" "sound": "0E"
}, },
"inst15": { "inst15": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "0F" "sound": "0F"
}, },
"inst16": { "inst16": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "10" "sound": "10"
}, },
"inst17": { "inst17": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "11" "sound": "11"
}, },
"inst18": { "inst18": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "12" "sound": "12"
}, },
"inst19": { "inst19": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "13" "sound": "13"
}, },
"inst20": { "inst20": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "14" "sound": "14"
}, },
"inst21": { "inst21": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "15" "sound": "15"
}, },
"inst22": { "inst22": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "16" "sound": "16"

View file

@ -81,55 +81,55 @@
"sound": "0D" "sound": "0D"
}, },
"inst14": { "inst14": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "0E" "sound": "0E"
}, },
"inst15": { "inst15": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "0F" "sound": "0F"
}, },
"inst16": { "inst16": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "10" "sound": "10"
}, },
"inst17": { "inst17": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "11" "sound": "11"
}, },
"inst18": { "inst18": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "12" "sound": "12"
}, },
"inst19": { "inst19": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "13" "sound": "13"
}, },
"inst20": { "inst20": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "14" "sound": "14"
}, },
"inst21": { "inst21": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "15" "sound": "15"
}, },
"inst22": { "inst22": {
"ifdef": ["VERSION_US", "VERSION_EU"], "ifdef": ["EXTENDED_CHAR_SOUNDS"],
"release_rate": 208, "release_rate": 208,
"envelope": "envelope0", "envelope": "envelope0",
"sound": "16" "sound": "16"

View file

@ -0,0 +1,64 @@
#!/usr/bin/env python3
import sys
import os
import time
# find sound/samples/*custom* -name '*.aiff' | while read filename; do python3 tools/append_aiffc_table.py "$filename"; done
# Get the filename from the first command line argument
if len(sys.argv) < 2:
print("Usage: {} <filename>".format(sys.argv[0]))
sys.exit(1)
filename = sys.argv[1]
# check if the binary file contains the string 'VADPCMCODES', and if so print that it was already found and exit
with open(filename, 'rb') as f:
content = f.read()
if b'VADPCMCODES' in content:
print('Already contains a table for ' + filename + '. Exiting.')
sys.exit(0)
# run the program ./tools/tabledesign on the specified filename and capture the output
import subprocess
command = ['./tools/tabledesign', '-s', '1', filename]
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = result.stdout.decode('utf-8').strip()
# split the output by whitespace
words = output.split()
# calculate header info
size = len(words) * 2 + 18
unknown = 0x0b
version = 1
# append the chunk header
chunk = b''
chunk += b'APPL'
chunk += size.to_bytes(4, 'big', signed=True)
chunk += b'stoc'
chunk += unknown.to_bytes(1, 'big', signed=False)
chunk += b'VADPCMCODES'
chunk += version.to_bytes(2, 'big', signed=False)
# convert each word to a signed 16 bit integer and append them to content
for word in words:
value = int(word)
chunk += value.to_bytes(2, 'big', signed=True)
# find the index of the first instance of 'SSND'
index = content.find(b'SSND')
if index == -1:
print("Couldn't find 'SSND' for ' + filename + '. Aborting.")
sys.exit(1)
if size != len(chunk) - 8:
print('Failed to generate the correct size for ' + filename)
sys,exit(1)
# insert the chunk before 'SSND'
content = content[:index] + chunk + content[index:]
# write the modified content to the binary file
with open(filename, 'wb') as f:
f.write(content)