A real-time software-based audio synthesis engine written in C++.
Designed to emulate the sonic character of retro hardware such as the NES, Game Boy, and Sega Genesis, while also supporting generic 8-bit waveform modes (Classic, Square, Smooth).
The engine focuses on performance, low-level DSP accuracy, and portability.
This project is a C++ chiptune synthesis engine that generates audio in real time using mathematical waveform generation.
It supports both hardware-inspired profiles (NES, Game Boy, Genesis) and generic modes like Square and Smooth.
The engine is built with a modular architecture powered by CMake, ensuring efficient performance and portability across platforms.
Chiptune music originates from the real-time waveform generators of vintage consoles and computers.
Unlike sampled audio, chiptune relies on mathematically generated waveforms, filters, and modulation techniques.
This project implements:
- Multi-style synthesis (NES, Game Boy, Sega Genesis, Square, Classic, Smooth)
- Waveform generation from DSP math
- Low-latency playback via audio callbacks
- A lightweight and portable architecture, written in modern C++
The entire system avoids heavy game engines to stay close to the hardware for accuracy and speed.
Handles:
- Application initialization
- Parsing user input (e.g.
genesis) - Mapping to an internal
ChiptuneStyleenum - Selecting correct synthesis algorithms
Supported style keywords:
classic, nintendo, gameboy, genesis, square, smooth
Core DSP engine responsible for:
- Generating Square, Triangle, Saw, and Noise waves
- Emulating hardware behaviors like:
- NES duty cycles (Ricoh 2A03-like behavior)
- Game Boy stereo channel quirks
- Genesis FM-inspired harmonics
Also includes pure waveform modes (Square, Smooth) that produce mathematically clean output.
Provides real-time playback by:
- Responding to audio hardware requests
- Filling buffers with synthesized samples
- Ensuring glitchless, low-latency output
- Mixing channels and applying envelopes
This is the heartbeat of the entire engine.
- C++ compiler (C++11 or later)
- CMake
- Platform-specific audio backend
git clone https://github.com/Ravish-Ranjan/chiptune
cd chiptune
mkdir build && cd build
cmake ..
makeRun:
./chiptune <audio-file-path> <style?>| Style | Mode | Description |
|---|---|---|
| classic | CLASSIC | Arcade-style 8-bit tone |
| nintendo | NINTENDO | NES pulse waves + duty cycles |
| gameboy | GAMEBOY | Stereo wave-channel emulation |
| genesis | GENESIS | FM-inspired Sega Genesis tone |
| square | SQUARE | Pure, raw square wave |
| smooth | SMOOTH | Filtered, cleaner chiptune output |
Default output mode: smooth
Running the application produces real-time synthesized chiptune audio.
The selected style determines oscillator behavior, mixing rules, and overall timbre, giving users full control over retro sound emulation.
- CMake Documentation – https://cmake.org/documentation/