ndspy.soundArchive
: SDAT (Sound Archives)¶
ndspy.soundArchive
allows you to load and save SDAT sound archive files
and the files within them.
See also
If you aren’t familiar with how SDAT files are structured, consider reading the appendix explaining this.
- class ndspy.soundArchive.SDAT([data])¶
A sound data archive file (SDAT).
- Parameters:
data (bytes) – The data to be read as an SDAT file. If not provided, the SDAT will use default values.
- banks¶
The instrument banks in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundBank.SBNK
instances.This is presented as a list of name-value pairs because
collections.OrderedDict
– the best choice for an order-preserving dictionary type – does not provide an easy way to adjust the order of its elements.See also
ndspy.indexInNamedList()
,ndspy.findInNamedList()
,ndspy.setInNamedList()
– helper functions you can use to find and replace values in this list.- Type:
list
of(name, bank)
, wherename
is of typestr
orNone
, andbank
is of typendspy.soundBank.SBNK
orNone
- Default:
[]
- groups¶
The file groups in this SDAT, in the form of a list of name-value pairs, where the values are lists containing
ndspy.soundGroup.GroupEntry
instances.This is presented as a list of name-value pairs because
collections.OrderedDict
– the best choice for an order-preserving dictionary type – does not provide an easy way to adjust the order of its elements.See also
ndspy.indexInNamedList()
,ndspy.findInNamedList()
,ndspy.setInNamedList()
– helper functions you can use to find and replace values in this list.- Type:
list
of(name, entries)
, wherename
is of typestr
orNone
, andentries
isNone
or a list ofndspy.soundGroup.GroupEntry
s- Default:
[]
- sequenceArchives¶
The sound-effect sequence archives in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundSequenceArchive.SSAR
instances.This is presented as a list of name-value pairs because
collections.OrderedDict
– the best choice for an order-preserving dictionary type – does not provide an easy way to adjust the order of its elements.See also
ndspy.indexInNamedList()
,ndspy.findInNamedList()
,ndspy.setInNamedList()
– helper functions you can use to find and replace values in this list.- Type:
list
of(name, sequenceArchive)
, wherename
is of typestr
orNone
, andsequenceArchive
is of typendspy.soundSequenceArchive.SSAR
orNone
- Default:
[]
- sequencePlayers¶
The sequence players in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundSequencePlayer.SequencePlayer
instances.This is presented as a list of name-value pairs because
collections.OrderedDict
– the best choice for an order-preserving dictionary type – does not provide an easy way to adjust the order of its elements.See also
ndspy.indexInNamedList()
,ndspy.findInNamedList()
,ndspy.setInNamedList()
– helper functions you can use to find and replace values in this list.- Type:
list
of(name, sequencePlayer)
, wherename
is of typestr
orNone
, andsequencePlayer
is of typendspy.soundSequencePlayer.SequencePlayer
orNone
- Default:
[]
- sequences¶
The sequenced music pieces in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundSequence.SSEQ
instances.This is presented as a list of name-value pairs because
collections.OrderedDict
– the best choice for an order-preserving dictionary type – does not provide an easy way to adjust the order of its elements.See also
ndspy.indexInNamedList()
,ndspy.findInNamedList()
,ndspy.setInNamedList()
– helper functions you can use to find and replace values in this list.- Type:
list
of(name, sequence)
, wherename
is of typestr
orNone
, andsequence
is of typendspy.soundSequence.SSEQ
orNone
- Default:
[]
- streamPlayers¶
The stream players in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundStreamPlayer.StreamPlayer
instances.This is presented as a list of name-value pairs because
collections.OrderedDict
– the best choice for an order-preserving dictionary type – does not provide an easy way to adjust the order of its elements.See also
ndspy.indexInNamedList()
,ndspy.findInNamedList()
,ndspy.setInNamedList()
– helper functions you can use to find and replace values in this list.- Type:
list
of(name, streamPlayer)
, wherename
is of typestr
orNone
, andstreamPlayer
is of typendspy.soundStreamPlayer.StreamPlayer
orNone
- Default:
[]
- streams¶
The streamed music pieces in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundStream.STRM
instances.This is presented as a list of name-value pairs because
collections.OrderedDict
– the best choice for an order-preserving dictionary type – does not provide an easy way to adjust the order of its elements.See also
ndspy.indexInNamedList()
,ndspy.findInNamedList()
,ndspy.setInNamedList()
– helper functions you can use to find and replace values in this list.- Type:
list
of(name, stream)
, wherename
is of typestr
orNone
, andstream
is of typendspy.soundStream.STRM
orNone
- Default:
[]
- waveArchives¶
The archive files containing wave files in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundWaveArchive.SWAR
instances.This is presented as a list of name-value pairs because
collections.OrderedDict
– the best choice for an order-preserving dictionary type – does not provide an easy way to adjust the order of its elements.See also
ndspy.indexInNamedList()
,ndspy.findInNamedList()
,ndspy.setInNamedList()
– helper functions you can use to find and replace values in this list.- Type:
list
of(name, waveArchive)
, wherename
is of typestr
orNone
, andwaveArchive
is of typendspy.soundWaveArchive.SWAR
orNone
- Default:
[]
- fatLengthsIncludePadding¶
If this is
True
, files within this SDAT will be extended with null bytes to provide the proper alignment. If this isFalse
, null bytes for alignment will still be present, but they will be between files rather than appended to the previous file.This is chosen heuristically when loading an SDAT, so it may not always be accurate. If this value matters to you, it’s a good idea to explicitly set it to the value you want before saving.
- Type:
- Default:
False
- fileAlignment¶
The alignment of files within this SDAT. Null bytes will be placed between files in order to ensure that all files begin at an offset in the ROM data that is a multiple of this value.
This is chosen heuristically when loading an SDAT, so it may not always be accurate. If this value matters to you, it’s a good idea to explicitly set it to the value you want before saving.
See also
firstFileAlignment
– the alignment of the first file, which may differ from this value.fatLengthsIncludePadding
– whether the padding used to align files should be included in the file lengths or not.- Type:
- Default:
0x20
- firstFileAlignment¶
The alignment of the first file within this SDAT. If this is
None
, the alignment will be the same as for other files.This is chosen heuristically when loading an SDAT, so it may not always be accurate. If this value matters to you, it’s a good idea to explicitly set it to the value you want before saving.
See also
fileAlignment
– the alignment of all other files.- Type:
int
orNone
- Default:
None
- padAtEnd¶
If this is
True
, alignment padding will be added at the very end of the SDAT (after the last file) or not. This is fairly pointless, but most SDAT files do this. Only SDAT files from modified games seem to not do this.This is chosen heuristically when loading an SDAT, so it may not always be accurate. If this value matters to you, it’s a good idea to explicitly set it to the value you want before saving.
See also
fatLengthsIncludePadding
– whether the padding used to align files should be included in the file lengths or not.- Type:
- Default:
True
- padSymbSizeTo4InSDATHeader¶
If this is
True
, the alignment padding at the end of the “SYMB” block will be included in its length. Only SDAT files from modified games seem to do this.This is chosen heuristically when loading an SDAT, so it may not always be accurate. If this value matters to you, it’s a good idea to explicitly set it to the value you want before saving.
- Type:
- Default:
False
- classmethod fromFile(filePath)¶
Load an SDAT from a filesystem file. This is a convenience function.