Super Nintendo Release Guide
Converting MIDI files into a playable music SNES (Super Nintendo Entertainment System) cartridge involves several steps, including preparing your MIDI files, converting them into a format compatible with the SNES’s sound hardware, assembling an SNES ROM, and finally flashing the ROM onto a physical cartridge. Below is a detailed, step-by-step guide to help you through the process.
Prerequisites
Before you begin, ensure you have the following:
- A MIDI file that you wish to convert.
- A computer capable of running the necessary software (Windows, macOS, or Linux).
- Basic knowledge of command-line operations and programming concepts.
- SNES Development Tools: Such as WLA-DX assembler, SNES SDK, or cc65 for assembling code.
- SNES Sound Tools: SNESGSS, AddmusicK, or XMSNES for audio creation.
- Hardware: A programmable SNES cartridge (e.g., SD2SNES/FXPak Pro, Super EverDrive) and an SNES console for testing.
Step 1: Prepare Your MIDI File
1. Simplify the MIDI File
The SNES has a powerful but limited audio subsystem known as the SPC700:
- 8 Audio Channels: Each capable of playing sampled sounds.
- Sample-Based Playback: Uses audio samples rather than synthesized waveforms.
- Memory Limitations: Only 64 KB of audio RAM for all samples and sequence data.
Use a MIDI editor to tailor your MIDI file for the SNES:
- Limit the number of simultaneous instruments to 8 channels.
- Consider the size of samples to fit within the 64 KB limit.
- Adjust tempos and instrument assignments to suit SNES capabilities.
Recommended MIDI Editors:
- Anvil Studio (Windows)
- MuseScore (Windows, macOS, Linux)
- LMMS (Windows, macOS, Linux)
You have several options for SNES music creation tools:
- SNESGSS: A sound driver and composition tool for SNES music.
- AddmusicK: Primarily used for Super Mario World ROM hacks.
- XMSNES: A tool to convert XM modules to SNES format.
For this guide, we’ll use SNESGSS.
1. Download SNESGSS
2. Install SNESGSS
- Extract the downloaded files to a directory on your computer.
- Run the SNESGSS executable to ensure it works correctly.
Step 3: Import and Edit MIDI in SNESGSS
1. Convert MIDI to MML Format
SNESGSS uses Music Macro Language (MML), so you’ll need to convert your MIDI file.
- Use Midi2MML or Tinymml tools to convert MIDI files to MML.
Steps to Convert MIDI to MML:
-
Download Midi2MML:
-
Convert MIDI to MML:
midi2mml your_song.mid -o your_song.mml
2. Import MML into SNESGSS
3. Edit the Song
- Assign instruments to each channel.
- Adjust volume levels, panning, and effects.
- Ensure that the total sample and sequence data fit within the 64 KB SPC700 memory limit.
4. Test the Music
- Use SNESGSS’s playback feature to listen to your track.
- Make adjustments as necessary to improve sound quality and compatibility.
Step 4: Export the Music Data
1. Export from SNESGSS
2. Output Files
- SPC File: For testing in SPC players or emulators.
- ASM Files: Assembly files containing your music data and driver.
Step 5: Set Up SNES Development Environment
1. Install WLA-DX Assembler
2. Create Project Directories
- Create a new directory for your SNES project.
- Inside, create subdirectories like
src
for source code and music
for music data.
Step 6: Integrate Music Data into SNES ROM
1. Copy Music Files
- Place the exported ASM files from SNESGSS into your
music
directory.
2. Write the Main Assembly Code
Create a file named main.asm
in your src
directory with the following content:
; Main SNES Program
.include "wla.inc"
; Bank 0 (0x00:8000 - 0x00:FFFF)
.bank 0 slot 0
.org $8000
Start:
sei ; Disable interrupts
clc ; Clear carry flag
xce ; Ensure native mode
jsr InitializeSNES
; Initialize SPC700 and upload music data
jsr InitializeSPC700
MainLoop:
; Your main game loop here
jmp MainLoop
; Initialize SNES hardware
InitializeSNES:
; Set up SNES registers, video mode, etc.
rts
; Initialize SPC700
InitializeSPC700:
; Include the SPC700 upload routine
; Upload the music driver and data
; Start music playback
rts
; Vectors
.org $FFFC
.dw Start ; Reset vector
.dw 0 ; COP vector
.dw 0 ; BRK vector
3. Include Music Driver and Data
-
In your main.asm
, include the music driver and data:
; Include music driver and data
.include "../music/music_driver.asm"
.include "../music/music_data.asm"
-
Ensure the paths to the ASM files are correct.
Step 7: Compile the SNES ROM
1. Create a Build Script or Makefile
- Create a
build.bat
(for Windows) or build.sh
(for macOS/Linux).
- Use WLA-DX commands to assemble your code.
Sample Build Script (build.sh):
#!/bin/bash
# Assemble main code
wla-65816 -o main.obj src/main.asm
# Link the object files into a ROM
wlalink -vr linkfile main.sfc
2. Create a Linker File (linkfile
):
[objects]
main.obj
[output]
main.sfc
3. Run the Build Script
- Open a terminal in your project directory.
-
Run:
chmod +x build.sh
./build.sh
- This should produce
main.sfc
, your SNES ROM file.
4. Troubleshooting
- If errors occur, check your assembly code and included files.
- Ensure all paths and filenames are correct.
- Verify that WLA-DX is correctly installed and accessible.
Step 8: Test the ROM in an Emulator
1. Choose an Emulator
2. Load and Test the ROM
- Open the emulator and load
main.sfc
.
- Verify that the music plays and the ROM functions correctly.
- Use debugging tools if the emulator provides them.
Step 9: Flash the ROM onto an SNES Cartridge
1. Obtain a Flash Cartridge
- SD2SNES/FXPak Pro: Supports virtually all SNES games and features.
- Super EverDrive: A more affordable option with good compatibility.
2. Prepare the ROM
- Ensure your ROM is compatible with the flash cartridge.
- Some flash carts require the ROM to have a specific header or format.
3. Transfer the ROM
- Copy
main.sfc
to the SD card used by your flash cartridge.
- Insert the SD card into the cartridge.
Step 10: Play the Cartridge on an SNES Console
1. Insert the Cartridge
- Place the flash cartridge into your SNES console.
2. Load and Test the ROM
- Power on the SNES.
- Use the flash cartridge’s menu to select your ROM.
- Confirm that the music plays as intended on actual hardware.
Additional Tips
- SPC700 Programming: The SNES sound processor (SPC700) operates independently from the main CPU. Understanding how to upload code and communicate with it is essential.
- Use Existing Drivers: Writing your own sound driver is complex. Use the driver provided by SNESGSS or other community-developed drivers.
- Optimize Sample Sizes: With only 64 KB of memory for all sound data, optimizing sample sizes is crucial for fitting all your audio into the SPC700.
-
Alternative Tools:
- AddmusicK: If you’re working specifically with Super Mario World hacks.
- XMSNES: Convert FastTracker XM modules to SNES format.
- OpenMPT: Compose in a familiar tracker environment and convert.
-
Community Resources:
- Legal Considerations: Ensure you have the rights to use and distribute any music you convert, especially if the MIDI files are of commercial songs.
Summary
By following these steps, you can successfully convert MIDI files into a playable music SNES cartridge:
- Prepare and simplify your MIDI file to match the SNES’s capabilities.
- Convert the MIDI to MML format and import it into SNESGSS.
- Edit and optimize your music within SNESGSS, ensuring it fits within memory constraints.
- Export the music driver and data from SNESGSS.
- Set up your SNES development environment using tools like WLA-DX.
- Integrate the music data into your SNES ROM by including the driver and data in your assembly code.
- Assemble your ROM using an assembler like WLA-DX.
- Test your ROM in an emulator to verify functionality.
- Flash the ROM onto a physical cartridge using hardware like the SD2SNES/FXPak Pro.
- Play the cartridge on an actual SNES console to enjoy your custom music.
This process not only allows you to experience custom music on original hardware but also provides valuable insight into retro console development.
Disclaimer: Working with SNES hardware and software development involves a learning curve and attention to detail. Always back up your work and proceed with caution when using or flashing hardware. Additionally, respect intellectual property laws when using or distributing music.