Copyright ©1988,1989,1990
Digidesign, Inc. All Rights Reserved


Sound Designer II File Format

Sound Designer II files store all sound samples in the data fork and all sound parameters in the resource fork. This is extremely conveniant for sound data where the data fork may grow to a hundred megabytes or more. Regardless of the size of the data fork you can add, delete, and modify sound parameters at will without compacting the sound data or moving it around the disk (and extremely time consuming procedure if the file is 100 MB). In addition, you may add your own parameters to a file (as long as their resource types don't conflict with Sound Designer II's) while allowing the file to be read by both Sound Designer and your program. We recommend that developers standardize on the Sound Designer II file format as the primary format due to its customizability. For multi-track operations, we recommend that each track be recorded in a separate single mono Sound Designer II file using stereo Sound Designer II files as the mastering medium.

File Type

File Type: 'Sd2f'

Resource Fork

The resource fork contains many different kinds of resources which specify everything from the sample rate to loop points to graphic eq settings. Most of these are application-specific to Sound Designer II. There are three core parameters/rsrcs in an SDII file:

Type: 'STR '
ID: 1000
Name: 'sample-size'
Value: Integer numeric string specifying the number of bytes per sample (ie 2 for standard 16 bit samples).

Type: 'STR '
ID: l001
Name: 'sample-rate'
Value: Floating point numeric string specifying the sample rate in hertz of the file (ie '44100.0000' for a standard 44.1kHz sample rate file).

Type: 'STR '
ID: l002
Name: 'channels'
Value: Integer numeric string specifying the number of channels in the file (ie 2 for stereo).

The above resources are all that are specifically required in an SDII file. Given only these three parameters, Sound Designer II can read in and play the file. If your program modifies the sound data or above 'STR ' resources in any way, it is your responsibility to delete any other resources that may have become out of sync with the file. This can happen if you delete a large section of the file without updating the playlist pointers. Notice that the length of the file is not stored. This is because you can derive the length given the sample size, number of channels, and the length in bytes of the data fork (using file system calls) using the following formulas:

Length of file (in sample frames) = 
= Length of data fork / (number of channels * sample size)

Length of file (in seconds) = 
= (Length of data fork / (number of channels * sample size) ) / sample rate

Other Parameter/Resource Types

The following resources store file information used by Sound Designer II for various advanced playback and processing. Unlike the above core parameters, these are stored as Pascal RECORD structures written out to resources. Therefore they are defined by the associated Pascal RECORD definitions below. Default values are given in ( ) within the comment next to a field. Byte offsets are indicated to the left at various offsets. Fields with the comment DO NOT USE are for Sound Designer internal use and should not be changed except when initializing the file. The size of the data types are detailed in Inside Macintosh, Volume 1, page 86.

Type: 'sdDD'
ID: 1000
Use: Stores general document information such as comments.
Structure: A DocumentDataRecord as defined below.

EditRecord = RECORD
HiAddr: LongInt; {DO NOT USE (0)}
LoAddr: LongInt; {DO NOT USE (0)}
ExtendSide: SideType; {DO NOT USE (0)}
END;

ZoomType = RECORD
v: Integer;
{vertical scale factor:
positive = magnification
negative = reduction (-256)
}
h: LongInt;

{horizontal scale factor:
positive = magnification
negative = reduction (1)
}
END;

ScaleType = RECORD
VFactor: LongInt;
{scale factor for vertical axis tick units:
positive = magnification
negative = reduction (327)
}
VType: ScaleName; {type of vertical axis tick mark unit (4)}
VString: STRING[32]; {vertial axis tick units string ("%Scale")}
HFactor: LongInt;
{scale factor for horizontal axis tick units:
positive = magnification
negative = reduction (1)
}
HType: ScaleNames; {type of horizontal axis tick mark unit (0)}
HString: STRING[32];
{
Horizontal axis tick units string:
usec,mec,sec,sample ("sec")
}
END;

