YunoSynth
YunoSynth is a high-performance VGM playback library written entirely in the Crystal programming language. The goal is to provide native VGM playback in Crystal without bindings and almost no dependencies, a cleaned-up version of VGMPlay's code, and performance on par with VGMPlay.
An example of a program that uses YunoSynth is Benben, a full-featured command line VGM player and VGM->WAV converter by the same author.
Wanna support me? Buy me a coffee on Ko-Fi, or support me through Liberapay.
Example videos
These were recorded using Benben.
- Arcade - After Burner II - "After Burner (Melody Version)"
- Neo Geo - Metal Slug X - "Judgement -X-"
- X68000 - Granada - "Advance 'GRANADA' (Opening Theme)"
- PC-98 - Rusty - "Queen in The Night"
- PC Engine/TurboGrafx-16 - Soldier Blade - "Operation 1"
Features
- Rendering of VGM files to PCM.
- High quality resampling.
- Compressed (gzip) VGM loading, as well as a mechanism to extend this with additional compression methods.
- Full GD3 tag support.
- DAC support.
Implemented Chips
More chips will be added as time goes on.
- Capcom DL-1425 QSound
- General Instruments AY-1-8910 and similar
- Hudson HuC6280 (two different cores)
- Irem GA20
- Konami K051649
- Konami K054539
- Konami K053260
- Namco C140 / Namco 219 ASIC
- Namco C352
- NEC uPD7759
- Nintendo GameBoy
- OKI MSM6258
- OKI MSM6295
- Sega SegaPCM
- Sega MultiPCM
- Yamaha YM2151
- Yamaha YM2203
- Yamaha YM2608
- Yamaha YMZ280B
- Yamaha YM2610/YM2610B
Known Issues
- There are two YM2151 cores available: MAME and Nuked-OPM. However, Nuked-OPM does not yet work.
- This is still somewhat early in development.
Usage
Add this to your shard.yml
:
dependencies:
yunosynth:
fossil: https://chiselapp.com/user/MistressRemilia/repository/yunosynth
You will need Fossil installed to clone this repo and the dependency. You will also need Shards v0.17.1 or later. If you have an earlier version of Shards, you will need to to build the latest version manually.
Example Programs
To compile these example programs, first do a shards update
in the repository
root. Then you can compile debug builds of them using rake
. Run rake examples[list]
to see some optimization options.
examples/vgminfo.cr
: Prints GD3 tag information and some basic info about a VGM file.examples/pulse-player.cr
: A basic VGM/VGZ player using PulseAudio for the backend. Run it without any arguments to see its usage.
Development
Development Milestones are listed in the wiki.
If you want to add a new chip, please make sure to read Adding Chips for notes and hints.
Compile-time Flags
YunoSynth supports a few compile-time defines, which can be used by passing the
-D
option to the compiler (for example, -Dyunosynth_debug
).
yunosynth_debug
: Print various debug information to the console.yunosynth_wd40
: Enable various micro-optimizations that may possibly do unsafe things in exchange for some small speed boosts.
Style info
I use a somewhat non-standard style for my code.
- Keep lines 118 characters or shorter. Obviously sometimes you can't, but please try your best. Use 80 or 115 characters for Markdown files, though.
- Please use
pascalCase
for variable and method names,CamelCase
for type names, andUPPER_SNAKE_CASE
for constants. - Put parentheses around method parameters, except for these methods:
puts
,pp
,p
,raise
,sleep
,spawn
,loop
, andexit
. - Always the full
do |foo|...end
syntax with blocks, except when it's all on one line or an anonymous function, then use either { and } or the normaldo |foo|...end
. - The type name for exceptions end with
Error
. For example,ExternalProgramError
. - Add type information everywhere you can.
How do I contribute?
- Go to https://chiselapp.com/user/MistressRemilia/repository/yunosynth and clone the Fossil repository.
- Create a new branch for your feature.
- Push locally to the new branch.
- Create a bundle with Fossil that contains your changes.
- Get in contact with me.
Contributors
- Remilia Scarlet - creator and maintainer
- Homepage: https://remilia.sdf.org/
- Mastodon: @MistressRemilia@social.sdf.org
- Email: zremiliaz@postzeoz.jpz My real address does not contain Z's
Links and Licenses
YunoSynth itself is under the GNU Affero General Public License version 3.
The emulation cores, which were all ported by hand to Crystal, have various other licenses, which can be found in the licenses folder in this repository. Most of them are from the MAME project.
Much of the playback code is based on heavily modified code from VGMPlay by Valley Bell, et al.