Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
Compress sound effect to save space.
Browse files Browse the repository at this point in the history
  • Loading branch information
laqieer committed Jul 7, 2022
1 parent 79a5c7d commit af0fdd8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions res/se/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
VOICE = ../voice

ifeq ($(shell uname -s),Darwin)
# for Mac
CKB2WAV = cktool extract
else
# for WSL
CKB2WAV = $(VOICE)/CKBtoWav.exe
endif

SAMPLE_RATE = 21024

lib = lib/libse.a
header = include/se.h

Expand All @@ -7,14 +19,17 @@ ckbs = $(wildcard *.ckb)
objects = $(ckbs:.ckb=.o)

$(lib): $(objects)
arm-none-eabi-ar r $@ $?
$(DEVKITARM)/bin/arm-none-eabi-ar r $@ $?

$(objects): %.o: %.ckb
cktool extract $<
sox $*_$*_extracted.wav -r 21024 -b 8 -c 1 $*.wav
$(CKB2WAV) $<
ifneq ($(shell uname -s),Darwin)
mv $*.wav $*_$*_extracted.wav
endif
sox $*_$*_extracted.wav -r $(SAMPLE_RATE) -b 8 -c 1 $*.wav
rm $*_$*_extracted.wav
../voice/se2m4a/se2m4a.py $*.wav $*.s
arm-none-eabi-as -mcpu=arm7tdmi -I ../voice/se2m4a $*.s -o $@
$(VOICE)/se2m4a/se2m4a.py $*.wav $*.s -c
$(DEVKITARM)/bin/arm-none-eabi-as -mcpu=arm7tdmi -I $(VOICE)/se2m4a $*.s -o $@

$(header): $(lib)
@echo $(foreach ckb, $(ckbs), "extern const struct Song $(subst .ckb,;,$(ckb))\n") > $@
Expand Down
Binary file modified res/se/lib/libse.a
Binary file not shown.

0 comments on commit af0fdd8

Please sign in to comment.