ACB Cuesheet Binaries

class PyCriCodecsEx.acb.ACB(stream: str | BinaryIO)[source]

Bases: UTF

Use this class to read, and modify ACB files in memory.

__init__(stream: str | BinaryIO) None[source]

Loads an ACB file from the given stream.

Parameters:

stream (str | BinaryIO) – The path to the ACB file or a BinaryIO stream containing the ACB data.

get_waveforms(**kwargs) List[HCACodec | ADXCodec | Tuple[AcbEncodeTypes, int, int, int, bytes]][source]

Returns a list of decoded waveforms.

Item may be a codec (if known), or a tuple of (Codec ID, Channel Count, Sample Count, Sample Rate, Raw data).

Additional keyword arguments are passed to the codec constructors. e.g. for encrypted HCA payloads, you may do the following: `python get_waveforms(key=..., subkey=...) ` See also the respective docs (ADXCodec, HCACodec) for more details.

set_waveforms(value: List[HCACodec | ADXCodec | Tuple[AcbEncodeTypes, int, int, int, bytes]])[source]

Sets the waveform data.

Input item may be a codec (if known), or a tuple of (Codec ID, Channel Count, Sample Count, Sample Rate, Raw data).

NOTE: Cue duration is not set. You need to change that manually - this is usually unecessary as the player will just play until the end of the waveform.

property awb: AWB

Returns the AWB object associated with the ACB.

property cues: Generator[PackedCueItem, None, None]

Returns a generator of read-only Cues.

Cues reference waveform bytes by their AWB IDs, which can be accessed via waveforms. To modify cues, use the view property instead.

property name: str

Returns the name of the ACB file.

property payload: dict

Retrives the only UTF table dict within the ACB file.

property view: ACBTable

Returns a view of the ACB file, with all known tables mapped to their respective classes.

  • Use this to interact with the ACB payload instead of payload for helper functions, etc

class PyCriCodecsEx.acb.ACBBuilder(acb: ACB)[source]

Bases: object

Use this class to build ACB files from an existing ACB object.

__init__(acb: ACB) None[source]

Initializes the ACBBuilder with an existing ACB object.

Parameters:

acb (ACB) – The ACB object to build from.

Building ACB from scratch isn’t planned for now since:

  • We don’t know how SeqCommandTable TLVs work. This is the biggest issue.

  • Many fields are unknown or not well understood

  • Games may expect AcfReferenceTable, Asiac stuff etc to be present for their own assets in conjunction

    with their own ACF table. Missing these is not a fun debugging experience.

  • ACB tables differ a LOT from game to game (e.g. Lipsync info), contary to USM formats.

Maybe one day I’ll get around to this. But otherwise starting from nothing is a WONTFIX for now.

build() bytes[source]

Builds an ACB binary blob from the current ACB object.

The object may be modified in place before building, which will be reflected in the output binary.

acb: ACB
class PyCriCodecsEx.acb.ACBTable(payload: list | dict, **args)[source]

Bases: UTFViewer

ACB Table View

waveform_of(index: int) List[WaveformTable][source]

Retrieves the waveform(s) associated with a cue.

Cues may reference multiple waveforms, which could also be reused.

AcbGuid: bytes

GUID of the ACB. This SHOULD be different for each ACB file.

AwbFile: bytes
CueNameTable: List[CueNameTable]

A list of cue names with their corresponding indices into CueTable

CueTable: List[CueTable]

A list of cues with their corresponding references

Name: str

Name of the ACB. This is usually the name of the sound bank.

SequenceTable: List[SequenceTable]
SynthTable: List[SynthTable]
TrackEventTable: List[TrackEventTable]
TrackTable: List[TrackTable]
Version: int
VersionString: str
WaveformTable: List[WaveformTable]
class PyCriCodecsEx.acb.CueNameTable(payload: list | dict, **args)[source]

Bases: UTFViewer

CueIndex: int

Index into CueTable

CueName: str

Name of the cue

class PyCriCodecsEx.acb.CueTable(payload: list | dict, **args)[source]

Bases: UTFViewer

CueId: int

Corresponds to the cue index found in CueNameTable

Length: int

Duration of the cue in milliseconds

ReferenceIndex: int
ReferenceType: int
class PyCriCodecsEx.acb.PackedCueItem(CueId: int, CueName: str, Length: float, Waveforms: list[int])[source]

Bases: object

Helper class for read-only cue information

__init__(CueId: int, CueName: str, Length: float, Waveforms: list[int]) None
CueId: int

Cue ID

CueName: str

Cue name

Length: float

Duration in seconds

Waveforms: list[int]

List of waveform IDs, corresponds to ACB.get_waveforms()

class PyCriCodecsEx.acb.SequenceTable(payload: list | dict, **args)[source]

Bases: UTFViewer

NumTracks: int
TrackIndex: bytes
Type: int
class PyCriCodecsEx.acb.SynthTable(payload: list | dict, **args)[source]

Bases: UTFViewer

ReferenceItems: bytes
class PyCriCodecsEx.acb.TrackEventTable(payload: list | dict, **args)[source]

Bases: UTFViewer

Command: bytes
class PyCriCodecsEx.acb.TrackTable(payload: list | dict, **args)[source]

Bases: UTFViewer

EventIndex: int
class PyCriCodecsEx.acb.WaveformTable(payload: list | dict, **args)[source]

Bases: UTFViewer

EncodeType: int
MemoryAwbId: int
NumChannels: int
NumSamples: int
SamplingRate: int
Streaming: int