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])[source]¶ 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.SBNKinstances.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: listof(name, bank), wherenameis of typestrorNone, andbankis of typendspy.soundBank.SBNKorNoneDefault: []
-
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.GroupEntryinstances.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: listof(name, entries), wherenameis of typestrorNone, andentriesisNoneor a list ofndspy.soundGroup.GroupEntrysDefault: []
-
sequenceArchives¶ The sound-effect sequence archives in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundSequenceArchive.SSARinstances.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: listof(name, sequenceArchive), wherenameis of typestrorNone, andsequenceArchiveis of typendspy.soundSequenceArchive.SSARorNoneDefault: []
-
sequencePlayers¶ The sequence players in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundSequencePlayer.SequencePlayerinstances.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: listof(name, sequencePlayer), wherenameis of typestrorNone, andsequencePlayeris of typendspy.soundSequencePlayer.SequencePlayerorNoneDefault: []
-
sequences¶ The sequenced music pieces in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundSequence.SSEQinstances.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: listof(name, sequence), wherenameis of typestrorNone, andsequenceis of typendspy.soundSequence.SSEQorNoneDefault: []
-
streamPlayers¶ The stream players in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundStreamPlayer.StreamPlayerinstances.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: listof(name, streamPlayer), wherenameis of typestrorNone, andstreamPlayeris of typendspy.soundStreamPlayer.StreamPlayerorNoneDefault: []
-
streams¶ The streamed music pieces in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundStream.STRMinstances.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: listof(name, stream), wherenameis of typestrorNone, andstreamis of typendspy.soundStream.STRMorNoneDefault: []
-
waveArchives¶ The archive files containing wave files in this SDAT, in the form of a list of name-value pairs containing
ndspy.soundWaveArchive.SWARinstances.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: listof(name, waveArchive), wherenameis of typestrorNone, andwaveArchiveis of typendspy.soundWaveArchive.SWARorNoneDefault: []
-
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: boolDefault: 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: intDefault: 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: intorNoneDefault: 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: boolDefault: 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: boolDefault: False
-
classmethod
fromFile(filePath)[source]¶ Load an SDAT from a filesystem file. This is a convenience function.
Parameters: filePath ( stror other path-like object) – The path to the SDAT file to open.Returns: The SDAT object. Return type: SDAT
-