Xbox 360 avatars in Python¶
To use Xbox 360 avatars in Python, use the sona package in the SDK download: open a sona.Context with your
licence, add the avatar from its manifest, then read its pose as plain data or render it with no window. It needs
Python 3.8 or newer.

Steps¶
- Download the SDK for your platform (getting it). It holds the
sonapackage; setSONA_LIB_DIRif the package does not find the library on the system's path. - Open a
sona.Contextwith your licence and a source:("gate", None)streams the item files from 360sona,("dir", folder)reads a folder of your own. - Add the avatar with
add_base64and update until it has settled. - Play a clip, read the pose, or draw a picture with
sona.Headless.
Open a context and wait for the avatar¶
with sona.Context(app_id=os.environ.get("SONA_APP_ID"), licence=licence,
sources=[source]) as ctx:
avatar = ctx.add_base64(manifest)
while not avatar.settled:
ctx.update(1 / 60)
if not avatar.ready:
sys.exit("the avatar did not load")
Read the pose¶
avatar.play("GenericWave")
for _ in range(60):
ctx.update(1 / 60)
pose = avatar.pose()
head = avatar.joint_world("Head")
print(len(pose.meshes), "meshes;", "head at", tuple(round(v,
3) for v in head[12:15]))
joint_world gives a row-vector matrix in metres; its last row holds the position. pose holds the meshes, the
materials, the textures and the 72-joint palette, valid until the next update.
More¶
- The Python tutorial builds the whole script, which saves a picture of the wave.
- Every call of the binding is in the bindings reference.
- Credit: show "Powered by 360sona" where your users see the avatars.
png_encodeputs the credit in a PNG's text chunks. - 360sona is not affiliated with or endorsed by Microsoft.
This page as Markdown · All the docs as one file (llms-full.txt)