|
|
|
|
|
|
The following file format specification has been adapted to The Sonic Spot's Guide layout with permission from the original author, Henning Hellstrøm. A link to the original specification can be found at the bottom of this page. This document should be all you need write your own PAC and SOU file load/save routines. If you have any questions, you can e-mail the author at henning.hellstrom@azlan.no. Table of Contents
OverviewSBStudio has its own song file format called PAC or package. A PAC file contains all of the sheets/patterns and sounds belonging to a song. A sound can also be saved separately as a SOU file.The PAC format was introduced with SBStudio 2, which saved PAC version 1.4 files. SBStudio 3 saves version 1.6 files. This document will describe these two versions. Data FormatPAC and SOU files are made up of data blocks, similar to chunks found in standard RIFF files, each starting with a block ID and data size. The ID is a four byte string and the data size is a four byte number, also known as a long integer. This makes the file format easy to support and upgrade and loaders can easily skip data they don't recognize.
One tricky thing about working with blocks in some PAC files is that a couple of block types ("SONG" and "SND ") may have a data size of 0, even though they "contain" sub-chunks of data. It may be inconsistent between PAC and SOU files as well as the different format versions but it isn't a huge problem because a file loader will simply go on and skip following sub-chunks if they are unrecognized. These 0 data sized blocks can be simply thought of as markers, signaling the start of a new set of information. More details about these blocks are discussed below in their corresponding sections below. Since the PAC and SOU file formats are native to MS-DOS and therefor Intel processors, all data values are stored in Little-Endian (least significant byte first) order. The rest of this document goes through the different types of blocks, describing the format of their data bytes and what they mean. You can use the table of contents at the beginning of this document to help find the block type you are interested in. Package ID Block - "PACG"This block can be used to verify that a file is actually a PAC file. It is always located at the beginning of a PAC file and has a data size of the entire file minus it's 8 bytes of block ID and data size information.
Package Information Block - "PAIN"This block is usually the first block inside of the Package ID Block. It is used to specify the format and program version numbers as well as the number of sounds in the package file.
Format Version SBStudio Version Number of Sounds Package Origin Block - "PAOR"This block contains information about the program used to create the package and usually comes after the Package Information block. It was introduced in with Format Version 1.6.
Song Block - "SONG"This block marks the start of a song structure which is where the sheets and song settings are stored. SBStudio 2 had the option to save song files with only this structure, but newer versions no longer allow this. This block usually follows the Package Information Block.
Block Data Size Song Name Block - "SONA"This block is used to specify the song name as an ASCII string. SBStudio supports up to 40 bytes, but the file format specification does not place this limit on the length.
Song Order List Block - "SOOR"This block is used to define the order which the sheets will be played. Two bytes per are used for each entry in the order list.
Song Information Block - "SOIN"This block is used to specify various information about a song. It's size is format version specific, but all versions share the same previous version information.
Sheet Format Audio Channel Pan Positions Song Channel Settings Block - "SOCS"This block is used to specify the various pan positions and effects levels for each channel. It is always found in a song block and was added is format version 1.6.
Channel Number Pan Position Effect Levels Song Channel Name Block - "SOCN"This block is used to specify the name of a channel. It is always found in a song block and was added is format version 1.6.
Song Sheet Block - "SOSH"This block is used to define the contents of all the cells of a sheet. It is always located within a Song Block.
Sheet Data A sheet consists of 5 bytes per channel in 64 rows. The 5 bytes describe one cell with a note number, sound number, note volume, command and parameter. The format is as follows:
Note Number SBStudio saves all sheets in a packed format. The packed format is very simple, but may sometimes dramatically reduce the file size. When loading sheets, you should always assume they are packed. This will make your loader compatible with both packed and unpacked sheets. In a packed sheet, byte 0 or 2 in the 5 byte channel cell can contain a special byte. The special bytes are:
Sound Block - "SND "This block is used to define a sound. It is located after Song Blocks in a PAC or at the start of a SOU file.
Block Data Size Sound Name Block - "SNNA"This block is used to specify the name of a sound. It is located inside or after a Sound Block and may appear in either a PAC or SOU file.
Sound Information Block - "SNIN"This block is used to specify sound tuning and format information. It is located inside or after a Sound Block and may appear in either a PAC or SOU file.
Sound Data Block - "SNDT"This block contains raw/uncompressed, signed sample data that makes up the sounds audio waveform signal. It is located inside or after a Sound Block and may appear in either a PAC or SOU file.
End Of File Block - "END "This block signals the end of a PAC or SOU file. It is located at the end of the file.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Links: The Original PAC and SOU Format Specification |