SampleGenerator is a cross-language toolchain for generating lightweight audio samples (WAV and MIDI) suitable for use with the SNES SPC700 sound processor. It automates the creation, validation, and playback of simple musical notes and waveforms, making it easier to produce and test samples for retro game development or hardware emulation.
The main goal of SampleGenerator is to generate minimalistic audio samples (MIDI and WAV) that are compatible with the technical constraints of the SNES SPC700 processor. This includes:
- Low sample rate (800 Hz)
- 8-bit unsigned PCM WAV files
- Simple waveforms (square, triangle, sine)
- Single-note MIDI files for conversion
This toolchain helps composers, developers, and enthusiasts quickly create and validate samples for SNES music and sound effects.
- Automatic MIDI note generation (Python)
- Conversion of MIDI notes to WAV files (Julia)
- Custom RIFF header construction for WAV files
- Waveform synthesis: square, triangle, sine
- Validation of WAV files for SPC700 compatibility
- Playback of generated samples for quick testing
- Cross-language build and test automation via Makefile
SampleGenerator/
├── midi-samples/ # Generated MIDI files
├── wave-samples/ # Generated WAV files
├── src/
│ ├── generateNote/ # Python MIDI generator
│ └── generateWave/ # Julia WAV generator
├── tests/
│ ├── checkWAVE/ # Julia WAV validator
│ ├── playWAVE/ # Julia WAV player
│ └── playMIDI/ # Python MIDI player
├── Makefile # Main build/run/test automation
├── Makefile.build # Build rules
├── Makefile.clean # Clean rules
├── Makefile.tests # Test rules
└── README.md # This fileBefore running the project, install the following tools:
- Python 3.12+
- Julia 1.11+
- GNU Make
- Timidity (optional, for MIDI playback: timidity GitHub)
-
Install prerequisites:
On Debian/Ubuntu:
sudo apt update sudo apt install python3 python3-venv julia make # Optional for MIDI playback sudo apt install timidityOn RedHat/Fedora:
sudo dnf install python3 python3-virtualenv julia make # Optional for MIDI playback sudo dnf install timidityOn Arch/Manjaro:
sudo pacman -S python julia make python-virtualenv # Optional for MIDI playback sudo pacman -S timidity++On Alpine Linux:
sudo apk update sudo apk add python3 py3-virtualenv julia make # Optional for MIDI playback sudo apk add timidityOn Mandriva:
sudo urpmi python3 python3-virtualenv julia make # Optional for MIDI playback sudo urpmi timidityOr download Timidity from the official repository.
-
Clone the repository:
git clone https://github.com/BrunoRNS/SampleGenerator.git cd SampleGenerator -
Install all dependencies and set up environments:
make all
This will automatically download and install all required Python and Julia packages for you.
You can find the generated samples in the wave-samples/ and midi-samples/ directories, if you want to use any of them you can just copy them to your workspace 😃
Run the full pipeline (build environments, clean old samples, generate new ones):
make runThis will:
- Build Python and Julia environments
- Clean previous samples
- Generate MIDI notes (Python)
- Convert MIDI notes to WAV files (Julia)
- Output samples to
midi-samples/andwave-samples/
Run all tests (play and validate samples):
make test- Check WAV properties: Ensures WAV files are 8-bit unsigned, 800 Hz, RIFF format
- Play WAV files: Listen to generated samples (Julia)
- Play MIDI files: Listen to generated MIDI notes (Python)
Remove all generated environments and sample files:
make cleanThe generated WAV files are designed to be as lightweight as possible for use with SNES tools and SPC700 sample conversion utilities and also in Impulse Tracker. You can use these files directly with SNES music engines or further process them for your workflow.
This project is licensed under the GNU GPL v3.
Made with ❤️ by BrunoRNS.