Converting audio with audioconv64

Now that we have our audio files ready and before we start writing any code, we need to convert our files into the correct format. Libdragon can work with three file formats:

  • WAV – Standard uncompressed audio file
  • XM – Extended module Fastracker format (MIDI-like audio)
  • YM – Atari ST audio format (used for chiptune tracks)

These then need to be converted to N64-compatible formats – .wav64, .xm64 and .ym64 respectively.

To do this, we use the audioconv64 tool included in Libdragon. It can be found at /libdragon/tools/audioconv64 within your project folder. This one is much easier to work with than mksprite since it doesn’t require non-standard libraries.

I’ll include an exe download in case you have trouble compiling. I had a bit of trouble compiling since it threw a bunch of “unknown conversion type character” errors, but those are gone once you remove warnings from the makefile.

Once you have the executable, place it in your PATH folder (for me it’s c:\libdragon) and run it by calling the executable with audioconv64. Here are the options it has (from the help file):

   audioconv64 [flags] <file-or-dir> [[flags] <file-or-dir>..]

Supported conversions:
   * WAV => WAV64 (Waveforms)
   * XM  => XM64  (MilkyTracker, OpenMPT)
   * YM  => YM64  (Arkos Tracker II)

Global options:
   -o / --output <dir>       Specify output directory
   -v / --verbose            Verbose mode

WAV options:
   --wav-loop <true|false>   Activate playback loop by default
   --wav-loop-offset <N>     Set looping offset (in samples; default: 0)

YM options:
   --ym-compress <true|false>  Compress output file

Automating audio file conversion

You can add this executable to your Makefile process to make it a lot more streamlined. Here are some additions to the Makefile that can make the processing automatic. This is the file structure:


And this it the Makefile that converts audio files to the correct format and moves them to the filesystem directory:

WAV_FILES=$(wildcard $(AUDIO_DIR)/*.wav)
XM_FILES=$(wildcard $(AUDIO_DIR)/*.xm)
YM_FILES=$(wildcard $(AUDIO_DIR)/*.ym)
AUDIO_OUTPUT_FILES=$(subst resources/audio,filesystem,$(WAV_FILES:.wav=.wav64) $(XM_FILES:.xm=.xm64) $(YM_FILES:.ym=.ym64))

include $(N64_INST)/include/

all: hello.z64
.PHONY: all

OBJS = $(BUILD_DIR)/main.o

hello.z64: N64_ROM_TITLE="Hello World"

	@echo "Processing file" $(notdir $@)
	@# Generate and place the converted file in the root directory
	audioconv64 $(AUDIO_DIR)/$(subst .ym64,.ym,$(subst .xm64,.xm,$(subst .wav64,.wav,$(notdir $@))))
	@# Move it to the output directory
	mv $(notdir $@) $@


$(BUILD_DIR)/hello.elf: $(OBJS)

	rm -f $(BUILD_DIR)/* *.z64
.PHONY: clean

-include $(wildcard $(BUILD_DIR)/*.d)

Compiling alongside your game

A simpler way to having to deal with PATH variables is to include the compilation of audioconv in your project’s makefile.

# Declare the tools location

# Compile the required tools
	cd $(TOOLS_DIR)/audioconv64 && make

# Sample audio processor, remember to include $(TOOLS_AUDIOCONV) as a dependency
	@echo "	[AUDIOCONV64] " $@
	$(TOOLS_AUDIOCONV) --wav-loop true $(AUDIO_DIR)/$(subst .wav64,.wav,$(notdir $@))
	mv $(notdir $@) $@

Loading audio files from the filesystem

There’s a whole page on the DFS that explains this in more detail. Audio files are treated the same as image files in this regard.


Subscribe to the mailing list

Follow N64 Squid

  • RSS Feed
  • YouTube

Random featured posts