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.
Here is the schematic:
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..)
The source code for the Linux program is available here:
|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…|
Notes by phreak97:
I did not put this page here, nor do i know who did. I have however fixed two of the pictures which were not appearing.
i would also like to make it noted that the writer of this page has copied everything from this site. All credit should go to www.raphnet.net