Snes-apu - A Super Nintendo audio unit emulator


Hey all, just wanted to share a project I’ve been working on that’s finally ready for some use :smile:

You can read more in the github site, but basically it’s a highly accurate emulator of the audio portion of the Super Nintendo.

It’s only runnable on OSX for the moment, but other bootstrapping/drivers are coming soon; the code itself is platform-agnostic and sandboxed.

Interestingly, I had originally written the same code in C++ some time ago, and this was sort of a “pilot” in porting all of this kind of code I still have to Rust. I must say I’m quite pleased; the resulting code is much smaller due in no small part to lack of headers/ceremony, it’s much clearer and more explicit, and because of Cargo it’s much easier to distribute and build on multiple platforms. I’ll be continuing to develop many more projects like this, including porting a music authoring tool that’s been in the works for some time for SNES :smile:

Lots of bugs/small things are documented in the Github issues already, but feel free to report more if you decide to play with it.

Have a great day :smiley:


Quick project update: just about all of the known remaining emulation bugs have been fixed; only one major one remains. After that’s fixed, Windows support will be added immediately, followed by some documentation and Linux support as well.

Apart from that, I’ve also started working on a graphical debugger utility to help me squash the remaining bug(s), and also to help flesh out some nice debugging add-ons, such as buffered single-voice output, mute/solo, etc. This utility also doubles as a nice and simple test for building cross-platform UI’s with Qt on top of Rust projects. In particular, this utility exposes a C API to take snapshots of the currently-running emulator instance, and display things like RAM contents, voice outputs, mute/solo states for the voices, etc, and I must say, it’s pretty nice. Especially being able to handle all of the multithreading involved in Rust (locking the context and extracting snapshots) and being able to hand out Arc'd objects that can then be wrapped [mostly] safely again in C++ objects with RAII with very little code is fantastic. The peace of mind alone is invaluable :smiley:

Here’s what it looks like so far. Still pretty far from complete, but I really wanted to share!

On the left is the RAM viewer; blue is the byte value at each location (256x256 for the full 64k of RAM the unit has), and red is how recently it was written to, calculated by comparing snapshots which are taken every 20ms or so. The right shows individual voice outputs with working mutes.

Lots more to come, but this has been such a fun project!!

What's everyone working on this week (43/2015)?

Another small update: as of 0.1.7, all known emulation bugs are fixed :smile: This has been tested with hundreds of .spc’s now, and they all seem to work perfectly. The remaining stuff is cosmetics in the code, debugging interfaces, documentation, and completeness stuff like DSP register reads, which none of the songs I’ve tested with ever use. So for what’s implemented, it’s 100% correct to my knowledge. So stoked :smiley: