Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio decomp, supersedes #1236 #1509

Closed
wants to merge 161 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
fcbaae5
Initial proof of concept for audio decomp
MNGoldenEagle Apr 23, 2021
3837650
Added gap detection
MNGoldenEagle Apr 28, 2021
b607a95
Cleaned up logging, skipped a bad instrument set?
MNGoldenEagle Apr 29, 2021
b34606f
Update to match more closely and align with decomp
MNGoldenEagle Aug 9, 2021
53a6a3c
git subrepo clone https://github.com/sauraen/seq64 tools/seq64
MNGoldenEagle Oct 18, 2021
330f175
Added tables, sequence 0, and updates to the sound script
MNGoldenEagle Oct 23, 2021
afffc87
Merge subrepo commit ''
MNGoldenEagle Oct 28, 2021
c910f9f
Fixed up some bugs, finished renaming sets to fonts
MNGoldenEagle Oct 28, 2021
b417b5e
Initial proof of concept for audio decomp
MNGoldenEagle Apr 23, 2021
a01b5e2
Added gap detection
MNGoldenEagle Apr 28, 2021
0b131db
Cleaned up logging, skipped a bad instrument set?
MNGoldenEagle Apr 29, 2021
47930da
Update to match more closely and align with decomp
MNGoldenEagle Aug 9, 2021
9eaaa17
git subrepo clone https://github.com/sauraen/seq64 tools/seq64
MNGoldenEagle Oct 18, 2021
275ff85
Added tables, sequence 0, and updates to the sound script
MNGoldenEagle Oct 23, 2021
80bc683
Merge subrepo commit ''
MNGoldenEagle Oct 28, 2021
5e694e6
Fixed up some bugs, finished renaming sets to fonts
MNGoldenEagle Oct 28, 2021
6391b53
Fixed sequence parsing
MNGoldenEagle Oct 28, 2021
2837519
Improvements
MNGoldenEagle Nov 15, 2021
112fe14
Brought over fixes in seq64
MNGoldenEagle Nov 15, 2021
51cb0e7
Modified structures slightly based on recommendations from Sauraen
MNGoldenEagle Nov 15, 2021
7e49873
git subrepo clone git@github.com:sauraen/AudiobankToC.git tools/Audio…
MNGoldenEagle Nov 15, 2021
1d2adee
Updated scripts to output soundfonts, improved terminology
MNGoldenEagle Nov 21, 2021
ddcb750
Added import XMLs for soundfonts, sequences, and sample banks
MNGoldenEagle Nov 21, 2021
b097ce7
update???
waffleoRai Nov 21, 2021
0e75ed4
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Nov 21, 2021
4df638a
Extraction OK?
MNGoldenEagle Nov 24, 2021
9a45f86
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Nov 25, 2021
552fb95
Use baserom and offsets table instead of explicit files
MNGoldenEagle Nov 25, 2021
1ccf072
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Nov 25, 2021
a3b156d
Also updated disassemble_sequences to use baserom
MNGoldenEagle Nov 25, 2021
c941f32
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Nov 25, 2021
24b8a53
Reworked to make samples unique, banks are now defined in separate XM…
MNGoldenEagle Nov 29, 2021
cb1eeba
Generate Banks.xml
MNGoldenEagle Nov 30, 2021
bd843e1
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Nov 30, 2021
aad59bb
Added the rest of the soundfont definitions
MNGoldenEagle Dec 2, 2021
098ec8c
Minor fixes
MNGoldenEagle Dec 2, 2021
ee0eb6a
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Dec 3, 2021
7a9b357
audio rsp labelling
engineer124 Nov 3, 2021
899b2ab
Matching decoder
Dec 3, 2021
42c9152
Merge pull request #2 from zelda2774/audio-extract
MNGoldenEagle Dec 4, 2021
737dd8b
Save codec into AIFC file
MNGoldenEagle Dec 4, 2021
c0ee958
Merge branch 'audio-decomp' of github.com:MNGoldenEagle/oot into audi…
MNGoldenEagle Dec 4, 2021
db9c4a5
Link math library for aifc_decode
MNGoldenEagle Dec 5, 2021
df885e1
Removed dependency on Python 3.9, made aifc_decode recognize new comp…
MNGoldenEagle Dec 7, 2021
6f2cc9d
Renamed sound samples so order is preserved properly
MNGoldenEagle Dec 7, 2021
42bc495
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Dec 7, 2021
956951f
added ./tools/build_soundfonts.py
waffleoRai Dec 14, 2021
d5720fe
tried to start a common def file, bank build draft
waffleoRai Dec 15, 2021
28387f6
Added enum names and fixed some sample names
MNGoldenEagle Dec 16, 2021
c489f00
Added support for instrument enums on export
MNGoldenEagle Dec 16, 2021
e60f2fc
Preparing for unused data export; modified instruments, drums, and ef…
MNGoldenEagle Dec 16, 2021
e498eb0
Soundfonts and sample banks should now be matching
MNGoldenEagle Dec 17, 2021
1846ed8
still a mess, but bank building ready to test
waffleoRai Dec 17, 2021
fee6e89
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Dec 17, 2021
9597bf5
WOW those indents were f***ed
waffleoRai Dec 17, 2021
aac3525
bank building mostly debugged
waffleoRai Dec 22, 2021
9491fa5
Index samples programmatically instead of by XML
MNGoldenEagle Dec 25, 2021
bca2c09
Merge branch 'audio-decomp' of github.com:MNGoldenEagle/oot into audi…
MNGoldenEagle Dec 25, 2021
f574c5f
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Dec 30, 2021
5b53291
Fix bug in sound disassembly and integrate with Makefile
MNGoldenEagle Jan 1, 2022
ac7b834
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Jan 1, 2022
4154a00
Fixed arg bug and added another fixup
MNGoldenEagle Jan 1, 2022
bcfe58b
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Jan 1, 2022
ce7a85a
Removed code that I added when I was dumb
MNGoldenEagle Jan 1, 2022
e108716
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Jan 1, 2022
3df1189
audiotable match, bug fixes
waffleoRai Jan 1, 2022
ce849b6
Fixed gap detection bug
MNGoldenEagle Jan 2, 2022
e1e8627
font xml read operational
waffleoRai Jan 3, 2022
7cee642
Split out sfx by bank and updated to use includes
MNGoldenEagle Jan 5, 2022
66e12e9
Fixed soundfont sample bank link to use actual bank name
MNGoldenEagle Jan 5, 2022
037f95e
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Jan 6, 2022
8ffd25a
Updated sfx script to use symbols
MNGoldenEagle Jan 7, 2022
7bba067
Environment bank done
MNGoldenEagle Jan 7, 2022
d59342b
Updated env and enemy sfx banks with symbols
MNGoldenEagle Jan 10, 2022
5e97a9d
Use enums for notes, fonts, instruments, sfx, drums
MNGoldenEagle Jan 14, 2022
7e17057
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Jan 14, 2022
34ba4da
Renamed because Makefile SUCKS goddamn
MNGoldenEagle Jan 16, 2022
8253d7c
lots of bugs or something
waffleoRai Jan 16, 2022
244c5a7
Sequences OK
MNGoldenEagle Jan 17, 2022
d53c58f
Include sample list to help with matching
MNGoldenEagle Jan 17, 2022
0282269
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Jan 17, 2022
2d828bf
all fonts match, except that weird last one
waffleoRai Jan 17, 2022
fbd2a53
Updated to make medium less misleading
MNGoldenEagle Jan 18, 2022
b053e3d
Split code audio tables out to a separate file
MNGoldenEagle Jan 21, 2022
4de4c03
Updated table includes
MNGoldenEagle Jan 22, 2022
5b6cf9a
Added workaround for soundfonts that are broken in a very silly way
MNGoldenEagle Jan 22, 2022
331bd5d
Merge branch 'MNGoldenEagle:audio-decomp' into audio-decomp
waffleoRai Jan 22, 2022
1aa9871
all fonts match!
waffleoRai Jan 25, 2022
5b32537
handful of tweaks from PR
waffleoRai Feb 20, 2022
160f029
Merge pull request #3 from waffleoRai/audio-decomp
MNGoldenEagle Feb 21, 2022
7f1cd85
Build soundfonts and banks into ELF files
MNGoldenEagle Mar 6, 2022
641ed23
Work so far
MNGoldenEagle Mar 13, 2022
398692c
Added for testing purposes (drop later)
MNGoldenEagle Mar 13, 2022
34e2167
Some updates
MNGoldenEagle Mar 27, 2022
2d7034d
Disassemble/assemble work; fixed enums to more accurate names
MNGoldenEagle Apr 4, 2022
a654935
Added MML documentation
MNGoldenEagle Apr 12, 2022
de0d45d
Updated all the things, sequences build now!
MNGoldenEagle May 14, 2022
ddd3b3e
Merge branch 'master' of github.com:zeldaret/oot into audio-decomp
MNGoldenEagle May 15, 2022
7c7b4ce
Audio matching
MNGoldenEagle May 22, 2022
036ef7b
Cleaning up some stuff
MNGoldenEagle May 22, 2022
4b66bbe
More cleanup
MNGoldenEagle May 22, 2022
1755569
Removed all the unnecessary stuff
MNGoldenEagle May 22, 2022
7039c12
Renamed commands to instructions
MNGoldenEagle May 22, 2022
8aa0a55
Removed type hints in assemble_sequences
MNGoldenEagle May 22, 2022
5dad270
Fix linker error and warnings
MNGoldenEagle May 22, 2022
a67faa2
Updated Makefile to properly setup and clean assets
MNGoldenEagle May 22, 2022
76015d5
Minor fixups from code reviews
MNGoldenEagle May 22, 2022
59d84f5
Changed hex digits to match decomp style
MNGoldenEagle May 22, 2022
e97ba53
Changed hex representation to match decomp style
MNGoldenEagle May 22, 2022
89d8aa7
Code review updates
MNGoldenEagle May 23, 2022
3e298fa
Fixed old file reference
MNGoldenEagle May 23, 2022
070c00b
Some fixes and refactoring
MNGoldenEagle May 31, 2022
db04822
Switched to follow convention
MNGoldenEagle Jun 7, 2022
a65bc1d
Moved sequences into assets folder
MNGoldenEagle Jun 13, 2022
b0dc86a
Renamed sequences from mus to seq
MNGoldenEagle Jun 13, 2022
51502af
Rename soundfonts to not use spaces
MNGoldenEagle Jun 13, 2022
eba4e93
Fixing some nonmatching issues in the program sequences
MNGoldenEagle Jun 13, 2022
ca972ad
Fixed last few non-matching sequences, audio looks OK?
MNGoldenEagle Jun 20, 2022
0a5bbe1
Merge remote-tracking branch 'base/master' into audio-decomp
MNGoldenEagle Jun 20, 2022
fb5bcb9
Audio assets OK
MNGoldenEagle Jun 25, 2022
238e8cc
also build assemble_sequence
playerskel Jan 5, 2023
93765d7
whitespace stuff
playerskel Jan 5, 2023
ab26509
normalize sound asset filenames
playerskel Jan 6, 2023
7518cbb
unindent once
playerskel Jan 6, 2023
4522899
normalize some more filenames
playerskel Jan 6, 2023
005e736
keep original filename casing
playerskel Jan 6, 2023
598d380
.mus was renamed to .seq
playerskel Jan 6, 2023
7429cbb
assemble sound data the old school way
playerskel Jan 6, 2023
ff79db0
finalize sound building steps OK
playerskel Jan 6, 2023
b006ef5
make setup always unpacks aifc files
playerskel Jan 6, 2023
8b168dc
simplify sound building steps
playerskel Jan 6, 2023
14a9f05
bit of python cleanup
playerskel Jan 6, 2023
3c783b7
reconstruct audio tables to C code
playerskel Jan 9, 2023
1a91206
call assemble sequences/sound at setup time
playerskel Jan 30, 2023
ca4aa7e
ensure misc/sounds dir exists
playerskel Jan 30, 2023
7b948f4
simplify
playerskel Mar 21, 2023
09f00f7
do not use elfio to assemble sequences
playerskel Mar 29, 2023
6cf6534
emit sound-related tables to C files from python
playerskel Mar 30, 2023
e9721fb
get rid of makeelf for samplebanks and soundfonts
playerskel Mar 30, 2023
bd4289c
create hardcoded constants on-the-fly
playerskel Mar 30, 2023
4d38e63
rename docs .md without whitespaces
playerskel Mar 30, 2023
97180f8
apply suggested changes by @Dragorn421
playerskel Mar 30, 2023
7406e89
rename env to envelope by @engineer124
playerskel Mar 30, 2023
da99fe6
apply suggestions by @engineer124
playerskel Mar 30, 2023
6523549
Merge branch 'master' into audio-decomp
playerskel Mar 30, 2023
6cc6981
rename a few .mus remnants to .seq
playerskel Mar 31, 2023
04be4a1
do not use tempfiles where unnecessary @krm01
playerskel Mar 31, 2023
f27c429
move audio tooling to tools/audio @engineer124
playerskel Mar 31, 2023
4785de6
make sequence disassembly code more oop
playerskel Mar 31, 2023
daec562
speedup disassembly by importing instead of executing
playerskel Mar 31, 2023
4fbec73
some code tweaks
playerskel Apr 2, 2023
60216b3
less temp files and match warning thanks to @ariahiro64 research
playerskel Apr 2, 2023
e220867
some more improvements
playerskel Apr 2, 2023
3b2a60b
further simplify clearing bug replication
playerskel Apr 2, 2023
7899692
do not build sdk-tools as it needs libaudiofile-dev which is optional
playerskel Apr 2, 2023
2be7468
still print to stdout/stderr upon individual execution @ariahiro64
playerskel Apr 4, 2023
e83ea8b
allow aiff and aifc files to be written to different directories
playerskel Apr 9, 2023
5f3ecc7
add --quiet flag to assemble sound in make setup
playerskel Apr 9, 2023
6b08368
revert matching issue, small improvements
playerskel Apr 29, 2023
e481224
small improvements
playerskel Oct 19, 2023
a551bb3
Merge branch 'master' into audio-decomp
playerskel Nov 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ MKDMADATA := tools/mkdmadata
ELF2ROM := tools/elf2rom
ZAPD := tools/ZAPD/ZAPD.out
FADO := tools/fado/fado.elf
SEQ_ASM := tools/audio/assemble_sequence

