What's Brewing: SBX - Spacebrew Data Type Extension

SBX stands for spacebrew data type extension. It provides an easy interface to send and receive custom datatypes among spacebrew instances.

At the time of writing this post, it worked only in Spacebrew for Openframeworks, but Processing and Javascript versions were on the way. Please check the SBX Github Repo for updates.

Custom data types are particularly useful when sending data that is wrapped in one object but contains multiple attributes, such as a 3D position (x, y, z) or and RGB color (r, g, b). They allow to send these multiple attributes using only one spacebrew connection.

SBX pulls the model for the custom type from a local JSON file containing the elements that will be part of it. For example, if you want to send a position in 3D space, you would write a vec3.json file that looks like this:

{
    "x": 0,
    "y": 0,
    "z": 0
}

If maybe you want to send a color, with an alpha value included, you would write a color.json file that looks like this:

{
    "r": 0,
    "g": 0,
    "b": 0,
    "a": 0
}

To use SBX in OF, simply add SBX source files to your project.

Available methods and modes of use can be found in the Github page.