YM2149‑RS
Cycle‑accurate Yamaha YM2149 PSG (Atari ST) emulator in Rust, with optional YM file replay, real‑time streaming, and an experimental softsynth.
Highlights
- Integer‑accurate YM2149 core (envelope, LFSR noise, mixer, color filter)
- YM file replay: YM2 (Mad Max), YM3/YM3b, YM4, YM5, YM6
- VBL‑synced replayer with YM5/YM6 effects (SID, Sync Buzzer)
- Optional real‑time streaming (rodio) and experimental softsynth
- Modular features: enable only what you need
YM File Replay
This crate can replay YM files (YM2–YM6) through a simple frame‑based replayer. You can render to a buffer or stream in real‑time. Effects encoded in YM5/YM6 are supported; YM2 Mad Max digi‑drums are handled as well.
Minimal example:
use ;
Real‑Time Streaming (replayer + streaming)
use ;
use ;
Quick Start
Add to your Cargo.toml (enable only what you need):
[]
= { = "0.1", = ["emulator", "ym-format", "replayer", "streaming"] }
# add `"softsynth"` if you want the experimental synth engine
Core chip (generate samples)
use Ym2149;
let mut chip = new;
chip.write_register; // A freq lo
chip.write_register; // A freq hi
chip.write_register; // A amp
chip.clock;
let sample = chip.get_sample;
Streaming (feature: streaming)
use ;
let cfg = low_latency;
let player = new?;
let _dev = new?;
// write samples into player.write_blocking(&samples)
CLI Player
The repository ships a ym2149 CLI that performs real-time playback with terminal visualization. The binary is only built when the streaming feature is enabled:
To experiment with the experimental softsynth backend, add the softsynth feature and select it via the --chip flag:
Features
emulator(default): core YM2149 chipym-format(default): YM file parsing/loaderreplayer(default): frame player + effectsstreaming: rodio-powered audio output (opt-in)softsynth: experimental synth engine (opt-in)visualization(default): terminal visualization helpers
License
MIT — see LICENSE.