ifeq ($(COMPILER),gcc)
OPTFLAGS := -Os -ffast-math -fno-unsafe-math-optimizations
Expand Down Expand Up @@ -158,7 +159,8 @@ else
SRC_DIRS := $(shell find src -type d)
endif

ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*" -not -path "assets/text")
ASSET_BIN_DIRS := $(shell find assets/code/* assets/misc/* assets/objects/* assets/overlays/* assets/scenes/* assets/textures/* assets/samplebanks -type d)
SAMPLES_DIR := $(shell find assets/samples/* -type d)
ASSET_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml))
ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin))
ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \
Expand All @@ -168,11 +170,18 @@ ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \
UNDECOMPILED_DATA_DIRS := $(shell find data -type d)

# source files
SEQ_FILES := $(foreach dir,$(SRC_DIRS) assets/sequences,$(wildcard $(dir)/*.seq))
FONT_FILES := $(foreach dir,assets/soundfonts,$(wildcard $(dir)/*.xml))
AIFC_FILES := $(foreach dir,$(SAMPLES_DIR),$(wildcard $(dir)/*.aifc))
INC_FILES := $(foreach f,$(SEQ_FILES:.seq=.inc),build/include/$f)
SEQ_OUT := $(foreach f,$(SEQ_FILES:.seq=.o),build/$f)
C_FILES := $(filter-out %.inc.c,$(foreach dir,$(SRC_DIRS) $(ASSET_BIN_DIRS),$(wildcard $(dir)/*.c)))
S_FILES := $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(wildcard $(dir)/*.s))
O_FILES := $(foreach f,$(S_FILES:.s=.o),build/$f) \
$(foreach f,$(C_FILES:.c=.o),build/$f) \
$(foreach f,$(wildcard baserom/*),build/$f.o)
$(foreach f,$(FONT_FILES:.xml=.o),build/$f) \
$(foreach f,$(wildcard baserom/*),build/$f.o) \
build/assets/misc/sounds/sounds.o

OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | grep -o '[^"]*_reloc.o' )

Expand All @@ -187,6 +196,7 @@ TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),build/$f) \
$(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),build/$f) \

# create build directories
$(shell mkdir -p build/baserom build/assets/text build/assets/data assets/sequences assets/soundfonts assets/samples)
$(shell mkdir -p build/baserom build/assets/text $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS) $(ASSET_BIN_DIRS),build/$(dir)))

ifeq ($(COMPILER),ido)
Expand Down Expand Up @@ -255,6 +265,9 @@ clean:

assetclean:
$(RM) -r $(ASSET_BIN_DIRS)
$(RM) -r assets/soundfonts
$(RM) $(shell find assets/sequences/*.seq -not -path "*.prg.seq")
$(RM) -r assets/samples/
$(RM) -r assets/text/*.h
$(RM) -r build/assets
$(RM) -r .extracted-assets.json
Expand All @@ -268,6 +281,10 @@ setup:
python3 fixbaserom.py
python3 extract_baserom.py
python3 extract_assets.py -j$(N_THREADS)
python3 tools/audio/disassemble_sound.py MQDebug baserom/code baserom/Audiotable baserom/Audiobank assets/xml assets/samples assets/samples assets/soundfonts build/include
python3 tools/audio/disassemble_sequences.py MQDebug baserom/code baserom/Audioseq assets/xml/sequences/Sequences.xml build/include include/sequence.inc assets/sequences
python3 tools/audio/assemble_sequences.py assets/sequences build/include build
python3 tools/audio/assemble_sound.py assets/soundfonts build/assets build/include assets/samples --build-bank --match=ocarina -q

run: $(ROM)
ifeq ($(EMULATOR),)
Expand All @@ -283,7 +300,7 @@ endif
$(ROM): $(ELF)
$(ELF2ROM) -cic 6105 $< $@

$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) build/ldscript.txt build/undefined_syms.txt
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(SEQ_OUT) $(OVL_RELOC_FILES) build/ldscript.txt build/undefined_syms.txt
$(LD) -T build/undefined_syms.txt -T build/ldscript.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map build/z64.map -o $@

## Order-only prerequisites
Expand Down Expand Up @@ -369,6 +386,22 @@ build/src/overlays/%_reloc.o: build/$(SPEC)
$(FADO) $$(tools/reloc_prereq $< $(notdir $*)) -n $(notdir $*) -o $(@:.o=.s) -M $(@:.o=.d)
$(AS) $(ASFLAGS) $(@:.o=.s) -o $@

build/%.o: %.seq
$(SEQ_ASM) $< $@ --font-path build/include

build/assets/sequences/%.o: build/assets/sequences/%.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
@$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s)

build/assets/misc/sounds/sounds.o: data/sounds.c assets/misc/sounds/*.h
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
@$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s)

build/src/code/audio_init_params.o: src/code/audio_init_params.c assets/misc/sounds/*.h

build/include/%.inc: $(FONT_FILES)
python3 tools/audio/assemble_font_includes.py assets/soundfonts build/include

build/%.inc.c: %.png
$(ZAPD) btex -eh -tt $(subst .,,$(suffix $*)) -i $< -o $@

Expand Down
22 changes: 21 additions & 1 deletion assets/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
# Raw binary files included with assets
*.bin
# C code representing asset data
*.c
# But not for text code
!text/*.c
# Headers representing asset data
*.h
*.cfg
# Vertex arrays
*.vtx.inc
# Display lists
*.dlist.inc
# Binary representation of a music sequence
*.aseq
# Music sequence
*.seq
# Uncompressed audio
*.aiff
# Compressed audio
*.aifc

# XML indicating sequences that are purely references to other sequences
/sequences/References.xml
# Soundfont XMLs
/soundfonts/*.xml
# Sample Bank Descriptor XML
/samples/Banks.xml
Loading