Model Definition
pyawe_awc
AWC Parser
A parser to get the AWC file from Designer into a validated Python class.
pyawe_awc.AwcFile
Bases: BaseModel
The specification of the complete AWC file. This is the main entry point when an AWC file is parsed with pyawe_awc.AwcFile.from_file.
Attributes:
| Name | Type | Description |
|---|---|---|
containerType |
Literal['Toplevel', 'Subcanvas']
|
Describes for which type of signal flow this AWC was generated for. |
comments |
List[str] | str
|
A comment or several comments about this file. |
version |
conlist(int, max_length=8, min_length=8)
|
Version information extracted from a |
buildDateHex |
BuildDateStr
|
Contains the 9th values of the |
buildTimeHex |
BuildTimeStr
|
Contains the 10th values of the |
versionModuleHandle |
NonNegativeInt
|
In case the |
buildConfiguration |
BuildConfig
|
Specifies which build configuration was used to generate AWC. |
maxMessageLength |
NonNegativeInt
|
Size of the tuning buffer the Subcanvas or topLevel design require. Must be fulfilled by platform software implementation. |
clockDividers |
List[ClockDivider]
|
List of clock dividers this signal flow requires. |
heapSize |
List[AweHeaps]
|
Heap sizes required by this signal flow. |
inputDevices |
List[AwcInputDevice]
|
List of input devices this signal flow requires. |
outputDevices |
List[AwcOutputDevice]
|
List of output devices this signal flow requires. |
moduleClasses |
List[ModuleClassInfo]
|
List of module classes this signal flow requires. |
instanceIDs |
List[NonNegativeInt]
|
List of all instance IDs this signal flow requires. |
moduleLibraries |
List[ModuleLibraryInfo]
|
List of module libraries or module packs required. |
modules |
list[Module]
|
List of modules the signal flow provides, either for "application control" or for "tuning" |
awb |
AwbEntry
|
The signal flow as AWB instructions in binary form |
build_datetime()
Constructs a proper datetime object from the given HEX values in
buildDateHex and buildTimeHex attributes.
convert_list_of_lists_to_aweheaps(v)
classmethod
list to HeapSize object
convert_list_to_divider(divider_list)
classmethod
list to list of ClockDividers
from_file(filename)
classmethod
Reads AWC file and constructs class model; this is the "main" entry point to get to a pyawe_awc.AwcFile object
instance_ids()
Extract the information how many (and which) instance IDs this signal flow needs
module_by_name(module_name)
Retrieves a Module object by search for its name
List of AWC Data Types
pyawe_awc.models.devices.AudioFormat
Bases: StrEnum
Formats for the audio data
Attributes
pyawe_awc.models.devices.AudioFormat.float = 'float'
class-attribute
instance-attribute
pyawe_awc.models.devices.AudioFormat.fract32 = 'fract32'
class-attribute
instance-attribute
pyawe_awc.models.devices.AudioFormat.int16 = 'int16'
class-attribute
instance-attribute
pyawe_awc.models.devices.AudioFormat.int32 = 'int'
class-attribute
instance-attribute
pyawe_awc.models.devices.AudioFormat.sparse = 'SparseItem *'
class-attribute
instance-attribute
pyawe_awc.models.devices.AwcInputDevice
pyawe_awc.models.devices.AwcOutputDevice
Bases: DeviceBaseModel
Configuration for an output device
It adds the following attributes to the base model:
Attributes:
| Name | Type | Description |
|---|---|---|
accumulatedDelay |
List[float]
|
List of delay in milliseconds. |
pyawe_awc.models.awbdata.AwbEntry
Bases: BaseModel
Stores the (binary) AWB file data.
Attributes:
| Name | Type | Description |
|---|---|---|
data |
List[str]
|
A list of hex encoded string data. |
md5 |
MD5Str
|
The MD5 hash of the data. |
isEncrypted |
BoolInt
|
Set to true if the AWB data inside |
pyawe_awc.models.awbdata.AwbEntry.data_as_bytes()
returns the 'data' string list object into a bytes buffer The buffer will contain an EOF marker so that other Python code (PyAWB) knows when to stop reading.
TODO: think about a better way to write the PyAWB construct grammars
pyawe_awc.models.awbdata.AwbEntry.from_file(awb_path, is_encrypted=False)
classmethod
Generates pyawe_awc.models.awbdata.AwbEntry object from an existing AWB file
Function mainly used for testing purposes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
awb_path
|
str | PathLike
|
Path to AWB file to read data from. |
required |
is_encrypted
|
bool
|
label to use for this AWB data |
False
|
Returns pyawe_awc.models.awbdata.AwbEntry object
pyawe_awc.models.awbdata.AwbEntry.save(fname)
writes the AWB data into a file; returns size of file written
pyawe_awc.models.awc.AweHeaps
Bases: BaseModel
Configuration for heap allocation for a specific AWE Core instance.
Attributes:
| Name | Type | Description |
|---|---|---|
fast_a |
NonNegativeInt
|
Size of fast A heap; typically the fastest heap. |
fast_b |
NonNegativeInt
|
Size of fast B heap |
slow |
NonNegativeInt
|
Size of slow (DDR) heap. |
shared |
NonNegativeInt
|
Size of shared memory heap (may be 0 for Subcanvas) |
pyawe_awc.models.awepath.AwePath
Encapsulation of a path to a module or to a variable inside the signal flow
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mod
|
str
|
module's hierarchical name; can be given as "sub/sub1/mod2" or "sub_sub1_mod2" |
required |
var
|
str
|
optional: if given the name of the variable, like "gain" |
''
|
pyawe_awc.models.awepath.AwePath.__repr__()
returns a full path of object, like "sub/mod.var" or "sub/mod"
pyawe_awc.models.awepath.AwePath.as_flattened()
returns a flattened full path of object, like "sub_mod.var" or "sub_mod"
pyawe_awc.models.awepath.AwePath.from_str(path_spec)
classmethod
construct instance from a string
pyawe_awc.models.awc.BuildConfig
Bases: StrEnum
Was AWC exported for Release or Debug
Attributes
pyawe_awc.models.awc.BuildConfig.DEBUG = 'Debug'
class-attribute
instance-attribute
pyawe_awc.models.awc.BuildConfig.RELEASE = 'Release'
class-attribute
instance-attribute
pyawe_awc.models.module.ClockDivider
Bases: BaseModel
A string for the clockdivider.
It is in the form <clockDivider><subThreadID><coreId>, like 2A0 or 10B2
Attributes:
| Name | Type | Description |
|---|---|---|
divider |
int
|
the "real" clock divider |
subThreadID |
OnlyAtoZ
|
the subthread ID |
coreId |
int
|
the core ID - also called instance ID on systems where a signal flow covers several CPU cores |
pyawe_awc.models.module.ClockDivider.__str__()
returns the "typical" clockDivider format
pyawe_awc.models.module.ClockDivider.from_string(clockdivider_str)
classmethod
converts a "Matlab" string to ClockDivider
pyawe_awc.models.devices.DeviceBaseModel
Bases: BaseModel
Base model of a "device"
Attributes:
| Name | Type | Description |
|---|---|---|
name |
StrictStr
|
Name of device. |
numChannels |
NonNegativeInt
|
Number of channels. |
blockSize |
NonNegativeInt
|
Block size in bytes. |
sampleRate |
float
|
Sample rate in Hz. |
dataType |
AudioFormat
|
Data type. |
isComplex |
BoolInt
|
Whether the data is complex. |
channelNames |
List[StrictStr]
|
List of channel names. |
pyawe_awc.models.module.Module
Bases: BaseModel
Information about one single module in the AWE Signal Flow. It is stored in the modules
field of pyawe_awc.models.awc.AwcFile.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Hierarchical name of the variable (SYS1/SYS2/modName) |
description |
str
|
The matlab info about the class |
status |
ModuleStatus
|
Operating status of the module. |
className |
StrictStr
|
Name of the module's implementation class. |
classID |
NonNegativeInt
|
AWE class ID of that module (without the |
objectID |
NonNegativeInt
|
ID of the module inside the layout; in the >30000 range for control modules |
clockDivider |
ClockDivider
|
ClockDivider for this module |
controllingModules |
List[str]
|
List of other modules in the signal flow which control this module. |
variables |
list[Variable]
|
List of Variable specification items |
pyawe_awc.models.module.Module.is_controlled
property
returns if module is controlled by another module
pyawe_awc.models.module.Module.convert_str_to_divider(v)
classmethod
converts list to clock divider
pyawe_awc.models.awc.ModuleClassInfo
Bases: BaseModel
A container with a className and its corresponding class ID
pyawe_awc.models.module.ModuleStatus
Bases: StrEnum
Operating states of a module
Attributes
pyawe_awc.models.module.ModuleStatus.ACTIVE = 'active'
class-attribute
instance-attribute
pyawe_awc.models.module.ModuleStatus.BYPASSED = 'bypassed'
class-attribute
instance-attribute
pyawe_awc.models.module.ModuleStatus.INACTIVE = 'inactive'
class-attribute
instance-attribute
pyawe_awc.models.module.ModuleStatus.MUTED = 'muted'
class-attribute
instance-attribute
pyawe_awc.models.variable.NamedItem
Bases: BaseModel
Entry for an enumerated value, like a filter coeff type
pyawe_awc.models.variable.Variable
Bases: BaseModel
One AWE module's variable. It is stored in the variables member of a
pyawe_awc.models.module.Module.
- name: value
description: Data Value
handle: 122880008
...
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Hierarchical name of the variable, like |
value |
NumberLike
|
Value this variable will have when signal flow starts. |
offset |
NonNegativeInt
|
Offset of the variable. |
handle |
NonNegativeInt
|
Handle or variables address on the target. |
dataType |
VarType
|
Type of the variable. |
mask |
NonNegativeInt
|
Mask of variable. |
range |
VarRange | None
|
If not None the range the variable's values can take. |
isArray |
BoolInt
|
Whether variable contains an array or not. |
size |
VarSize
|
Size of the variable in number of rows and columns. |
usage |
VarUsage
|
Variable usage. |
description |
StrictStr
|
Description of the variable. |
units |
str
|
Unit of the variable, like "dB" |
isRangeEditable |
BoolInt
|
If true, the range variables can be modified at runtime. |
isComplex |
BoolInt
|
If data is a complex number or not. |
nameValueList |
List[NamedItem]
|
List of name/value pairs, like filter type values. |
controllingModules |
List[str]
|
List of modules which control this variable. |
presetGroup |
str
|
Specifies in which preset this variable should be stored (for tuning). |
isHidden |
BoolInt
|
If true, this variable is actually hidden. |
pyawe_awc.models.variable.Variable.is_controlled
property
returns whether variable is controlled by another module
pyawe_awc.models.variable.Variable.length
property
combines rows and columns to calculate total length of variable
pyawe_awc.models.variable.Variable.convert_list_str_to_awepath(v)
classmethod
strings to AwePaths (as module!)
pyawe_awc.models.variable.Variable.convert_list_to_var_range(v)
classmethod
list to VarRange
pyawe_awc.models.variable.Variable.convert_list_to_var_size(v)
classmethod
list to VarSize
pyawe_awc.models.variable.Variable.convert_string_to_enum(v)
classmethod
var type string to VarType
pyawe_awc.models.variable.Variable.ensure_all_values_are_same_type()
this processing ensures that values all have the same and correct type as specified,
- Mixed int/float inputs like [1, 2.0] are coerced consistently.
- If
dataTypeis INTEGER/UNSIGNED_INTEGER → floats must be whole numbers, converted to int. - If
dataTypeis FLOAT → ints are promoted to float.
the above type alias NumberLike ensures that mixed input, e.g., value = [1, 2.0] (int/float), are all coerced to float values (somehow)
pyawe_awc.models.variable.VarSize
Bases: BaseModel
Size of a variable in rows and colums
Note: Matlab shall ALWAYS have the order rows/colums. If not this is an error that shall be fixed (PaulB)
pyawe_awc.models.variable.VarRange
Bases: BaseModel
Range of a value; in AWC json it is given as a list of 3 values, in pyawe-awc it is converted into a model with
Attributes:
| Name | Type | Description |
|---|---|---|
minimum |
Scalar
|
minimum value |
maximum |
Scalar
|
maximum value |
step |
Scalar
|
step size, allowed values in between min and max |
Attributes
pyawe_awc.models.variable.VarRange.maximum
instance-attribute
pyawe_awc.models.variable.VarRange.minimum
instance-attribute
pyawe_awc.models.variable.VarRange.step
instance-attribute
Functions
pyawe_awc.models.variable.VarRange.__get_pydantic_json_schema__(core_schema, handler)
classmethod
pyawe_awc.models.variable_type.VarType
Bases: Enum
The type of variable in an AWE module
As variable names in Matlab are obviously somehow not so important :), we have variations to handle here. Those are mapped to a decent enum member by from_string()
Attributes
pyawe_awc.models.variable_type.VarType.FLOAT = 'float'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.FRACT_16 = 'fract16'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.FRACT_32 = 'fract32'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.INTEGER = 'int'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.POINTER_AWE_INSTANCE = 'AWEInstance*'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.POINTER_AWE_INSTANCE_2 = 'AWEInstance *'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.POINTER_FLOAT = 'FLOAT32*'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.POINTER_FLOAT_2 = 'float **'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.POINTER_FRACT = 'fract32 *'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.POINTER_INT = 'int *'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.POINTER_MODULE_DESCRIPTOR = 'ModuleInstanceDescriptor **'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.POINTER_SPARSE_ITEM = 'SparseItem *'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.POINTER_UINT = 'UINT32 *'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.UNSIGNED_INTEGER = 'uint'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.VOID = 'void *'
class-attribute
instance-attribute
pyawe_awc.models.variable_type.VarType.VOID_2 = 'void*'
class-attribute
instance-attribute
Functions
pyawe_awc.models.variable_type.VarType.from_string(s)
classmethod
maps incoming string to a class member