DocumentDataRecord = RECORD
Version: Integer; {version/format of this resource(1)}
BufOffset: LongInt; {DO NOT USE (0)}
MarkerOffset: LongInt; {offset to get relative time markers};
Comment: Str255; {file comment (" ")}
HDPlayBufMultiple: Integer; {HD play buf multiple for this file (8)}
SMPTEStartTime: LongInt; {SMPTE start time of this file (0)}
FramesPerSec: Integer; {SMPTE frame rate of this file (30)}
FilmSize: Integer; {16mm or 35mm film (35)}
StartBarNum: LongInt; {starting Bar Number (0)}
StartBeatNum: LongInt; {starting Beat Number (0)}
StartFrame: LongInt; {the sample frame this new entry starts at}
Tempo: Fixed; {tempo in beats/sec}
TimeSignature: Fixed; {HiWord = numerator, LoWord = denominator}
CursorPos: LongInt; {cursor position relative to window start (0)}
CursorOn: Boolean; {(FALSE/0)}
Zoom: ZoomType; {see above}
Scale: ScaleType; {see above}
Edit: EditRecord; {see above}
VOffset: LongInt;
{
position of vertical center of window in quantization
units ie -32768 to 32767 (0)
}
HOffset: LongInt;
{
position of left edge of sample window
in #SAMPLES (0)
}
CtlWidth: Rect; {DO NOT USE (0)}
ZoomIndex: Point; {h and v indice in zoom increments}
SelectMode: Integer; {DO NOT USE (0)}
END;

Type: 'sdML'
ID: 1000
Use: Stores a list of text and numeric markers.
Structure:

Version: Integer; {version/format of this resource(1)}
MarkerOffset: LongInt; {DO NOT USE (0)}
NumMarkers: Integer; {number of MarkerRecords to follow}

Followed by NumMarkers of the following records:

MarkerRecord = RECORD
MarkerType: Integer; {1 = numbered marker, 2 = text marker (1)}
MarkerType: Integer; {DUPLICATE of previous value -for historical reasons}
Position: LongInt; {sample frame in file}
Text: LongInt; {DO NOT USE (0)}
CursorID: Integer; {24430 = numeric, 3012 = text (24430)}
MarkerID: Integer; {unique unsigned ID for each marker}
TextLength: LongInt; {length of marker text}
> > The Text (ie TextLength bytes of ASCII characters) < <
END;

Type: 'sdLL'
ID:1000
Use: Stores a list of audio loops (commonly used with samplers).
Structure:

Version: Integer; {version/format of this resource(1)}
HScale:Integer; {DO NOT USE (0)}
VScale:Integer; {DO NOT USE (0)}
NumLoops: Integer; {number of LoopRecords to follow}

Followed by NumLoops of the following records:

LoopRecord = RECORD
LoopStart: LongInt; {reference to start sample frame of this loop}
LoopEnd: LongInt; {reference to end sample frame of this loop}
LoopIndex: Integer; {identifies which loop this is (l..NumLoops)}
LoopSense:Integer; {117=foward loop, 118=backwards/forwards loop}
Channel:Integer; {channel which loop is on (0..NumChannels-1)}
END;

Reserved Parameter/Resource Types

Digidesign reserves all resource types that begin with the letters 'sd' or 'dd' (capital and lower case) ie 'sdPL', 'SDxx', 'DDxx' or 'dDxx', for present and future use by Sound Designer II and other Digidesign programs.

Data Fork

Byte one of the data fork is the first byte of sound data. The sound data is organized as interleaved samples (if more then one channel) of either 8 or 16 bit samples depending on the value of the 'sample-size' STR resource (see below).

For example, a standard 16 bit stereo file would be organized as follows:

Left Channel sample #1
Right Channel sample #1
Left Channel sample #2
Right Channel sample #2
Left Channel sample #3
Right Channel sample #3
etc...

Where each sample is the MSB (most significant byte) followed by the LSB (least significant byte) or better known as little endian format.

A four channel file would be as follows:

Channel 1 sample #1
Channel 2 sample #1
Channel 3 sample #1
Channel 4 sample #1
Channel 1 sample #2
Channel 2 sample #2
Channel 3 sample #2
Channel 4 sample #2
etc...


[ Up | Author Index ]