PSFFormat

HomePage :: Categories :: Login

PSF Format Specification


This is a live version of the PSF Format Specification (based on v1.6), to be updated continually.

Introduction


PSF (Portable Sound Format) brings the functionality of NSF, SID, SPC, and GBS to next-generation consoles. PSF utilizes the original music driver code from each game to replay sequenced music in a perfectly authentic, and size-efficient, way.

The general idea is that a PSF file contains a zlib-compressed program which, if executed on the real console, would simply play the music.

File Structure


All PSF files share the same basic stucture.

Alignment to any data type larger than a byte is not guaranteed in the PSF file. Exercise appropriate caution.



The version byte is used to determine the type of PSF file. It does NOT affect the basic structure of the file in any way.

Currently accepted version bytes are:

Depending on the version byte, the reserved and program sections are interpreted differently. Some tags may also be interpreted differently. Refer to the linked sections above for more information.



This is the length of the program data _after_ compression.


This is the CRC-32 of the program data _after_ compression. Filling in this value is mandatory, as a PSF file may be regarded as corrupt if it does not match.


May be empty if R is 0 bytes.


May be empty if N is 0 bytes.

The following data is optional and may be omitted:


If these 5 bytes do not match, then the remainder of the file may be regarded as invalid and discarded.


Refer to PSF Tag Format for information on the tag format.

Tag data may be subject to truncation, including removal of the excess data from the file itself, if it exceeds 50,000 bytes. This is by design.

Compatibility


For future compatibility, tag editors and compressors may assume that any PSF file uses this basic structure. However, the reserved area must be left intact, and no assumptions may be made about the format or contents of either the uncompressed program or reserved sections without first checking the version byte.


CategoryPSF