SPCPlay - .SPC Music Player


Overview

You may be asking yourselves, what exactly IS SPCPlay? 
SPCPlay is a music player for SNES saved states, coded 
in 100% 32 bit assembly. It can play music from either
a standard save state generated by ZSNES (.ZS*), or an 
SPC saved state (.SPC).

Many of you have been wondering why the soundtrack 
can't just be ripped out of any SNES ROM. For those
of you that have tried Butcha's SNES sound ripping
utility, SNESSOR, you will notice that you can only
rip sound samples. Here's why.

Stored in an SNES ROM are samples, much like the way 
MOD files store them except they are compressed. These
compressed 16 bit samples can be a violin, a harp, maybe
even a moaning voice.  The SPC700 is a CPU which executes
a sound program code to play these samples, for how long,
what pitch, and so forth and the 65816 is the main CPU of
the snes which is responsible for transferring the
program code to the SPC700.  Now the problem here is that
there is no reserved place in the game rom for the sound
program and detecting where the program code data is
located isn't easy.  Many programs also require a double
transfer such as the 65816 first transfers the code to
the spc700, then after some spc700 execution, it then
transfers some other code or data.  So at the moment, the
best way to capture spc700 code is to capture them right
when the song starts in the actual snes emulation.

History

v0.100 - First Public Release (04/22/98)

v0.200 - Pitch was a bit too high in the first release.  Fixed.
       - Several Volume Fixes
       - Completely Rewrote the ADSR/GAIN volume effects engine.
         Lots of bugs removed!  Many games sound much nicer!
       - Sped up sound echoing
       - Fixed some sound echo bugs
       - Added sound channel disable/enable
       - Added Volume Adjustment
       - Implemented .cfg file support (spcplay.cfg)
         Load spcplay once to create a default .cfg file
       - Added .WAV logging support

       * Note : Zsnes v0.400 has a bug in .spc capture.  Please use v0.393
         instead if it doesn't work

Usage

At the moment, SPCPlay can only run files off the commandline.

It can load :

  .ZST Save State files from ZSNES
  .SPC Files Generated from ZSNES

Command Line Options

To get the most out of SPCPlay, use the following switches at your
discretion:

-8    : Force 8 bit sound output (Defaults to 16 bit)
-q    : Enable sound buffering (Default is off)
-r #  : Sets sound sampling rate 
        0 = 8000 hz 1 = 11025 hz 2 = 22050 hz (Default) 3=44100 hz
-v #  : Sets the volume level (0 .. 100, 75 = default)
-w fn : Saves a .wav using the current sound settings with fn as the filename
-z    : Enable stereo sound (Default is mono)
       (Only available with 16 bit sound cards)

Features

- Full SPC700 emulation (may still have bugs left)
- Sound DSP Emulation
    - ADSR/GAIN Volume Effects (still have a few bugs left)
    - Echo Effects
    - FIR Filter   (Thanks feenix65!)
    - Noise Emulation

What's Missing

- Pitch Modulation

Future

- An User Interface
- Multiple Songs in Memory
- Time limit per Song

FAQ

Q1) How do I get these SNES music files?
A1) You can either use a saved state from ZSNES (you make it
    by loading the game and hitting F2 to save at the music
    you want), or by saving the SPC state (by hitting F1 and
    choosing 'Save SPC State' a few seconds before a song starts).

Q2) Why doesn't music from game xxx sound perfect?
A2) Since the SPC emulator isn't perfect, there will always be games
    with not-so-perfect sound.

Q3) How do i get stereo sound?
A3) Use the command line switch -z

Q4) Can I convert these SPC files to MOD?
A4) Not at the moment.  Also, a conversion isn't planned, however, a
    great Super Nintendo Emulator, SNEmul can capture .MOD files directly from
    emulation.

Q5) How come some tunes that are supposed to pan from speaker to speaker
    don't?
A5) You have to enable stereo sound (-z).

Q6) When will the sound engine of spcplay be ported over to zsnes?
A6) Most likely the next version after v0.400 as long as no major problems
    occur during the transfer

Related Sites


Here are some sites you should visit:

ZSNES Homepage   : http://www.csoft.net/~zsnes/
ZSNES Mirror     : http://zophar.net/zsnes/
SNES9X Homepage  : http://www.euronet.nl/users/jkoot/
SNEmul Homepage  : http://www.mygale.org/09/cassiop/
Zophar's Domain  : http://zophar.net/
Emu News Service : http://www.classicgaming.com/emunews

Credits


Zophar   : for writing much of this documentation, and for testing.
feenix65 : for the info on FIR Filter

And, of course, all of the people who helped with ZSNES, for without them,
SPCPlay would not be possible.


.SPC File Format


Offset 00000h - File Header : SNES-SPC700 Sound File Data v0.10
Offset 00021h - 0x26,0x26,0x26 (Don't remember why I put 3 instead of just 1)
Offset 00024h - Version #(/100)
Offset 00025h - PC Register value (1 Word)
Offset 00027h - A Register Value (1 byte)
Offset 00028h - X Register Value (1 byte)
Offset 00029h - Y Register Value (1 byte)
Offset 0002Ah - Status Flags Value (1 byte)
Offset 0002Bh - Stack Register Value (1 byte)
Offset 0002Ch-000FFh - Reserved For Future Use (Please Keep 0 for now)
Offset 00100h-100FFh - SPCRam
Offset 10100h-101FFh - DSPRam

* A key on has to be issued right when a .spc file starts to play

