Snes APU on a PC



Overview

One of the most important component inside the Snes is the Audio Processing Unit (APU). The APU is responsible for playing music and sound effects. The APU is made with a processor (SPC700), some memory (64Kb), a DSP and a Digital/Analog converter. The Snes's main CPU communicates with the APU using 4 ports.

Here is a page explaining in greater details what's inside the APU: How sound on the SNES works

The .spc format Snes music files are 'save states' of the APU components, similar to the save states of the whole Snes we obtain by pressing F2 in zsnes, but this time, only the APU memory, CPU and DSP registers are saved. This is sufficient to playback game music because most games simply load a playback program in the spc which once started, plays music endlessly. When asked, the program also plays sound effects.

We can playback .spc files with a spc player(standalone or plugin). A spc player is a simplified Snes emulator (APU emulation only). I had been hoping for a long time to be able to use a real APU to play spc's to get a perfect reproduction of how it sounded on a real Snes (Of course emulators can do a better job than the real Snes APU, by using higher sample rates, better resampling, better interpolation, etc... but here, it is a matter of authenticity and cool factor).
I found how to connect a Snes APU on a parallel port on CaitSith2's website , as well as a simple program to upload .spc files to the module and play them back.


goto top Up


Schematic

Here is the schematic:
schematic
And here is a file containing the pinout of the Snes APU: APU_pinout.txt

The schematic and pinout comes from the archive APU Interface.zip, available on caitsith2's website.

If you build this project, please contact me. I'd like to add pictures to the image gallery.

For the 5 volts power supply, you can use a lm7805 voltage regulator. The module consumes 62mA from digital VCC when idle or playing and 36mA when reset is low. The module always consumes 1.3mA from Audio VCC.

A user reports that his unit would not work until he grounded the APU chassis.

goto top Up


Pictures

I built this project in a simple plastic box. In the left part, we can see the small PCB holding the 74ls32 and we can also see the DB25. Look at the next picture for more details about the right part.

Here we can see the APU connector (taken from a Snes), the RCA outputs, the 1/4 Jack output for headphones, the power led, and 2 leds to reflect the state of the R/W signals.
On the RCA connector, I installed 1uf capacitors to get rid of the DC offset (around 1.2 volts IIRC) coming out from the APU. The headphones jack uses the 50 ohms series resistors as on the original schematic. Apparently, my headphones do not like the DC offset, and using the same capacitors does not work either. I need to add a small amplifier...

Once closed, here's what this nice music box looks like.

goto top Up


Software

I first tried using CaitSith2 software, but it did not work. By looking at the signals with an oscilloscope, I deduced that the computer did not wait long enough for the logic levels to settle(rising was slow, this is probably due to the way my parallel port is designed). Fortunately, the source code was available. Adding small delays at the right places made it work.

The user interface is written in VB, and the low level parts are in C/C++ in a separate dll. I had to recompile the dll to add the deleays. If you get errors such as "Error Loading SPC", try my dll after confirming that everything is wired correctly.

Here is my dll: APU_DLL.dll and the file I modified: apuplay.c.

I did not want to be forced to run Windows in order to use the APU, so once everything was working well, I adapted the dll code for Linux (just a iopl call and a macros for doing port io) and I rewrote the VB code in C.(ouch..)

Xmms plugin screenshot:

The source code for my Linux program is available here:
DateFileComments
March 30, 2005 apu_linux-1.03.tar.gz
  • Added ppdev support (parallel port control from user space. Not necessary to be root anymore if your kernel supports it.).
  • Added xmms support (ppdev only)
  • Added color to the command line interface
  • Added a -d command line argument for debugging
  • Status line now enabled by default. Use -s to disable it
  • Code is now clearly licensed as GPL
March 6, 2005 apu_linux-1.02.tar.gz This new version can be compiled with DJGPP to build an executable usable on DOS/win9x (wont work with 2000/NT/XP since it needs to access io ports directly. You may be able to use it with the help of this: PortTalk - A Windows NT I/O Port Device Driver ).

Here is a precompiled DOS version: apuplay.zip (59k)
March 5, 2005 apu_linux-1.01.tar.gz No features have changed in this version. I just cleaned and clarified the code that manipulates the .spc file (the part converted from VB) by using #defines instead of hardcoded hex values. I have also added some comments about what is done. The code is now much easier to understand!
November 2004 apu_linux.tar.gz This is a simple command line tool to load a given .spc file into the snes apu using the interface described on this page. It partially supports id666 tags, stops the song after the specified timeout (from the tag or argument), displays the title, remaining time, etc...

goto top Up


Next

I'm not done yet with this project. Here are a few things I'd like to do:

goto top Up


Gallery

This will become (I hope) a gallery full of pictures of this project assembled by other people.

May 2005: Christopher Cox sent me pictures of how he assembled his spc player inside a lunch box!



March 2006: Jon Batt sent me 4 pictures:


January 2008: Matthew sent me 5 pictures:


He also posted a video on youtube!

September 2014: Marcin Mrozowski sent me the following pictures of the SPC player he built with Piotr Mrozowski (Marcin's father). The SPC file is not loaded using a parallel port. It is loaded wirelessly using and arduino and hc-05 bluetooth module!


goto top Up


Music

Here is a recording of a tune played with my APU: aquatic_ambiance.ogg

The best places to get game soundtracks in spc format are:
snesmusic.org
Zophar's spc archive.

goto top Up


Disclaimer

I cannot be held responsible for any damages that could occur to you or your equipment while following the procedures present on this page. Also, I GIVE ABSOLUTELY NO WARRANTY on the correctness and usability of the informations on this page. Please note, however, that the procedures above have worked in my case without any damages or problems.

Now you cannot say that I did not warn you :)


goto top Up


Trademarks used in this site are the property of their respectives owners.
Copyright © 2002-2014, Raphaël Assénat
Website coded withWebsite coded with vimLast update: November 17, 2014 (Monday)