Framer
- class gpype.backend.flow.framer.Framer[source]
Bases:
IONodeFrame aggregation node for combining single samples into frames.
Collects individual samples (frame size = 1) and aggregates them into larger frames of a specified size. Maintains an internal buffer that accumulates samples until a complete frame is assembled, then outputs the entire frame. Useful for converting sample-by-sample streams into frame-based processing.
- DEFAULT_FRAME_SIZE = 1
declared so the catalog can read it.
- Type:
See FFT
- __init__(frame_size=None, **kwargs)[source]
Initialize the Framer node.
- Parameters:
frame_size (
int) – Size of output frames to generate. Must be a positive integer. Defaults to 1 if None.**kwargs – Additional configuration parameters passed to IONode.
- Raises:
ValueError – If frame_size is not an integer or is less than 1.
- setup(data, port_context_in)[source]
Set up the Framer node and allocate the internal buffer.
Validates input port configuration and initializes the internal buffer based on output frame size and channel count. Input must have frame_size = 1 for proper single-sample aggregation.
- Parameters:
- Return type:
- Returns:
Output port context with updated frame size information.
- Raises:
ValueError – If input frame size is not 1.
- step(data)[source]
Take every incoming sample and emit whole frames.
Serialises what arrives – one sample or many – into a running frame, and emits it once it is full. A frame that does not divide the input evenly simply carries the remainder into the next one, so no sample is dropped or repeated at the boundary.