Tetorica FM2612 (hello_ymfm_wasm)
Small browser-side demos, documentation, and reusable code for YM2612, ymfm, WebAssembly, and VGM playback.
Goals
This repository has four goals:
- To understand the YM2612 chip.
- To create documentation that helps anyone understand the YM2612 chip.
- To create documentation that helps anyone embed YM2612 audio in a browser app or game.
- To preserve older game music and sound chip technology as cultural heritage that people today can read, investigate, learn from, and reconstruct—not only archive and play back.
This repository also provides YM2612 WebAssembly modules and JavaScript interfaces for browser-side use.
Repository: https://github.com/kyorohiro/hello_ymfm_wasm
These demos use ymfm by Aaron Giles under the BSD 3-Clause License.
Tetorica Tools (Genesis / Mega Drive)
Tetorica Tools (Experimental: PC-98, Neo Geo)
Experimental OPN-family FM modes and a MIDI live coding app for macOS. Genesis / Mega Drive support remains the project's primary goal.
Introduction
Demos
ex03_beep.cpp.
Sega PSG Demo
Play a minimal Sega PSG / SN76489-compatible tone through WebAssembly.
YM2612 VGM Parser and Playback Demo
Load a VGM file, inspect the header, preview parsed YM2612-oriented commands, and play it through WebAssembly.
1 Operator Demo
Change one audible operator first: MULTI, TL, AR, RR, and pitch.
2 Operator Demo
Compare parallel and serial relationships, then add feedback to operator 1.
Sega Genesis / Mega Drive YM2612 FM Introduction with JavaScript
The YM2612 is the FM sound chip used in the Sega Mega Drive / Genesis. This repository focuses on learning the chip, understanding how ymfm exposes it, and replaying it in the browser.
Start here if you want pin notes, beep-oriented register notes, or VGM basics in browser-readable pages.
Embed YM2612 WASM in Web Apps and Games
This repository provides browser-side YM2612 and Sega PSG WASM files, JavaScript wrappers, a YM2612 synth layer, VGM playback support, a Genesis audio engine, and AudioWorklet-based output paths for Web sites, Web apps, and browser games.
Start here if you want to understand the runtime and embed YM2612 sound into a browser app or game.
Available Files
The browser-side implementation is split into small layers so that each part can also be used independently.
Releases: https://github.com/kyorohiro/hello_ymfm_wasm/releases
GitHub Releases is the primary download entry point for packaged wasm and browser-side runtime files.
web_runtime is this embeddable runtime, source file by source file
(the files listed below).
web_runtime_exsample is a runnable embedding sample bundle
(the same runtime plus a few HTML demo pages) for a quick look at it working.
-
generated/ym2612_wasm.js/generated/ym2612_wasm.wasm— Emscripten-generated YM2612 / ymfm WebAssembly module. -
generated/segapsg_wasm.js/generated/segapsg_wasm.wasm— Emscripten-generated Sega PSG WebAssembly module. -
js/ym2612.js— Low-level JavaScript wrapper around the YM2612 WASM module. -
js/segapsg.js— Low-level JavaScript wrapper around the Sega PSG WASM module. -
js/ym2612synth.js— Small synth API for controlling YM2612 channels, operators, algorithms, notes, and register writes. -
js/ym2612vgm.js— YM2612-specific helpers used by the VGM playback path. -
js/vgmplayer.js— VGM parser and playback control layer. -
js/genesisaudioengine.js— Genesis audio runtime combining YM2612 and Sega PSG playback. -
js/ym2612-worklet.js— AudioWorklet processor that runs the YM2612 WASM synthesizer on the audio rendering thread. -
js/megasynth.js— MegaDriveSynth: a batteries-included wrapper combining YM2612Synth, the FX chain, the looper, and recording behind one AudioWorklet-backed API. -
js/megasynth_fx.js— Browser-side FX chain (gain, EQ, filter, delay, reverb) for use with MegaDriveSynth or standalone. -
js/megasynth_recording.js— Records and replays MegaDriveSynth commands as JSON for the event-record and looper features. -
js/looper.js— Lightweight musical-event looper for MegaSynth / YM2612 browser usage. -
js/megadrive-fm-presets.js— Ready-made YM2612 FM instrument presets. -
js/tfi.js— TFI (OPN2 patch) import/export helpers for YM2612Synth presets. -
js/vgi.js— VGI (VGM Maker) import/export helpers for YM2612Synth presets.
Examples and Documentation
YM2612Synth TFI / VGI import demo →
References
ymfm, libymfm.wasm, MAME, retropc.net, YM2612 pin reference, VGMPF YM2612, SpritesMind thread, chipmusic YM2612, DefleMask, GENajam, megatoy, Maple's Garden article, Aidan Lawrence's Sega Genesis video game music player, Zophar's Domain Genesis Music, SMS Power