# Bindings: Python

473 public names in `bindings/python/sona/__init__.py`, `bindings/python/sona/editor.py`, `bindings/python/sona/track.py`.

## Functions

| Declaration | What it does |
|---|---|
| `result_name(code)` | The name of a code ("licence", "gate",...): the same words as the web SDK's SonaError.code.<br>Calls [`sona_result_name`](../c/results-and-errors.md#sona_result_name). |
| `version()` | The library's version, "1.1.0".<br>Calls [`sona_version`](../c/the-context.md#sona_version). |
| `platform()` | The binary platform id: "linux-x64", "windows-x64",...<br>Calls [`sona_platform`](../c/the-context.md#sona_platform). |
| `check_layout()`<br>`check_layout(lib)` | The number of struct sizes and field offsets checked against the library (done once at import).<br>Calls [`sona_editor_struct_size`](../c/player-editor.md#sona_editor_struct_size), [`sona_editor_struct_offset`](../c/player-editor.md#sona_editor_struct_offset), [`sona_track_struct_size`](../c/face-tracking.md#sona_track_struct_size), [`sona_track_struct_offset`](../c/face-tracking.md#sona_track_struct_offset). |
| `skeleton_bone(skeleton, joint)` | The bone a joint is in a skeleton ("unity", "vrm", "vrm0", "ue4", "ue5"); None when it has none.<br>Calls [`sona_skeleton_bone`](../c/skeleton-maps-and-vrm-export.md#sona_skeleton_bone). |
| `skeleton_joint(skeleton, bone)` | The joint a bone of that skeleton is; -1 when none.<br>Calls [`sona_skeleton_joint`](../c/skeleton-maps-and-vrm-export.md#sona_skeleton_joint). |
| `vrm_expression_name(expression)` | The VRM 1.0 preset name of a sona_vrm_expression ("aa"...<br>Calls [`sona_vrm_expression_name`](../c/skeleton-maps-and-vrm-export.md#sona_vrm_expression_name). |
| `joint_find(name)` | A joint by name: "Hips", "Head", "PropRight", "shape_04", "joint_33".<br>Calls [`sona_joint_find`](../c/game-features.md#sona_joint_find). |
| `joint_name(joint)` | None past the last joint.<br>Calls [`sona_joint_name`](../c/game-features.md#sona_joint_name). |
| `lod_defaults()` | The level-of-detail defaults, with sprites on at 48 px.<br>Calls [`sona_lod_defaults`](../c/crowds-level-of-detail-and-sprites.md#sona_lod_defaults). |
| `placeholder_defaults()` | size set; delay_seconds 0 (never a hole), appear_seconds 0.2, reveal_seconds 0.4, failed_seconds 2, tint 0.16, 0.19, 0.25 (a cool grey), failed_tint 0.25, 0.15, 0.15 (a muted red), glow 0.5.<br>Calls [`sona_placeholder_defaults`](../c/loading-placeholders.md#sona_placeholder_defaults). |
| `preview_defaults()` | Fills the defaults above.<br>Calls [`sona_preview_defaults`](../c/item-previews.md#sona_preview_defaults). |
| `pixel_defaults()` | size set, height 32, colours 16, flags SONA_PIXEL_OUTLINE, outline 0 (from the palette), alpha_cut 0.5, no palette.<br>Calls [`sona_pixel_defaults`](../c/2d-outputs.md#sona_pixel_defaults). |
| `sticker_defaults()` | size set, pixels 512, time -1, framing SONA_PRESET_FULL, outline_px 10, outline 0xffffffff, shadow 0x59000000 (off while shadow_px is 0), padding 8.<br>Calls [`sona_sticker_defaults`](../c/2d-outputs.md#sona_sticker_defaults). |
| `sheet_defaults()` | size set, 8 frames, 8 directions, px_per_metre 64, padding 2, max_page 4096, draw_flags SONA_DRAW_NO_BLOOM; every other field 0 (the whole clip, facing the camera first, side on, orthographic, packed and trim<br>Calls [`sona_sheet_defaults`](../c/2d-outputs.md#sona_sheet_defaults). |
| `lighting_defaults()` | sona_lighting_defaults: a key and fill switched off, the built-in environment, a fitted shadow map.<br>Calls [`sona_lighting_defaults`](../c/lighting-and-shadows.md#sona_lighting_defaults). |
| `environment_irradiance(sh9)` | The irradiance the lit shader evaluates for 9 RGB SH coefficients of radiance (27 floats).<br>Calls [`sona_environment_defaults`](../c/lighting-and-shadows.md#sona_environment_defaults), [`sona_environment_irradiance`](../c/lighting-and-shadows.md#sona_environment_irradiance). |
| `style_defaults(kind="original", outline=False, override=False, **fields)` | A sona_style: the defaults, then kind, the OUTLINE and OVERRIDE flags and fields (bands, shade, highlight, outline_px, outline_colour, colour).<br>Calls [`sona_style_defaults`](../c/art-styles.md#sona_style_defaults). |
| `quality_defaults()` | The web SDK's renderer quality: SONA_MSAA_AUTO with MIPS \| CUTOUT_MIPS.<br>Calls [`sona_quality_defaults`](../c/rendering-quality.md#sona_quality_defaults). |
| `section_name(section)` | "shirt", "facialHair",...; None past the last section.<br>Calls [`sona_catalogue_section_name`](../c/the-offline-catalogue.md#sona_catalogue_section_name). |
| `stock_clip(clip)` | A stock clip by name ("wave"), asset id, legacy key ("GenericWave") or id; None when there is none.<br>Calls [`sona_stock_clip_get`](../c/stock-clips.md#sona_stock_clip_get). |
| `stock_clips(tags=(), without=(), body=0)` | Every stock clip with all of tags and none of without that suits body (0 any, 1 male, 2 female), by id.<br>Calls [`sona_stock_clips_tagged`](../c/stock-clips.md#sona_stock_clips_tagged). |
| `stock_clip_for_body(clip, body)` | The clip of this one's family made for body (1 male, 2 female).<br>Calls [`sona_stock_clip_for_body`](../c/stock-clips.md#sona_stock_clip_for_body). |
| `clip_tag_name(bit)` | The name of one tag bit ("idle", "travel",...); NULL for 0, several bits or an unknown bit.<br>Calls [`sona_clip_tag_name`](../c/stock-clips.md#sona_clip_tag_name). |
| `idle_defaults()` | size set, parts SONA_IDLE_ALL, seed 0, amount 1, face_px 240.<br>Calls [`sona_idle_defaults`](../c/stock-clips.md#sona_idle_defaults). |
| `idle_sample(seconds, seed, parts=None)` | The idle's channels at seconds for a seed, before amount: IdleState(blink, gaze, shift, breath).<br>Calls [`sona_idle_sample`](../c/stock-clips.md#sona_idle_sample). |
| `clear_filter(ctx)` | The ctx's filter: a copy of f (NULL takes it away), applied to an avatar when its manifest is read, whoever's it is (sona_avatar_add, headless renders); an avatar read before the change keeps what it wore until it is r<br>Calls [`sona_ctx_set_filter`](../c/content-filters.md#sona_ctx_set_filter). |
| `filter_report(avatar)` | What the ctx's filter changed on an avatar, or None before its manifest is read or when no filter was set.<br>Calls [`sona_avatar_filter_report`](../c/content-filters.md#sona_avatar_filter_report). |
| `view_defaults()` | The web's full-body framing, as a sona_view (fields eye, target, fov_deg, near_z, far_z, width, height).<br>Calls [`sona_view_defaults`](../c/the-frame.md#sona_view_defaults). |
| `camera_orbit(view, target, yaw_deg, pitch_deg, distance)` | Places the eye on an orbit around target.<br>Calls [`sona_camera_orbit`](../c/camera-helpers.md#sona_camera_orbit). |
| `view_matrices(view)` | (view, projection) as 16 floats each, row-vector, D3D depth 0..1.<br>Calls [`sona_view_matrices`](../c/camera-helpers.md#sona_view_matrices). |
| `guid_parse(text)` | Parses the 36-character text form.<br>Calls [`sona_guid_parse`](../c/manifests.md#sona_guid_parse). |
| `guid_format(g)` | The id in its lowercase 36-character form.<br>Calls [`sona_guid_format`](../c/manifests.md#sona_guid_format). |
| `slot_of(g)` | (route, mask): route "rejected", "worn", "bare" or "face".<br>Calls [`sona_slot_of`](../c/manifests.md#sona_slot_of). |
| `base64_decode(text)` | The bytes the base64 text holds.<br>Calls [`sona_base64_decode`](../c/manifests.md#sona_base64_decode). |
| `import_formats()` | The formats this build reads: a set of "gltf", "fbx", "bvh".<br>Calls [`sona_import_formats`](../c/imported-clips.md#sona_import_formats). |
| `shader_source(lang, prog, stage)` | Text or SPIR-V bytes for one program and stage (0 vertex, 1 fragment); None when not in this build.<br>Calls [`sona_shader_source`](../c/the-data-api.md#sona_shader_source). |
| `mask_preset(name)` | 72 weights: "none", "full", "upper_body", "lower_body", "head", "left_arm", "right_arm" or "arms".<br>Calls [`sona_mask_preset`](../c/animation-layers.md#sona_mask_preset). |
| `mask_branch(mask, joint, weight)` | A copy of mask with joint and every joint below it set to weight.<br>Calls [`sona_mask_branch`](../c/animation-layers.md#sona_mask_branch). |
| `phoneme_mouth(symbol)` | The mouth for a phoneme symbol (ARPAbet, IPA, viseme names or ids); None when it is none of them.<br>Calls [`sona_phoneme_mouth`](../c/lip-sync-and-voice-mouths.md#sona_phoneme_mouth). |
| `lipsync_phonemes(phonemes)` | (symbol, start, end) tuples to (time, mouth, open) keys.<br>Calls [`sona_lipsync_phonemes`](../c/lip-sync-and-voice-mouths.md#sona_lipsync_phonemes). |
| `lipsync_text(text, samples=None, sample_rate=48000, s16=False)` | Text to (time, mouth, open) keys, aligned to mono audio when given, else at an even pace.<br>Calls [`sona_lipsync_text`](../c/lip-sync-and-voice-mouths.md#sona_lipsync_text). |
| `mouth_keys_sample(keys, t)` | (mouth, open) at time t of (time, mouth, open) keys.<br>Calls [`sona_mouth_keys_sample`](../c/lip-sync-and-voice-mouths.md#sona_mouth_keys_sample). |
| `headless_devices(backend=None)` | Every device a headless renderer can open: dicts of backend, software, type, vendor_id, device_id, name, driver.<br>Calls [`sona_headless_devices`](../c/headless-rendering-and-video-out.md#sona_headless_devices). |
| `render_defaults()` | 256 x 256, SONA_PRESET_FULL, zoom 1, transparent, no clip.<br>Calls [`sona_render_defaults`](../c/headless-rendering-and-video-out.md#sona_render_defaults). |
| `sequence_defaults()` | The sequence options as sona_sequence_defaults sets them: frames 0 (the clip's length), the default frame rate, no turn.<br>Calls [`sona_sequence_defaults`](../c/headless-rendering-and-video-out.md#sona_sequence_defaults). |
| `video_defaults()` | The defaults are format from the path, a frame rate of 30 fps, opaque black background, every other field 0.<br>Calls [`sona_video_defaults`](../c/headless-rendering-and-video-out.md#sona_video_defaults). |
| `video_formats(ffmpeg=None)` | The formats this machine can write: a subset of {"png", "gif", "mp4", "webm"}.<br>Calls [`sona_video_formats`](../c/headless-rendering-and-video-out.md#sona_video_formats). |
| `players_placeholder()` | The built-in placeholder look: 1000 bytes.<br>Calls [`sona_players_placeholder`](../c/other-players-avatars-by-id.md#sona_players_placeholder). |
| `outfit_check(manifest, maker=None)` | (report dict, OutfitIssue): every issue of a manifest; without a maker the catalogue's checks are left out.<br>Calls [`sona_outfit_check`](../c/making-avatars-in-code.md#sona_outfit_check). |
| `outfit_fix(manifest, maker=None)` | (fixed manifest bytes, report dict after): every error but no_body mended.<br>Calls [`sona_outfit_fix`](../c/making-avatars-in-code.md#sona_outfit_fix). |
| `outfit_clash(a, b, maker=None)` | (SONA_CLASH_* bits, shared slots) by the ids alone, or with a maker by the catalogue too.<br>Calls [`sona_outfit_clash`](../c/making-avatars-in-code.md#sona_outfit_clash). |
| `state_info(blob)` | What a saved state holds, without a context: (info dict, manifest bytes or None).<br>Calls [`sona_state_info_get`](../c/state-sync-and-replays.md#sona_state_info_get). |
| `region_name(region)` | "none", "head", "neck", "torso", "hips", "leftArm", "rightArm", "leftHand", "rightHand", "leftLeg", "rightLeg", "leftFoot", "rightFoot"; NULL past the last.<br>Calls [`sona_region_name`](../c/picking.md#sona_region_name). |
| `view_ray(view, x, y)` | The ray through (x, y) of the view's picture, pixels from its top left: (origin, unit direction).<br>Calls [`sona_view_ray`](../c/picking.md#sona_view_ray). |
| `pick_ray(ctx, origin, direction, flags=0, max_distance=0.0, ignore=())` | The nearest hit along the ray, or None.<br>Calls [`sona_pick_ray`](../c/picking.md#sona_pick_ray). |
| `pick_screen(ctx, view, x, y, flags=0, max_distance=0.0, ignore=())` | The nearest hit under (x, y) of the view's picture, or None.<br>Calls [`sona_pick_screen`](../c/picking.md#sona_pick_screen). |
| `pick_ray_all(ctx, origin, direction, cap=64, flags=0, max_distance=0.0, ignore=())` | Every avatar the ray hits, its nearest hit each, nearest first (at most cap).<br>Calls [`sona_pick_ray_all`](../c/picking.md#sona_pick_ray_all). |
| `avatar_pick(avatar, origin, direction, flags=0, max_distance=0.0)` | The ray against one avatar alone, or None.<br>Calls [`sona_avatar_pick`](../c/picking.md#sona_avatar_pick). |
| `pick_gpu(ctx, renderer, view, x, y, flags=0, max_distance=0.0, ignore=())` | The pick through the id buffer of a renderer (a Headless, or a raw sona_renderer pointer), or None.<br>Calls [`sona_pick_gpu`](../c/picking.md#sona_pick_gpu). |
| `pick_gpu_ids(ctx, renderer, view, x, y, w, h, flags=0)` | The id buffer of a region of the view's picture: (avatar ids, mesh index + 1) as arrays of w * h, row 0 on top.<br>Calls [`sona_pick_gpu_ids`](../c/picking.md#sona_pick_gpu_ids). |
| `prop_options(joint="auto", position=(0, 0, 0), rotation=(0, 0, 0, 1), scale=1.0, hidden=False, play=False, once=False, perform=False, body_scale=True, hand=None, hand_position=(0, 0, 0), hand_rotation=None, hand_pole=None, wrist=False, hand_weight=1.0, fade=0.2, speed=1.0, start=0.0)` | A sona_prop_attach.<br>Calls [`sona_prop_attach_defaults`](../c/props-held-and-worn-objects.md#sona_prop_attach_defaults). |
| `prop_pets()` | The catalogue's pets (the site's pet mode list), as item ids.<br>Calls [`sona_prop_pet_count`](../c/props-held-and-worn-objects.md#sona_prop_pet_count), [`sona_prop_pet`](../c/props-held-and-worn-objects.md#sona_prop_pet). |
| `prop_is_pet(item_id)` | 1 when the item id is one of the pets.<br>Calls [`sona_prop_is_pet`](../c/props-held-and-worn-objects.md#sona_prop_is_pet). |
| `abi()` | The loaded library's ABI: abi, oldest_abi (the oldest a caller may be built against), major, minor, patch.<br>Calls [`sona_abi_query`](../c/the-context.md#sona_abi_query). |
| `emote_from_text(text)` | A sentence to stock clips and a face: dict of clips (SONA_STOCK_* id, weight), speed, confidence, expression (5 parts, 255 leaves one to the clip), and the raw struct for Avatar.emote.<br>Calls [`sona_emote_from_text`](../c/text-to-emote.md#sona_emote_from_text). |
| `tier_defaults()` | size set; target_fps 60, avatars 20.<br>Calls [`sona_tier_defaults`](../c/rendering-quality.md#sona_tier_defaults). |
| `load_library()` | Loads the sona library from SONA_LIB_DIR, then the system's library path. |
| `theme(which="dark", **overrides)` | A theme struct: "dark" or "light", then any field overridden (colours as 0xAARRGGBB).<br>Calls [`sona_editor_theme_defaults`](../c/player-editor.md#sona_editor_theme_defaults). |
| `N_error(r)` | Raises SonaError for a failed sona_result of the editor module. |
| `blendshape_name(i)` | The name of blendshape index ("eyeBlinkLeft",...) as both trackers spell them; NULL past the last.<br>Calls [`sona_track_blendshape_name`](../c/face-tracking.md#sona_track_blendshape_name). |
| `blendshape_find(name)` | The index of a blendshape by name; -1 when unknown.<br>Calls [`sona_track_blendshape_find`](../c/face-tracking.md#sona_track_blendshape_find). |
| `quat_from_matrix(rows)` | A 3x3 (or the upper left of a 4x4) as rows of floats to (x, y, z, w).<br>Calls [`sona_track_quat_from_matrix`](../c/face-tracking.md#sona_track_quat_from_matrix). |
| `quat_from_euler(pitch_deg, yaw_deg, roll_deg)` | Degrees, right-handed about the camera axes: pitch about +X (nodding down is positive), yaw about +Y (turning towards the image's right, the subject's own left, is positive), roll about +Z; applied roll, then pitch, then<br>Calls [`sona_track_quat_from_euler`](../c/face-tracking.md#sona_track_quat_from_euler). |

## SonaError

`class SonaError(Exception)`: code: the sona_result (negative); name: its word ("licence", "gate",...); message; fix.

| Declaration | What it does |
|---|---|
| `__init__(code, message="", fix="")` | Made by the binding when a call returns one; not made by hand. |

## Request

`class Request`: One read in flight.

| Declaration | What it does |
|---|---|
| `__init__(raw)` | Made by the binding when a call returns one; not made by hand. |
| `id()` | The read's id, as the source was given it. |
| `finish(status, data=b"")` | Finishes one read, exactly once, also after cancel; the request stays valid until then.<br>Calls [`sona_complete`](../c/asset-sources.md#sona_complete). |
| `complete(data)` | Finishes one read, exactly once, also after cancel; the request stays valid until then. |
| `not_found()` | Answers the read: the source has no such file (SONA_E_NOT_FOUND). |
| `failed()` | Answers the read: the source failed and a retry may work (SONA_E_IO). |

## FrameStats

`class FrameStats`: The C type sona_frame_stats.

| Declaration | What it does |
|---|---|
| `__init__(s)` | Made by the binding when a call returns one; not made by hand. |

## SceneStats

`class SceneStats`: The C type sona_scene_stats.

| Declaration | What it does |
|---|---|
| `__init__(s)` | Made by the binding when a call returns one; not made by hand. |

## Event

`class Event`: The C type sona_event.

| Declaration | What it does |
|---|---|
| `__init__(e, avatar)` | Made by the binding when a call returns one; not made by hand. |

## Context

`class Context`: sona.Context(app_id=None, licence=path_or_bytes, sources=("dir", path),...).

| Declaration | What it does |
|---|---|
| `__init__(app_id=None, licence=None, sources=(), worker_threads=None, seed=None, max_avatars=None, build_budget_ms=None, face_size=None, flags=0, budget=None, check_host=None, log=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_config_defaults`](../c/the-context.md#sona_config_defaults), [`sona_open`](../c/the-context.md#sona_open). |
| `close()` | Closes a context.<br>Calls [`sona_close`](../c/the-context.md#sona_close). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |
| `app_id()` | The app id this context runs as.<br>Calls [`sona_app_id`](../c/the-context.md#sona_app_id). |
| `add(manifest, clip=None, **opts)` | Queues an avatar from its 1000 manifest bytes.<br>Calls [`sona_avatar_add`](../c/avatars.md#sona_avatar_add). |
| `add_base64(text, clip=None, **opts)` | The same, from base64 text of at most 4096 characters, as the web.<br>Calls [`sona_avatar_add_base64`](../c/avatars.md#sona_avatar_add_base64). |
| `add_state(blob, **opts)` | A new avatar with a saved state's look and state.<br>Calls [`sona_avatar_add_state`](../c/state-sync-and-replays.md#sona_avatar_add_state). |
| `add_waiting(clip=None, **opts)` | An avatar whose manifest is not known: QUEUED, a neutral figure while placeholders are on, until Avatar.set_manifest gives it one.<br>Calls [`sona_avatar_add_waiting`](../c/loading-placeholders.md#sona_avatar_add_waiting). |
| `update(dt, view=None)` | Advances every avatar by dt seconds, builds, culls and poses.<br>Calls [`sona_update`](../c/the-frame.md#sona_update). |
| `events()` | Every waiting event, oldest first.<br>Calls [`sona_poll_event`](../c/events.md#sona_poll_event). |
| `clips()` | How many clips the context knows.<br>Calls [`sona_clip_count`](../c/clips.md#sona_clip_count), [`sona_clip_get`](../c/clips.md#sona_clip_get). |
| `stats()` | The scene statistics.<br>Calls [`sona_stats`](../c/the-frame.md#sona_stats). |
| `shading()` | The fixed shading inputs, or None until the data files load (update and ask again).<br>Calls [`sona_shading_get`](../c/the-data-api.md#sona_shading_get). |
| `credit(scale=1)` | {"text", "url", "width", "height", "rgba"}: the badge, copied.<br>Calls [`sona_credit_get`](../c/credit.md#sona_credit_get). |
| `png_encode(rgba, width, height)` | PNG bytes with the web's three tEXt chunks.<br>Calls [`sona_png_encode`](../c/drawing-with-the-sdks-backends.md#sona_png_encode), [`sona_free`](../c/drawing-with-the-sdks-backends.md#sona_free). |
| `fit_crowd(view)` | Fits every ready avatar in view (the web's preset "crowd").<br>Calls [`sona_camera_fit_crowd`](../c/camera-helpers.md#sona_camera_fit_crowd). |
| `add_item_preview(item_id, gender=0, slot=0, play=False, colours=None, skin=0, priority=0, time=None, margin=None)` | One item worn alone on a grey stand-in body, framed by its slot.<br>Calls [`sona_item_preview_add`](../c/item-previews.md#sona_item_preview_add). |
| `import_clip(anim, key=None, take=None, flags=0, fps=0.0, start=0.0, end=0.0, root_scale=0.0, bone_map=None, tries=600)` | Retargets a take of an AnimFile onto the rig and keeps it here under key (default: the take's name), so avatar.play(key) plays it.<br>Calls [`sona_clip_import`](../c/imported-clips.md#sona_clip_import). |
| `imported_clips()` | How many clips have been imported into the ctx.<br>Calls [`sona_clip_imported_count`](../c/imported-clips.md#sona_clip_imported_count), [`sona_clip_imported_get`](../c/imported-clips.md#sona_clip_imported_get). |
| `remove_imported_clip(key)` | Avatars playing it finish with their own reference; new plays of the key fail with SONA_E_ARGUMENT.<br>Calls [`sona_clip_imported_remove`](../c/imported-clips.md#sona_clip_imported_remove). |
| `sway_world(gravity=(0, -9.81, 0), wind=(0, 0, 0), gust=0.35, gust_seconds=1.5)` | The gravity and wind every swaying avatar of this ctx feels.<br>Calls [`sona_sway_world_defaults`](../c/hair-and-cloth-sway.md#sona_sway_world_defaults), [`sona_sway_world_set`](../c/hair-and-cloth-sway.md#sona_sway_world_set). |
| `set_lod(options=None, **fields)` | Crowd LOD and sprites from the next update.<br>Calls [`sona_lod_set`](../c/crowds-level-of-detail-and-sprites.md#sona_lod_set). |
| `lod()` | The LOD options in use, as a sona_lod_options.<br>Calls [`sona_lod_get`](../c/crowds-level-of-detail-and-sprites.md#sona_lod_get). |
| `lod_stats()` | The level-of-detail statistics: avatars in view at each step, those fading, the baked looks and the bakes of the last draw.<br>Calls [`sona_lod_stats_get`](../c/crowds-level-of-detail-and-sprites.md#sona_lod_stats_get). |
| `set_placeholders(options=None, **fields)` | Loading avatars show a neutral figure until READY (off on a new ctx).<br>Calls [`sona_placeholder_set`](../c/loading-placeholders.md#sona_placeholder_set). |
| `placeholders()` | The options in use, as a sona_placeholder_options; None while placeholders are off.<br>Calls [`sona_placeholder_get`](../c/loading-placeholders.md#sona_placeholder_get). |
| `placeholders_off()` | Figures shown now fade out over appear_seconds.<br>Calls [`sona_placeholder_off`](../c/loading-placeholders.md#sona_placeholder_off). |
| `placeholder_stats()` | Figures in view at the last sona_update (by phase, and how many as sprites), how many were posed and the time that took, and the figure draws of the last sona_draw or sona_snapshot.<br>Calls [`sona_placeholder_stats_get`](../c/loading-placeholders.md#sona_placeholder_stats_get). |
| `param_id(name)` | The id of a parameter name, numbered from 0 in the order first asked for; -1 for a bad name or past 32.<br>Calls [`sona_param_id`](../c/animation-layers.md#sona_param_id). |
| `prop_mesh(parts)` | A prop mesh from triangles.<br>Calls [`sona_prop_part_defaults`](../c/props-held-and-worn-objects.md#sona_prop_part_defaults), [`sona_prop_mesh_create`](../c/props-held-and-worn-objects.md#sona_prop_mesh_create). |
| `prop_mesh_load(data=None, path=None, scale=1.0, center=False, textures=True, scene=-1)` | A glTF 2.0 file as a prop mesh, from bytes (data) or a path.<br>Calls [`sona_prop_load_defaults`](../c/props-held-and-worn-objects.md#sona_prop_load_defaults), [`sona_prop_mesh_open`](../c/props-held-and-worn-objects.md#sona_prop_mesh_open), [`sona_prop_mesh_load`](../c/props-held-and-worn-objects.md#sona_prop_mesh_load). |
| `prop_mesh_stock(item_id)` | A stock prop item (a carryable) of the catalogue; its state is "pending" until it has loaded.<br>Calls [`sona_prop_mesh_stock`](../c/props-held-and-worn-objects.md#sona_prop_mesh_stock). |
| `interaction_layout(kind, a, b=None, **opts)` | Where an interaction would stand its avatars and where the contacts meet, as a dict; None while the avatars (or the stock sit clip) are still loading.<br>Calls [`sona_interaction_layout`](../c/two-avatar-interactions-and-seats.md#sona_interaction_layout). |
| `interaction(kind, a, b=None, **opts)` | Starts one: kind "hold_hands", "high_five", "handshake", "hug" or "sit" (b may be None).<br>Calls [`sona_interaction_start`](../c/two-avatar-interactions-and-seats.md#sona_interaction_start). |
| `blend_space(param_x, samples, param_y=None, unsynced=False, smooth_seconds=0.1)` | samples: (clip, x) or (clip, x, y) or (clip, x, y, speed).<br>Calls [`sona_blend_space_defaults`](../c/animation-layers.md#sona_blend_space_defaults), [`sona_blend_space_create`](../c/animation-layers.md#sona_blend_space_create). |
| `state_machine(states, transitions=(), initial=None)` | states: dicts with name, clip or blend (a BlendSpace), loop (default True), speed.<br>Calls [`sona_state_machine_defaults`](../c/animation-layers.md#sona_state_machine_defaults), [`sona_state_machine_create`](../c/animation-layers.md#sona_state_machine_create). |
| `pixel_art(rgba, width, height, size=32, colours=16, outline=True, thin=False, dither=False, keep_frame=False, outline_colour=0, alpha_cut=0.5, palette=None)` | Crisp pixel art from a straight RGBA8 picture, size pixels tall: (rgba bytes, width, height).<br>Calls [`sona_pixel_art`](../c/2d-outputs.md#sona_pixel_art), [`sona_free`](../c/drawing-with-the-sdks-backends.md#sona_free). |
| `pixel_palette(pictures, colours=16)` | One palette (0xFFRRGGBB, darkest first) for several (rgba, width, height) pictures.<br>Calls [`sona_pixel_palette`](../c/2d-outputs.md#sona_pixel_palette). |

## Interaction

`class Interaction`: A running interaction (Context.interaction).

| Declaration | What it does |
|---|---|
| `__init__(ctx, raw)` | Made by the binding when a call returns one; not made by hand. |
| `end()` | Begins the end phase: letting go, standing up.<br>Calls [`sona_interaction_end`](../c/two-avatar-interactions-and-seats.md#sona_interaction_end). |
| `move(position, turn_deg)` | Moves the place (or the seat) while it runs.<br>Calls [`sona_interaction_move`](../c/two-avatar-interactions-and-seats.md#sona_interaction_move). |
| `status()` | Where an interaction is: its kind and phase, the time in the phase and how far through it, whether the contacts are together, the widest gap at a contact, the clearance between the two bodies (negative: into each other),<br>Calls [`sona_interaction_status_get`](../c/two-avatar-interactions-and-seats.md#sona_interaction_status_get). |
| `events()` | (kind, phase, time, value) since the last call; kind "start", "contact", "hold", "shake", "release", "end" or "cancel".<br>Calls [`sona_interaction_events`](../c/two-avatar-interactions-and-seats.md#sona_interaction_events). |
| `remove()` | Stops at once and frees it: its IK targets go, the avatars stay where they are and keep their clip.<br>Calls [`sona_interaction_remove`](../c/two-avatar-interactions-and-seats.md#sona_interaction_remove). |

## Avatar

`class Avatar`: One avatar.

| Declaration | What it does |
|---|---|
| `__init__(ctx, raw)` | Made by the binding when a call returns one; not made by hand. |
| `id()` | A number unique within the ctx.<br>Calls [`sona_avatar_id`](../c/avatars.md#sona_avatar_id). |
| `state()` | "queued", "loading", "ready", "failed" or "removed".<br>Calls [`sona_avatar_state_of`](../c/avatars.md#sona_avatar_state_of). |
| `ready()` | True once the avatar is built and drawn (sona_avatar_state is READY). |
| `settled()` | True once the avatar is READY or FAILED: nothing more will load for it. |
| `play(clip, loop=True, speed=1.0, start=0.0)` | Plays a clip.<br>Calls [`sona_avatar_play`](../c/avatars.md#sona_avatar_play). |
| `stop()` | Holds the current pose.<br>Calls [`sona_avatar_stop`](../c/avatars.md#sona_avatar_stop). |
| `move(position=(0, 0, 0), turn_deg=0.0, scale=1.0, over_seconds=0.0)` | Moves the avatar to a new placement over over_seconds.<br>Calls [`sona_avatar_move`](../c/avatars.md#sona_avatar_move). |
| `set_visible(visible)` | Shows or hides it.<br>Calls [`sona_avatar_set_visible`](../c/avatars.md#sona_avatar_set_visible). |
| `bounds()` | (centre, radius)<br>Calls [`sona_avatar_bounds`](../c/avatars.md#sona_avatar_bounds). |
| `export(format="vrm", bone_names="unity", name=None, authors=None, licence_url=None, flags=0, thumbnail_png=None)` | The avatar as a.vrm (format "vrm" or "vrm0") or "glb" file: (bytes, report dict).<br>Calls [`sona_export_defaults`](../c/skeleton-maps-and-vrm-export.md#sona_export_defaults), [`sona_export_avatar`](../c/skeleton-maps-and-vrm-export.md#sona_export_avatar), [`sona_free`](../c/drawing-with-the-sdks-backends.md#sona_free). |
| `save_state(look=True)` | The whole state as a blob (bytes); None before READY.<br>Calls [`sona_avatar_save_state`](../c/state-sync-and-replays.md#sona_avatar_save_state), [`sona_free`](../c/drawing-with-the-sdks-backends.md#sona_free). |
| `load_state(blob)` | Puts a saved state on at the next update(s), once READY and its clips are loaded.<br>Calls [`sona_avatar_load_state`](../c/state-sync-and-replays.md#sona_avatar_load_state). |
| `puppet(on=True)` | A puppet's clocks stand still: its clip, layers, fades, moves, IK smoothing and idle change only when a state is put on it.<br>Calls [`sona_avatar_puppet`](../c/state-sync-and-replays.md#sona_avatar_puppet). |
| `state_status()` | {"mode": "live" \| "waiting" \| "puppet", "pending", "missing", "applied"}<br>Calls [`sona_avatar_state_status`](../c/state-sync-and-replays.md#sona_avatar_state_status). |
| `remove()` | Removes the avatar and frees what only it used.<br>Calls [`sona_avatar_remove`](../c/avatars.md#sona_avatar_remove). |
| `pose()` | The pose as of the last update; SonaError "not_ready" before READY.<br>Calls [`sona_pose`](../c/the-data-api.md#sona_pose). |
| `pose_vertices(mesh, space="avatar", normals=False, stride=3)` | CPU skinning of one mesh: (positions, normals or None) as array('f') of vertex_count * stride.<br>Calls [`sona_pose_vertices`](../c/the-data-api.md#sona_pose_vertices). |
| `camera_preset(preset, view=None)` | Sets the view's eye and target to "full", "upper", "bust" or "face" on this ready avatar.<br>Calls [`sona_camera_preset`](../c/camera-helpers.md#sona_camera_preset). |
| `joint_world(joint)` | A joint's world matrix (16 floats, row-vector, metres, placement applied) at the last update.<br>Calls [`sona_joint_world`](../c/game-features.md#sona_joint_world). |
| `override(joint, rotation, weight=1.0, mode="replace")` | A unit quaternion (x, y, z, w) after the clip: "replace" from the rest orientation, "add" on top of the clip's.<br>Calls [`sona_avatar_override`](../c/game-features.md#sona_avatar_override). |
| `clear_overrides()` | Clears every override of the avatar.<br>Calls [`sona_avatar_clear_overrides`](../c/game-features.md#sona_avatar_clear_overrides). |
| `crossfade(clip, seconds, loop=True, speed=1.0, start=0.0)` | play, blending from the current pose over seconds (0: a cut).<br>Calls [`sona_avatar_crossfade`](../c/game-features.md#sona_avatar_crossfade). |
| `queue(clip, fade=0.0, loop=True, speed=1.0, start=0.0)` | Plays clip when the current one ends.<br>Calls [`sona_avatar_queue`](../c/game-features.md#sona_avatar_queue). |
| `queued()` | How many clips are waiting in the queue.<br>Calls [`sona_avatar_queued`](../c/game-features.md#sona_avatar_queued). |
| `ik_target(limb, position=None, rotation=None, pole=None, joint=None, space="world", wrist=False, weight=1.0, fade=0.2)` | A hand or foot target.<br>Calls [`sona_avatar_ik_target`](../c/inverse-kinematics.md#sona_avatar_ik_target), [`sona_ik_target_defaults`](../c/inverse-kinematics.md#sona_ik_target_defaults). |
| `ik_feet(ground="plane", plane=(0, 1, 0, 0), query=None, weight=1.0, max_hips_offset=0.45, max_tilt_deg=35, smoothing=0.1)` | Foot planting.<br>Calls [`sona_avatar_ik_feet`](../c/inverse-kinematics.md#sona_avatar_ik_feet), [`sona_ik_feet_defaults`](../c/inverse-kinematics.md#sona_ik_feet_defaults). |
| `ik_ground(foot, point=None, normal=(0, 1, 0))` | POINTS: the ground under "left_foot" or "right_foot" (or 2, 3); point None: no ground there.<br>Calls [`sona_avatar_ik_ground`](../c/inverse-kinematics.md#sona_avatar_ik_ground). |
| `ik_look(target=None, head=True, eyes=True, weight=1.0, **limits)` | Look at a world point; target None eases back to the clip.<br>Calls [`sona_avatar_ik_look`](../c/inverse-kinematics.md#sona_avatar_ik_look), [`sona_ik_look_defaults`](../c/inverse-kinematics.md#sona_ik_look_defaults). |
| `style()` | The avatar's own art style (sona_style; the defaults when it has none).<br>Calls [`sona_avatar_style`](../c/art-styles.md#sona_avatar_style). |
| `set_style(kind=None, outline=False, **fields)` | Its own art style: kind "original", "toon", "flat", "silhouette" or "promo" (None: none, the renderer's applies); outline draws an outline; fields: bands, shade, highlight, outline_px, outline_colour, colour (0xAARRGGBB)<br>Calls [`sona_avatar_set_style`](../c/art-styles.md#sona_avatar_set_style). |
| `ik_limits(body=True, **fields)` | Joint limits (elbow_max_deg, knee_max_deg, wrist_swing_deg,...); no fields: the defaults.<br>Calls [`sona_ik_limits_defaults`](../c/inverse-kinematics.md#sona_ik_limits_defaults), [`sona_avatar_ik_limits`](../c/inverse-kinematics.md#sona_avatar_ik_limits). |
| `ik_clear()` | Every target, the planting and the look-at off at once.<br>Calls [`sona_avatar_ik_clear`](../c/inverse-kinematics.md#sona_avatar_ik_clear). |
| `set_placeholder(mode)` | Its loading placeholder: -1 follows the ctx, 0 never, 1 always.<br>Calls [`sona_avatar_placeholder`](../c/loading-placeholders.md#sona_avatar_placeholder). |
| `placeholder()` | Its loading placeholder now, as a dict: phase, opacity, height, gender, clip, seconds, sprite.<br>Calls [`sona_avatar_placeholder_info`](../c/loading-placeholders.md#sona_avatar_placeholder_info). |
| `set_manifest(manifest)` | The manifest of an avatar added with Context.add_waiting, once (1000 bytes or base64 text).<br>Calls [`sona_avatar_set_manifest_base64`](../c/loading-placeholders.md#sona_avatar_set_manifest_base64), [`sona_avatar_set_manifest`](../c/loading-placeholders.md#sona_avatar_set_manifest). |
| `ik_status()` | What the last pose did, as a dict; None before the avatar was posed with IK on.<br>Calls [`sona_avatar_ik_status`](../c/inverse-kinematics.md#sona_avatar_ik_status). |
| `prop_attach(mesh, **opts)` | Attaches a PropMesh; returns its id on this avatar.<br>Calls [`sona_avatar_prop_attach`](../c/props-held-and-worn-objects.md#sona_avatar_prop_attach). |
| `prop_set(prop_id, **opts)` | New placement, flags or hand for an attached prop (each frame for one that moves on the joint).<br>Calls [`sona_avatar_prop_set`](../c/props-held-and-worn-objects.md#sona_avatar_prop_set). |
| `prop_swap(prop_id, mesh)` | Another mesh in the same place: a sword for a stick, an item for a placeholder.<br>Calls [`sona_avatar_prop_swap`](../c/props-held-and-worn-objects.md#sona_avatar_prop_swap). |
| `prop_detach(prop_id)` | Takes the prop off at once (its hand's IK target eases off).<br>Calls [`sona_avatar_prop_detach`](../c/props-held-and-worn-objects.md#sona_avatar_prop_detach). |
| `prop_detach_all()` | Takes every prop off the avatar at once.<br>Calls [`sona_avatar_prop_detach_all`](../c/props-held-and-worn-objects.md#sona_avatar_prop_detach_all). |
| `props()` | The ids of the avatar's props, in attach order.<br>Calls [`sona_avatar_prop_list`](../c/props-held-and-worn-objects.md#sona_avatar_prop_list). |
| `prop_frame(prop_id)` | dict: flags ("posed", "ready", "drawn"), joint, time, world and avatar (16 floats, row-vector), hand_error, joints, palette (joints * 12 floats, avatar space).<br>Calls [`sona_avatar_prop_frame`](../c/props-held-and-worn-objects.md#sona_avatar_prop_frame). |
| `ragdoll(all_capsules=False, rest_pose=False, total_mass=0.0, coverage=0.9, limits=None)` | The 16 bodies fitted to this avatar now, as dicts: joint, parent, shape, colliders, mass and the joint to the parent (frames and limits).<br>Calls [`sona_ragdoll_defaults`](../c/ragdolls.md#sona_ragdoll_defaults), [`sona_ik_limits_defaults`](../c/inverse-kinematics.md#sona_ik_limits_defaults), [`sona_avatar_ragdoll`](../c/ragdolls.md#sona_avatar_ragdoll). |
| `ragdoll_state()` | The bodies at the last pose: position, rotation, velocity and angular_velocity tuples; None before ragdoll.<br>Calls [`sona_avatar_ragdoll_state`](../c/ragdolls.md#sona_avatar_ragdoll_state). |
| `ragdoll_drive(bodies, weight=1.0, keep_lengths=False)` | The host's bodies onto the avatar: 16 (position, rotation) pairs or ragdoll_state dicts; None stops.<br>Calls [`sona_avatar_ragdoll_drive`](../c/ragdolls.md#sona_avatar_ragdoll_drive). |
| `ragdoll_release(blend_seconds=0.5)` | Back to the animation: the last drawn ragdoll pose stays where it is in the world and blends into the clip's pose over blend_seconds (smoothstep; 0: at once), turn by turn down the body, so limbs stay joined.<br>Calls [`sona_avatar_ragdoll_release`](../c/ragdolls.md#sona_avatar_ragdoll_release). |
| `ragdoll_info()` | mode, weight, blend_left, face_up, hips, lowest, getup_position, getup_turn_deg; None before a pose.<br>Calls [`sona_avatar_ragdoll_info`](../c/ragdolls.md#sona_avatar_ragdoll_info). |
| `ragdoll_clear()` | Off at once: no tracking, no drive, no blend.<br>Calls [`sona_avatar_ragdoll_clear`](../c/ragdolls.md#sona_avatar_ragdoll_clear). |
| `sway(on=True, parts=None, quality="medium", **fields)` | Hair and cloth sway.<br>Calls [`sona_avatar_sway`](../c/hair-and-cloth-sway.md#sona_avatar_sway), [`sona_sway_defaults`](../c/hair-and-cloth-sway.md#sona_sway_defaults). |
| `sway_reset()` | Back to the modelled shape, at rest, at the next pose.<br>Calls [`sona_avatar_sway_reset`](../c/hair-and-cloth-sway.md#sona_avatar_sway_reset). |
| `sway_info()` | What sways on this avatar and what the last pose did, as a dict; None before READY.<br>Calls [`sona_avatar_sway_info`](../c/hair-and-cloth-sway.md#sona_avatar_sway_info). |
| `sway_mesh_parts(mesh)` | The SONA_SWAY_* kinds one of sona_pose's meshes sways with; 0 for one that does not, a bad index, or an avatar with sway off or not READY.<br>Calls [`sona_avatar_sway_mesh_parts`](../c/hair-and-cloth-sway.md#sona_avatar_sway_mesh_parts). |
| `capsule()` | (a, b, radius): a vertical capsule around the posed body, in world space.<br>Calls [`sona_avatar_capsule`](../c/game-features.md#sona_avatar_capsule). |
| `expression(values)` | mouth, left eyebrow, right eyebrow, left eye, right eye: shape indexes, None (or 255) for the clip's.<br>Calls [`sona_avatar_expression`](../c/game-features.md#sona_avatar_expression). |
| `mouth(shape)` | Only the mouth: a SONA_MOUTH_* or shape index, or None (255) to hand it back to the clip.<br>Calls [`sona_avatar_mouth`](../c/lip-sync-and-voice-mouths.md#sona_avatar_mouth). |
| `voice(state, level, dt)` | Voice chat: a VoiceMouth state for this speaker, its audio level (linear RMS) and the time step.<br>Calls [`sona_avatar_voice`](../c/lip-sync-and-voice-mouths.md#sona_avatar_voice). |
| `expression_counts()` | (mouths, eyebrows, eyes): how many shapes this face has.<br>Calls [`sona_avatar_expression_counts`](../c/game-features.md#sona_avatar_expression_counts). |
| `clip_events()` | Every clip event since the last call, oldest first.<br>Calls [`sona_avatar_clip_events`](../c/game-features.md#sona_avatar_clip_events). |
| `mark(seconds, mark_id)` | A "mark" clip event with this id each time the current clip passes seconds.<br>Calls [`sona_avatar_mark`](../c/game-features.md#sona_avatar_mark). |
| `clear_marks()` | Removes the avatar's marks.<br>Calls [`sona_avatar_clear_marks`](../c/game-features.md#sona_avatar_clear_marks). |
| `root_motion(mode)` | "off", "extract" (collect the travel for take_root_motion) or "apply" (move the placement by it).<br>Calls [`sona_avatar_root_motion`](../c/game-features.md#sona_avatar_root_motion). |
| `take_root_motion()` | (x, y, z): the travel since the last call, in world metres; clears it.<br>Calls [`sona_avatar_take_root_motion`](../c/game-features.md#sona_avatar_take_root_motion). |
| `lod()` | (step, fade): "full", "sampled", "quarter" or "sprite" at the last update, and mesh (0) to sprite (1).<br>Calls [`sona_avatar_lod`](../c/crowds-level-of-detail-and-sprites.md#sona_avatar_lod). |
| `play_stock(clip, fade=0.0, loop=None, speed=1.0, start=0.0)` | A stock clip (a name, an id or a StockClip), the variant for this avatar's body; fade > 0 crossfades.<br>Calls [`sona_avatar_play_stock`](../c/stock-clips.md#sona_avatar_play_stock). |
| `idle(on=True, parts=None, seed=0, amount=1.0, face_px=240.0)` | The procedural idle: blinks, glances, weight shifts and breathing over any clip.<br>Calls [`sona_avatar_idle`](../c/stock-clips.md#sona_avatar_idle). |
| `idle_options()` | The idle's options in use (seed resolved); parts 0 when off.<br>Calls [`sona_avatar_idle_get`](../c/stock-clips.md#sona_avatar_idle_get). |
| `idle_state()` | What the idle gave the last pose: IdleState(blink, gaze, shift, breath).<br>Calls [`sona_avatar_idle_state`](../c/stock-clips.md#sona_avatar_idle_state). |
| `layer_play(layer, clip, **opts)` | Plays a clip on a layer (0..7).<br>Calls [`sona_avatar_layer_play`](../c/animation-layers.md#sona_avatar_layer_play). |
| `layer_blend(layer, blend, **opts)` | Plays a blend space of the same ctx on the layer.<br>Calls [`sona_avatar_layer_blend`](../c/animation-layers.md#sona_avatar_layer_blend). |
| `layer_machine(layer, machine, **opts)` | Runs a state machine of the same ctx on the layer from its initial state (a STATE event with from_state -1).<br>Calls [`sona_avatar_layer_machine`](../c/animation-layers.md#sona_avatar_layer_machine). |
| `layer_goto(layer, state, fade_seconds=0.2)` | Sends a machine layer to state now, crossfading over fade_seconds.<br>Calls [`sona_avatar_layer_goto`](../c/animation-layers.md#sona_avatar_layer_goto). |
| `layer_weight(layer, weight, over_seconds=0.0)` | Moves the layer's weight linearly to weight (0..1) over over_seconds; 0 or less sets it at once.<br>Calls [`sona_avatar_layer_weight`](../c/animation-layers.md#sona_avatar_layer_weight). |
| `layer_mask(layer, mask)` | 72 weights 0..1, or None for every joint.<br>Calls [`sona_avatar_layer_mask`](../c/animation-layers.md#sona_avatar_layer_mask). |
| `layer_stop(layer, fade_seconds=0.2)` | Fades the layer out over fade_seconds and then empties it (a STOPPED event); 0 empties it now.<br>Calls [`sona_avatar_layer_stop`](../c/animation-layers.md#sona_avatar_layer_stop). |
| `layer_info(layer)` | The layer now: kind, mode, state (machines, else -1), clip (the sona_clip_get index, -1 for a raw id), weight with fades, time and normalized through the clip or cycle, ready (its clips have loaded) and<br>Calls [`sona_avatar_layer_info`](../c/animation-layers.md#sona_avatar_layer_info). |
| `layer_events()` | Every layer event since the last call, oldest first.<br>Calls [`sona_avatar_layer_events`](../c/animation-layers.md#sona_avatar_layer_events). |
| `set_param(param, value)` | Sets one parameter on the avatar; read at the next sona_update.<br>Calls [`sona_avatar_set_param`](../c/animation-layers.md#sona_avatar_set_param). |
| `set_params(first, values)` | Parameters first..<br>Calls [`sona_avatar_set_params`](../c/animation-layers.md#sona_avatar_set_params). |
| `param(param)` | A parameter's value; 0 when unset or unknown.<br>Calls [`sona_avatar_param`](../c/animation-layers.md#sona_avatar_param). |
| `preview_bounds()` | (lo, hi): the item's world box.<br>Calls [`sona_item_preview_bounds`](../c/item-previews.md#sona_item_preview_bounds). |
| `preview_view(width, height)` | The framed camera for a width x height picture, as a sona_view.<br>Calls [`sona_item_preview_view`](../c/item-previews.md#sona_item_preview_view). |

## ClipEvent

`class ClipEvent`: kind: "started", "looped", "ended", "foot_left", "foot_right" or "mark"; mark: its id; clip: the clips index (-1 for a prop or raw clip); time: seconds into the clip.

| Declaration | What it does |
|---|---|
| `__init__(e)` | Made by the binding when a call returns one; not made by hand. |

## LodStats

`class LodStats`: The C type sona_lod_stats.

| Declaration | What it does |
|---|---|
| `__init__(s)` | Made by the binding when a call returns one; not made by hand. |

## StockClip

`class StockClip`: One stock clip, copied: id (its SONA_STOCK_* number), name, family, asset_id, caption, tags (names), body (1 male, 2 female, 3 both), frames, fps, seconds, same_as (an id or 0).

| Declaration | What it does |
|---|---|
| `__init__(c)` | Made by the binding when a call returns one; not made by hand. |

## IdleState

`class IdleState`: The C type sona_idle_state.

| Declaration | What it does |
|---|---|
| `__init__(s)` | Made by the binding when a call returns one; not made by hand. |

## Item

`class Item`: One catalogue item, copied: guid, id, kind, gender, section (a name), mask, flags, route, colour_set, name, game, type, family, description, subcategory, colour_choices, texture_type, shape_type.

| Declaration | What it does |
|---|---|
| `__init__(i)` | Made by the binding when a call returns one; not made by hand. |

## Catalogue

`class Catalogue`: sona-catalogue.bin, from a path or its bytes.

| Declaration | What it does |
|---|---|
| `__init__(source, ctx=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_catalogue_load_memory`](../c/the-offline-catalogue.md#sona_catalogue_load_memory), [`sona_catalogue_load`](../c/the-offline-catalogue.md#sona_catalogue_load). |
| `close()` | Frees it and every string it handed out.<br>Calls [`sona_catalogue_free`](../c/the-offline-catalogue.md#sona_catalogue_free). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |
| `__len__()` | Items, sorted by id.<br>Calls [`sona_catalogue_count`](../c/the-offline-catalogue.md#sona_catalogue_count). |
| `get(index)` | One item.<br>Calls [`sona_catalogue_get`](../c/the-offline-catalogue.md#sona_catalogue_get). |
| `__getitem__(index)` | The item at an index (sona_catalogue_get). |
| `__iter__()` | Every item, in the catalogue's order. |
| `find(item)` | The index of an item id (text in any spelling, or a Guid), or -1.<br>Calls [`sona_catalogue_find`](../c/the-offline-catalogue.md#sona_catalogue_find), [`sona_catalogue_find_guid`](../c/the-offline-catalogue.md#sona_catalogue_find_guid). |
| `search(text=None, game=None, slots=0, section=0, gender=0, require=0, exclude=0, offset=0, limit=None)` | (indexes, total): matches in id order, up to limit (None: all) after offset; total counts every match.<br>Calls [`sona_catalogue_search`](../c/the-offline-catalogue.md#sona_catalogue_search). |
| `games()` | (name, items) sorted by name: the games and sources items come from.<br>Calls [`sona_catalogue_game_count`](../c/the-offline-catalogue.md#sona_catalogue_game_count), [`sona_catalogue_game`](../c/the-offline-catalogue.md#sona_catalogue_game). |
| `generated()` | When its data was made, ISO 8601.<br>Calls [`sona_catalogue_generated`](../c/the-offline-catalogue.md#sona_catalogue_generated). |

## FilterChange

`class FilterChange`: One change a filter made: from_id, to_id (None when hidden or for the head's own shape), action ("replaced" or "hidden"), reason (SONA_CONTENT_BY_*), tag (a name or None) and section (a name).

| Declaration | What it does |
|---|---|
| `__init__(c, tag_name)` | Made by the binding when a call returns one; not made by hand. |

## Filter

`class Filter`: Which items a game allows: by section, slot, game, tag, source or item id.

| Declaration | What it does |
|---|---|
| `__init__(catalogue=None, ctx=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_filter_create`](../c/content-filters.md#sona_filter_create). |
| `close()` | Frees the filter.<br>Calls [`sona_filter_free`](../c/content-filters.md#sona_filter_free). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |
| `preset(*names)` | "family", "no-logos", "no-licensed".<br>Calls [`sona_filter_preset`](../c/content-filters.md#sona_filter_preset). |
| `reset()` | Every rule goes; tags stay.<br>Calls [`sona_filter_reset`](../c/content-filters.md#sona_filter_reset). |
| `sections(*sections, allow=False)` | Adds a rule on sections: bits (1u << sona_section).<br>Calls [`sona_filter_sections`](../c/content-filters.md#sona_filter_sections). |
| `slots(mask, allow=False)` | Adds a rule on slots (AssetMask bits): an item matches when it covers any of them.<br>Calls [`sona_filter_slots`](../c/content-filters.md#sona_filter_slots). |
| `sources(bits, allow=False)` | Adds a rule on where items come from (SONA_CONTENT_STOCK and the other source bits).<br>Calls [`sona_filter_sources`](../c/content-filters.md#sona_filter_sources). |
| `game(name, allow=False)` | A game as sona_catalogue_game names it (ASCII case folded).<br>Calls [`sona_filter_game`](../c/content-filters.md#sona_filter_game). |
| `tag(name, allow=False)` | A tag by name ("weapon", "logo", or one the host defined).<br>Calls [`sona_filter_tag`](../c/content-filters.md#sona_filter_tag). |
| `item(item, allow=False)` | Adds a rule on one item by id.<br>Calls [`sona_filter_item`](../c/content-filters.md#sona_filter_item). |
| `load(json_text)` | Rules from JSON ([Content filters](../../guides/filters.md)); all or nothing.<br>Calls [`sona_filter_load`](../c/content-filters.md#sona_filter_load). |
| `allowed_count()` | Catalogue items allowed.<br>Calls [`sona_filter_allowed_count`](../c/content-filters.md#sona_filter_allowed_count). |
| `tags()` | (name, catalogue items carrying it) for every tag.<br>Calls [`sona_filter_tag_name`](../c/content-filters.md#sona_filter_tag_name), [`sona_filter_tag_items`](../c/content-filters.md#sona_filter_tag_items), [`sona_filter_tag_count`](../c/content-filters.md#sona_filter_tag_count). |
| `tag_name(tag)` | NULL past the last.<br>Calls [`sona_filter_tag_name`](../c/content-filters.md#sona_filter_tag_name). |
| `define_tag(name)` | A new tag (a name of 1 to 31 bytes of a-z, 0-9 and '-'), or the index of the one of that name.<br>Calls [`sona_filter_tag_define`](../c/content-filters.md#sona_filter_tag_define). |
| `set_tag(item, tag, on=True)` | -1 when unknown.<br>Calls [`sona_filter_tag_find`](../c/content-filters.md#sona_filter_tag_find), [`sona_filter_tag_set`](../c/content-filters.md#sona_filter_tag_set). |
| `item_tags(item)` | The names of an item's tags.<br>Calls [`sona_filter_item_tags`](../c/content-filters.md#sona_filter_item_tags). |
| `allows(item)` | 1 when the item is allowed; a NULL filter allows everything.<br>Calls [`sona_filter_allows`](../c/content-filters.md#sona_filter_allows). |
| `check(item)` | The verdict: a sona_filter_verdict (allowed, reason, tag, index, section, source, tags).<br>Calls [`sona_filter_check`](../c/content-filters.md#sona_filter_check). |
| `search(catalogue, section=0, limit=None)` | (indexes, total) of allowed catalogue items, optionally of one section.<br>Calls [`sona_filter_search`](../c/content-filters.md#sona_filter_search). |
| `filter_manifest(manifest)` | (new 1000 bytes, FilterChange): the manifest through the filter; the same bytes when nothing is denied.<br>Calls [`sona_filter_manifest_bytes`](../c/content-filters.md#sona_filter_manifest_bytes). |
| `apply_to(ctx)` | Gives ctx a copy: every avatar it reads from then on goes through it.<br>Calls [`sona_ctx_set_filter`](../c/content-filters.md#sona_ctx_set_filter). |

## Mesh

`class Mesh`: The runtime vertex, 76 bytes, in host byte order: +0 float3 position (bind pose, avatar space) +12 uint8 x4 joint index * 3 (the palette's float4 row) +16 uint8 x4 weight (sum 255) +20 uint8 x4 normal, (n * 0.5 + 0.5) *  The C type sona_mesh.

| Declaration | What it does |
|---|---|
| `__init__(m)` | Made by the binding when a call returns one; not made by hand. |

## Material

`class Material`: Address modes: bit 0 set = U wraps, bit 1 set = V wraps; clear = clamp. The C type sona_material.

| Declaration | What it does |
|---|---|
| `__init__(m)` | Made by the binding when a call returns one; not made by hand. |

## Texture

`class Texture`: The C type sona_texture.

| Declaration | What it does |
|---|---|
| `__init__(t)` | Made by the binding when a call returns one; not made by hand. |

## Prop

`class Prop`: A prop the avatar holds this frame: its item, palette and whether it plays (sona_prop_palette).

| Declaration | What it does |
|---|---|
| `__init__(p)` | Made by the binding when a call returns one; not made by hand. |

## Pose

`class Pose`: Plain objects over sona_pose_data.

| Declaration | What it does |
|---|---|
| `__init__(ctx, p)` | Made by the binding when a call returns one; not made by hand. |
| `valid()` | False once an update, remove or close has happened since this pose was taken. |

## Manifest

`class Manifest`: An avatar's description (raw: the sona_manifest struct) and its edit verbs: wear, take off, colours, gender, body shape.

| Declaration | What it does |
|---|---|
| `__init__(data)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_manifest_parse`](../c/manifests.md#sona_manifest_parse). |
| `to_bytes()` | The manifest as its 1,000 bytes.<br>Calls [`sona_manifest_write`](../c/manifests.md#sona_manifest_write). |
| `gender()` | Derived: 1 male, 2 female, 0 unknown. The C field sona_manifest.gender (one of the values named in the header). |
| `valid()` | Derived: IsValid. The C field sona_manifest.valid (flag (0 or 1)). |
| `wear(item, colours=(0, 0, 0), flags=0)` | Puts an item on, with its three colours.<br>Calls [`sona_manifest_wear`](../c/manifests.md#sona_manifest_wear). |
| `unwear(slot_mask, flags=0)` | Takes off what is in the slots of slot_mask.<br>Calls [`sona_manifest_unwear`](../c/manifests.md#sona_manifest_unwear). |
| `undress_all()` | Takes everything off.<br>Calls [`sona_manifest_undress_all`](../c/manifests.md#sona_manifest_undress_all). |
| `set_colour(slot, argb)` | Sets one of the nine body colours, by its index in colours.<br>Calls [`sona_manifest_set_colour`](../c/manifests.md#sona_manifest_set_colour). |
| `set_gender(gender, flags=0)` | Sets the gender: 1 male, 2 female.<br>Calls [`sona_manifest_set_gender`](../c/manifests.md#sona_manifest_set_gender). |
| `set_shape(weight, height)` | Sets the weight and height.<br>Calls [`sona_manifest_set_shape`](../c/manifests.md#sona_manifest_set_shape). |
| `ready_for_xbox()` | 1 when the body (and so the gender) is known and the editor's Xbox clean-up would change nothing: the manifest can be saved to Xbox as it is.<br>Calls [`sona_manifest_ready_for_xbox`](../c/manifests.md#sona_manifest_ready_for_xbox). |

## AnimFile

`class AnimFile`: A glTF, FBX or BVH clip file, parsed (no ctx).

| Declaration | What it does |
|---|---|
| `__init__(data=None, path=None, bone_map=None, flags=0, fmt=0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_anim_file_open`](../c/imported-clips.md#sona_anim_file_open), [`sona_anim_file_load`](../c/imported-clips.md#sona_anim_file_load). |
| `takes()` | How many takes (animations) the file holds.<br>Calls [`sona_anim_file_takes`](../c/imported-clips.md#sona_anim_file_takes), [`sona_anim_file_take`](../c/imported-clips.md#sona_anim_file_take). |
| `bones()` | (name, parent index or -1, the avatar joint it drives or None) per bone.<br>Calls [`sona_anim_file_bones`](../c/imported-clips.md#sona_anim_file_bones), [`sona_anim_file_bone`](../c/imported-clips.md#sona_anim_file_bone). |
| `close()` | Imported clips do not need the file once sona_clip_import returned.<br>Calls [`sona_anim_file_free`](../c/imported-clips.md#sona_anim_file_free). |

## BlendSpace

`class BlendSpace`: A blend space of one context (Context.blend_space).

| Declaration | What it does |
|---|---|
| `__init__(ctx, raw, n)` | Made by the binding when a call returns one; not made by hand. |
| `weights(x, y=0.0)` | Each sample's weight at (x, y), a list that sums to 1; y is ignored in 1D.<br>Calls [`sona_blend_space_weights`](../c/animation-layers.md#sona_blend_space_weights). |
| `destroy()` | Lets go of the host's handle.<br>Calls [`sona_blend_space_destroy`](../c/animation-layers.md#sona_blend_space_destroy). |

## StateMachine

`class StateMachine`: A state machine of one context (Context.state_machine).

| Declaration | What it does |
|---|---|
| `__init__(ctx, raw)` | Made by the binding when a call returns one; not made by hand. |
| `find(state)` | A state's index by name, -1 if unknown.<br>Calls [`sona_state_machine_find`](../c/animation-layers.md#sona_state_machine_find). |
| `state_name(state)` | A state's name, NULL past the last.<br>Calls [`sona_state_machine_state_name`](../c/animation-layers.md#sona_state_machine_state_name). |
| `destroy()` | As sona_blend_space_destroy.<br>Calls [`sona_state_machine_destroy`](../c/animation-layers.md#sona_state_machine_destroy). |

## LayerInfo

`class LayerInfo`: kind: "empty", "clip", "blend" or "machine"; mode: "override" or "additive"; state (machines, else -1); clip; weight; time; normalized; ready; fading.

| Declaration | What it does |
|---|---|
| `__init__(i)` | Made by the binding when a call returns one; not made by hand. |

## LayerEvent

`class LayerEvent`: kind: "started", "looped", "ended", "state" or "stopped"; layer; state and from_state (machines); time.

| Declaration | What it does |
|---|---|
| `__init__(e)` | Made by the binding when a call returns one; not made by hand. |

## LipSyncFrame

`class LipSyncFrame`: One step of the lip sync analysis: time, mouth (SONA_MOUTH_*), open, level in dB, the shape weights, the two formants and flags (sona_lipsync_frame).

| Declaration | What it does |
|---|---|
| `__init__(f)` | Made by the binding when a call returns one; not made by hand. |

## LipSync

`class LipSync`: Audio in, mouths out: feed PCM in any chunks, a frame every 10 ms.

| Declaration | What it does |
|---|---|
| `__init__(sample_rate=48000, channels=1, s16=False)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_lipsync_create`](../c/lip-sync-and-voice-mouths.md#sona_lipsync_create). |
| `feed(samples)` | frames: samples per channel.<br>Calls [`sona_lipsync_feed`](../c/lip-sync-and-voice-mouths.md#sona_lipsync_feed). |
| `read()` | The frames made since the last read, oldest first.<br>Calls [`sona_lipsync_read`](../c/lip-sync-and-voice-mouths.md#sona_lipsync_read). |
| `current()` | The newest frame (a shut mouth before the first).<br>Calls [`sona_lipsync_current`](../c/lip-sync-and-voice-mouths.md#sona_lipsync_current). |
| `latency()` | Seconds from a sample being fed to the first frame that hears it.<br>Calls [`sona_lipsync_latency`](../c/lip-sync-and-voice-mouths.md#sona_lipsync_latency). |
| `hint(phonemes)` | (symbol, start, end) tuples a TTS reported, on the fed audio's clock.<br>Calls [`sona_lipsync_hint`](../c/lip-sync-and-voice-mouths.md#sona_lipsync_hint). |
| `reset()` | Back to time 0: hints and frames waiting to be read are dropped.<br>Calls [`sona_lipsync_reset`](../c/lip-sync-and-voice-mouths.md#sona_lipsync_reset). |
| `close()` | Frees the analyser.<br>Calls [`sona_lipsync_destroy`](../c/lip-sync-and-voice-mouths.md#sona_lipsync_destroy). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |

## VoiceMouth

`class VoiceMouth`: Voice chat: one speaker's mouth from its audio level alone.

| Declaration | What it does |
|---|---|
| `__init__(seed=0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_voice_mouth_init`](../c/lip-sync-and-voice-mouths.md#sona_voice_mouth_init). |
| `step(level, dt)` | (mouth, open) after dt seconds at this level (linear RMS).<br>Calls [`sona_voice_mouth_step`](../c/lip-sync-and-voice-mouths.md#sona_voice_mouth_step). |

## Headless

`class Headless`: A renderer on the library's own device: the best GPU, or lavapipe or llvmpipe.

| Declaration | What it does |
|---|---|
| `__init__(ctx, device="auto", backend=None, adapter=-1, validation=False, batch_in_flight=8, wait_seconds=60)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_headless_open`](../c/headless-rendering-and-video-out.md#sona_headless_open). |
| `close()` | Frees the renderer and the device.<br>Calls [`sona_headless_close`](../c/headless-rendering-and-video-out.md#sona_headless_close). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |
| `style()` | The art style of every avatar without its own; None when the device's backend draws no styles.<br>Calls [`sona_renderer_style`](../c/art-styles.md#sona_renderer_style), [`sona_headless_renderer`](../c/headless-rendering-and-video-out.md#sona_headless_renderer). |
| `set_style(kind=None, outline=False, override=False, **fields)` | The art style of every avatar without its own (override: of every avatar); kind None clears it.<br>Calls [`sona_renderer_set_style`](../c/art-styles.md#sona_renderer_set_style), [`sona_headless_renderer`](../c/headless-rendering-and-video-out.md#sona_headless_renderer). |
| `info()` | The device it drew on.<br>Calls [`sona_headless_info_get`](../c/headless-rendering-and-video-out.md#sona_headless_info_get). |
| `set_lighting(lighting=None)` | The host's lights from the next picture (lighting_defaults to start from); None: the original look.<br>Calls [`sona_headless_renderer`](../c/headless-rendering-and-video-out.md#sona_headless_renderer), [`sona_renderer_set_lighting`](../c/lighting-and-shadows.md#sona_renderer_set_lighting). |
| `set_environment_sh(sh9=None, skin_red=1.2)` | The lit avatars' environment as 9 RGB SH coefficients of radiance; None: the built-in cube.<br>Calls [`sona_headless_renderer`](../c/headless-rendering-and-video-out.md#sona_headless_renderer), [`sona_renderer_set_environment`](../c/lighting-and-shadows.md#sona_renderer_set_environment), [`sona_environment_defaults`](../c/lighting-and-shadows.md#sona_environment_defaults). |
| `shadow_map()` | The renderer's own shadow map after its last lit picture with shadows (sona_shadow_map), or None.<br>Calls [`sona_renderer_shadow_map`](../c/lighting-and-shadows.md#sona_renderer_shadow_map), [`sona_headless_renderer`](../c/headless-rendering-and-video-out.md#sona_headless_renderer). |
| `render(avatar, **opts)` | One picture of an avatar of the context, alone.<br>Calls [`sona_headless_render`](../c/headless-rendering-and-video-out.md#sona_headless_render). |
| `render_manifest(manifest, **opts)` | Adds the avatar (hidden, standing still or playing clip from time), draws it and removes it.<br>Calls [`sona_headless_render_manifest`](../c/headless-rendering-and-video-out.md#sona_headless_render_manifest). |
| `batch(manifests, **opts)` | A list of (result, rgba bytes or None), one per manifest, in order.<br>Calls [`sona_headless_batch`](../c/headless-rendering-and-video-out.md#sona_headless_batch). |
| `sequence(avatar, frames=0, fps=30.0, turn_deg=0.0, orbit=False, **opts)` | Every frame as bytes: frame i at the clip's start + i / fps, turned turn_deg * i / frames.<br>Calls [`sona_headless_sequence`](../c/headless-rendering-and-video-out.md#sona_headless_sequence). |
| `record(avatar, video, frames=0, fps=30.0, turn_deg=0.0, orbit=False, **opts)` | sona_headless_sequence into a video.<br>Calls [`sona_headless_record`](../c/headless-rendering-and-video-out.md#sona_headless_record). |

## Video

`class Video`: A PNG sequence, GIF, MP4 or WebM.

| Declaration | What it does |
|---|---|
| `__init__(ctx, path, width, height, format="auto", fps=30.0, loops=0, quality=0, background=0xff000000, opaque=False, dither=True, colours=0, ffmpeg=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_video_open`](../c/headless-rendering-and-video-out.md#sona_video_open). |
| `frame(rgba)` | One frame of width * height straight RGBA8, row 0 at the top.<br>Calls [`sona_video_frame`](../c/headless-rendering-and-video-out.md#sona_video_frame). |
| `finish()` | Ends the file; the bytes of an in-memory video, else None.<br>Calls [`sona_video_finish`](../c/headless-rendering-and-video-out.md#sona_video_finish), [`sona_free`](../c/drawing-with-the-sdks-backends.md#sona_free). |

## PlayerLook

`class PlayerLook`: state ("waiting", "fresh", "stale", "private", "none"), manifest (bytes to add), placeholder, version, name, error (a sona_result word, "" when the last check worked), fetched_at, checked_at, next_check (clock seconds).

| Declaration | What it does |
|---|---|
| `__init__(raw)` | Made by the binding when a call returns one; not made by hand. |

## PlayerEvent

`class PlayerEvent`: kind ("look", "gone", "failed"), id (as watched), code (a sona_result word, "" for ok).

| Declaration | What it does |
|---|---|
| `__init__(raw)` | Made by the binding when a call returns one; not made by hand. |

## Players

`class Players`: Friends, lobby members and leaderboard rows by id (a gamertag, "a:<account>/<slot>", "w:<case key>").

| Declaration | What it does |
|---|---|
| `__init__(host=None, client=None, cache_dir=None, placeholder=None, max_players=0, refresh_s=0, per_hour=0, in_flight=0, timeout_ms=0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_players_defaults`](../c/other-players-avatars-by-id.md#sona_players_defaults), [`sona_players_open`](../c/other-players-avatars-by-id.md#sona_players_open). |
| `watch(ids, priority=0)` | Returns "ok", or the word of the first problem ("argument" for a string that is not an id, "limit").<br>Calls [`sona_players_watch`](../c/other-players-avatars-by-id.md#sona_players_watch). |
| `unwatch(ids=None)` | Stops asking; looks stay cached.<br>Calls [`sona_players_unwatch`](../c/other-players-avatars-by-id.md#sona_players_unwatch). |
| `refresh(ids=None)` | Asks again now, inside the limits.<br>Calls [`sona_players_refresh`](../c/other-players-avatars-by-id.md#sona_players_refresh). |
| `update()` | Each frame: takes answers, sends due requests, writes the cache file (at most every 2 s).<br>Calls [`sona_players_update`](../c/other-players-avatars-by-id.md#sona_players_update). |
| `poll()` | Every event waiting, oldest first; an empty list when there are none.<br>Calls [`sona_players_poll`](../c/other-players-avatars-by-id.md#sona_players_poll). |
| `look(player_id)` | Always fills out with a look to draw (the placeholder when nothing is known).<br>Calls [`sona_players_look`](../c/other-players-avatars-by-id.md#sona_players_look). |
| `forget(player_id)` | Drops the id's look from memory and, at the next write, from the cache file, and stops watching it.<br>Calls [`sona_players_forget`](../c/other-players-avatars-by-id.md#sona_players_forget). |
| `stats()` | Looks kept, ids watched, requests in flight and due, and counts since open: requests, changed, the same, 304s, gone, failed, read from disk, disk writes, waits for per_hour; paused_until.<br>Calls [`sona_players_stats_get`](../c/other-players-avatars-by-id.md#sona_players_stats_get). |
| `close()` | Writes the cache file when it changed; answers still in flight are dropped.<br>Calls [`sona_players_close`](../c/other-players-avatars-by-id.md#sona_players_close). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |

## OutfitIssue

`class OutfitIssue`: The C type sona_outfit_issue.

| Declaration | What it does |
|---|---|
| `__init__(i)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_outfit_issue_name`](../c/making-avatars-in-code.md#sona_outfit_issue_name). |

## Maker

`class Maker`: A catalogue's outfit rules, indexed once: seeded random avatars, dress like, clashes, matched sets and the outfit check.

| Declaration | What it does |
|---|---|
| `__init__(catalogue, ctx=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_maker_create`](../c/making-avatars-in-code.md#sona_maker_create). |
| `close()` | Frees the maker.<br>Calls [`sona_maker_free`](../c/making-avatars-in-code.md#sona_maker_free). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |
| `random(seed, body=0, style="any", palette="natural", flags=0, require=0, exclude=0, skip_sections=0, game=None, tag=None, base=None, skin=None, hair=None, eyes=None, available=None)` | (manifest bytes, report dict): a seeded random avatar.<br>Calls [`sona_random_defaults`](../c/making-avatars-in-code.md#sona_random_defaults), [`sona_make_random`](../c/making-avatars-in-code.md#sona_make_random). |
| `dress_like(body, like, parts=0, match=N.SONA_MATCH_SIMILAR, layer=False, available=None)` | (manifest bytes, report dict): body wearing like's parts (SONA_LIKE_* bits; 0: clothes and props).<br>Calls [`sona_like_defaults`](../c/making-avatars-in-code.md#sona_like_defaults), [`sona_make_dress_like`](../c/making-avatars-in-code.md#sona_make_dress_like). |
| `variant(item, body, match=N.SONA_MATCH_SIMILAR)` | (outcome, item id or None): what body (1 or 2) wears for item.<br>Calls [`sona_make_variant`](../c/making-avatars-in-code.md#sona_make_variant). |
| `clash(a, b)` | (SONA_CLASH_* bits, the slots they share). |
| `conflicts(manifest, item)` | The ids wearing item would take off manifest.<br>Calls [`sona_outfit_conflicts`](../c/making-avatars-in-code.md#sona_outfit_conflicts). |
| `sets()` | Every matched set: dicts of index, name, game, title, count, bodies, sections, slots.<br>Calls [`sona_outfit_set_count`](../c/making-avatars-in-code.md#sona_outfit_set_count), [`sona_outfit_set_get`](../c/making-avatars-in-code.md#sona_outfit_set_get). |
| `set_of(item)` | The matched set an item is in, or -1.<br>Calls [`sona_outfit_set_of`](../c/making-avatars-in-code.md#sona_outfit_set_of). |
| `set_items(index, body=0)` | Catalogue indexes of a set's items a body wears (0: all).<br>Calls [`sona_outfit_set_items`](../c/making-avatars-in-code.md#sona_outfit_set_items). |
| `check(manifest)` | (report dict, OutfitIssue) errors first. |
| `fix(manifest)` | (fixed manifest bytes, report dict after). |

## NetSender

`class NetSender`: One avatar's stream to one receiver: write a packet each tick, ack what comes back.

| Declaration | What it does |
|---|---|
| `__init__(ctx, tick_hz=30, history=64, full_after=0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_net_sender_create`](../c/state-sync-and-replays.md#sona_net_sender_create). |
| `look(id=None)` | None: the avatar's manifest goes along; else this id (a gamertag, a player id).<br>Calls [`sona_net_sender_look`](../c/state-sync-and-replays.md#sona_net_sender_look). |
| `write(avatar, tick)` | One packet of a's state at tick, coded against the newest acknowledged tick (or full).<br>Calls [`sona_net_write`](../c/state-sync-and-replays.md#sona_net_write). |
| `ack(tick)` | The receiver holds tick.<br>Calls [`sona_net_ack`](../c/state-sync-and-replays.md#sona_net_ack). |
| `stats()` | Packets and bytes written, those without a baseline (full), the last packet's size and the newest acknowledged tick.<br>Calls [`sona_net_sender_stats`](../c/state-sync-and-replays.md#sona_net_sender_stats). |
| `close()` | Frees the sender.<br>Calls [`sona_net_sender_destroy`](../c/state-sync-and-replays.md#sona_net_sender_destroy). |

## NetReceiver

`class NetReceiver`: The receiving end: read each packet (send back what it returns), drive a puppet at any tick.

| Declaration | What it does |
|---|---|
| `__init__(ctx, tick_hz=30, history=64, full_after=0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_net_receiver_create`](../c/state-sync-and-replays.md#sona_net_receiver_create). |
| `read(packet)` | The tick to acknowledge; raises SonaError ("not_found" when its baseline is no longer held).<br>Calls [`sona_net_read`](../c/state-sync-and-replays.md#sona_net_read). |
| `look()` | None before a look arrived; else ("manifest", bytes) or ("id", str).<br>Calls [`sona_net_receiver_look`](../c/state-sync-and-replays.md#sona_net_receiver_look). |
| `drive(avatar, tick)` | Shows tick on a, which becomes a puppet: a held tick as it is, a fraction between two held ticks as their blend, before the oldest the oldest, past the newest the newest.<br>Calls [`sona_net_drive`](../c/state-sync-and-replays.md#sona_net_drive). |
| `stats()` | Packets and bytes read, packets refused for want of a baseline (full), the newest and oldest ticks held.<br>Calls [`sona_net_receiver_stats`](../c/state-sync-and-replays.md#sona_net_receiver_stats). |
| `close()` | Frees the receiver.<br>Calls [`sona_net_receiver_destroy`](../c/state-sync-and-replays.md#sona_net_receiver_destroy). |

## Recorder

`class Recorder`: Avatars' states each tick into one replay file; keep_seconds > 0 keeps only about the last seconds.

| Declaration | What it does |
|---|---|
| `__init__(ctx, tick_hz=30, keyframe_ticks=0, keep_seconds=0.0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_record_defaults`](../c/state-sync-and-replays.md#sona_record_defaults), [`sona_recorder_create`](../c/state-sync-and-replays.md#sona_recorder_create). |
| `track(avatar, name=None)` | Records the avatar from the next capture on, under name if given; returns its track number.<br>Calls [`sona_recorder_track`](../c/state-sync-and-replays.md#sona_recorder_track). |
| `capture(tick)` | Every track's state at tick (rising).<br>Calls [`sona_recorder_capture`](../c/state-sync-and-replays.md#sona_recorder_capture). |
| `save()` | The file's bytes, freed with sona_free.<br>Calls [`sona_recorder_save`](../c/state-sync-and-replays.md#sona_recorder_save), [`sona_free`](../c/drawing-with-the-sdks-backends.md#sona_free). |
| `close()` | Frees the recorder and what it captured.<br>Calls [`sona_recorder_destroy`](../c/state-sync-and-replays.md#sona_recorder_destroy). |

## Replay

`class Replay`: A recording: drive(track, avatar, seconds) at any time, in any order.

| Declaration | What it does |
|---|---|
| `__init__(ctx, data)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_replay_open`](../c/state-sync-and-replays.md#sona_replay_open). |
| `info()` | The replay's tracks, tick rate, first and last tick, the captures it holds and its length in seconds.<br>Calls [`sona_replay_info_get`](../c/state-sync-and-replays.md#sona_replay_info_get). |
| `track(track)` | (manifest bytes, name, from seconds, to seconds)<br>Calls [`sona_replay_track`](../c/state-sync-and-replays.md#sona_replay_track). |
| `drive(track, avatar, seconds)` | Shows the track at seconds from the replay's start on a, which becomes a puppet, blending the two frames around it.<br>Calls [`sona_replay_drive`](../c/state-sync-and-replays.md#sona_replay_drive). |
| `close()` | Frees the replay.<br>Calls [`sona_replay_close`](../c/state-sync-and-replays.md#sona_replay_close). |

## PickHit

`class PickHit`: One pick: the avatar (an Avatar of its context), the item, mesh and triangle, the joint and body region, where.

| Declaration | What it does |
|---|---|
| `__init__(h, ctx)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_region_name`](../c/picking.md#sona_region_name). |

## PropMesh

`class PropMesh`: A prop mesh of one context (Context.prop_mesh, prop_mesh_load, prop_mesh_stock).

| Declaration | What it does |
|---|---|
| `__init__(ctx, raw)` | Made by the binding when a call returns one; not made by hand. |
| `state()` | "ready", "pending", or the failure's code name.<br>Calls [`sona_prop_mesh_state`](../c/props-held-and-worn-objects.md#sona_prop_mesh_state). |
| `info()` | dict: kind ("host" or "stock"), parts, vertices, triangles, textures, joints, hand, joint, lo, hi, seconds, item, pet, clip, untextured; None while pending.<br>Calls [`sona_prop_mesh_info_get`](../c/props-held-and-worn-objects.md#sona_prop_mesh_info_get). |
| `meshes()` | The data API's Mesh objects of the prop (joint bytes index the prop frame's palette).<br>Calls [`sona_prop_mesh_data`](../c/props-held-and-worn-objects.md#sona_prop_mesh_data). |
| `release()` | The host's reference goes; avatars it is attached to keep it until they detach it.<br>Calls [`sona_prop_mesh_release`](../c/props-held-and-worn-objects.md#sona_prop_mesh_release). |

## Control

`class Control`: One control of the editor's screen: its role, place, text and value (sona_editor_control).

| Declaration | What it does |
|---|---|
| `__init__(c)` | Made by the binding when a call returns one; not made by hand. |

## Editor

`class Editor`: The C type sona_editor.

| Declaration | What it does |
|---|---|
| `__init__(ctx, catalogue, mode="full", start=None, theme_=None, theme="dark", width=1280, height=720, seed=1, flags=0, title=None, filter=None, look=None, sound=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_editor_defaults`](../c/player-editor.md#sona_editor_defaults), [`sona_editor_open`](../c/player-editor.md#sona_editor_open). |
| `close()` | Removes its avatars from the ctx.<br>Calls [`sona_editor_close`](../c/player-editor.md#sona_editor_close). |
| `button(code, down)` | A gamepad button pressed or let go (sona_editor_input). |
| `press(code, dt=1.0 / 60)` | Down, a frame, up, a frame. |
| `axis(code, value)` | A gamepad axis moved, -1 to 1 (sona_editor_input). |
| `key(code, mods=0)` | A key pressed, with modifier bits (sona_editor_input). |
| `text(s)` | Typed text, for the search box (sona_editor_input). |
| `pointer(x, y, down, pointer=0)` | down: True pressed, False released, None moved. |
| `wheel(lines, x, y)` | A mouse wheel turned at a point, in lines (sona_editor_input). |
| `update(dt)` | Advances dt seconds: stick repeat, animations, avatar builds and (unless HOST_UPDATES) sona_update on the ctx.<br>Calls [`sona_editor_update`](../c/player-editor.md#sona_editor_update). |
| `status()` | SONA_EDITOR_RUNNING, _DONE or _CANCELLED, as the last sona_editor_update returned.<br>Calls [`sona_editor_status`](../c/player-editor.md#sona_editor_status). |
| `result()` | The avatar as it stands (at any time): SONA_MANIFEST_BYTES.<br>Calls [`sona_editor_result`](../c/player-editor.md#sona_editor_result). |
| `busy()` | 1 while an avatar is still building (the shown one or a change on its way); thumbnails do not count.<br>Calls [`sona_editor_busy`](../c/player-editor.md#sona_editor_busy). |
| `build_failures()` | How many avatar builds failed since open (the screen reader is told each time).<br>Calls [`sona_editor_build_failures`](../c/player-editor.md#sona_editor_build_failures). |
| `undo(redo=False)` | Undoes the last change (redo 0) or redoes the last undone one (redo 1), for a host that draws the stage's own undo and redo buttons.<br>Calls [`sona_editor_undo`](../c/player-editor.md#sona_editor_undo). |
| `can_undo(redo=False)` | 1 when sona_editor_undo with the same redo would step: use it to grey out the buttons.<br>Calls [`sona_editor_can_undo`](../c/player-editor.md#sona_editor_can_undo). |
| `zoom(set=0.0)` | The stage's zoom: 1 is the editor's own framing, from 0.6 to 3.<br>Calls [`sona_editor_zoom`](../c/player-editor.md#sona_editor_zoom). |
| `turn(degrees)` | Turns the avatar on the stage by degrees, as a drag across the stage does.<br>Calls [`sona_editor_turn`](../c/player-editor.md#sona_editor_turn). |
| `screen()` | The screen shown now.<br>Calls [`sona_editor_screen_get`](../c/player-editor.md#sona_editor_screen_get). |
| `screens()` | The mode's screens in tab order, by name.<br>Calls [`sona_editor_screens`](../c/player-editor.md#sona_editor_screens). |
| `set_screen(name)` | Moves to a screen of the mode (a deprecated id to the screen that took its place).<br>Calls [`sona_editor_set_screen`](../c/player-editor.md#sona_editor_set_screen). |
| `set_search(text)` | The search box of the wardrobe and the item screens, for hosts with an on-screen keyboard (UTF-8; NULL clears).<br>Calls [`sona_editor_set_search`](../c/player-editor.md#sona_editor_set_search). |
| `set_theme(which="dark", **overrides)` | Changes the colours and sizes from the next frame.<br>Calls [`sona_editor_set_theme`](../c/player-editor.md#sona_editor_set_theme). |
| `resize(width, height)` | The editor's size in pixels, the size of the target it is drawn into.<br>Calls [`sona_editor_resize`](../c/player-editor.md#sona_editor_resize). |
| `controls()` | Every control on screen, in reading order, and the focused one.<br>Calls [`sona_editor_control_count`](../c/player-editor.md#sona_editor_control_count), [`sona_editor_control_get`](../c/player-editor.md#sona_editor_control_get). |
| `focus()` | SONA_E_NOT_FOUND when nothing has focus (pointer-only use).<br>Calls [`sona_editor_focus_get`](../c/player-editor.md#sona_editor_focus_get). |
| `announcement()` | What a screen reader should say since the last call ("Wardrobe, tab, 6 of 6"), or None.<br>Calls [`sona_editor_announcement`](../c/player-editor.md#sona_editor_announcement). |
| `draw_data()` | (vertices, indices, commands, avatar_rect): vertices as (x, y, u, v, (r, g, b, a)); commands as (texture, first_index, index_count, clip).<br>Calls [`sona_editor_draw_data_get`](../c/player-editor.md#sona_editor_draw_data_get). |
| `texture(which)` | (width, height, revision, rgba bytes) of TEXTURE_ATLAS or TEXTURE_THUMBS.<br>Calls [`sona_editor_texture_get`](../c/player-editor.md#sona_editor_texture_get). |
| `render_ui(width=None, height=None, under=None)` | The UI layer as RGBA bytes; under: RGBA bytes of the same size to draw it over (an avatar snapshot).<br>Calls [`sona_editor_draw_data_get`](../c/player-editor.md#sona_editor_draw_data_get), [`sona_editor_render_ui`](../c/player-editor.md#sona_editor_render_ui). |

## State

`class State`: The C type sona_state_desc.

| Declaration | What it does |
|---|---|
| `__init__(s)` | Made by the binding when a call returns one; not made by hand. |

## Tracker

`class Tracker`: The C type sona_tracker.

| Declaration | What it does |
|---|---|
| `__init__(mirror=False, no_head=False, no_face=False, no_gaze=False, **options)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_track_defaults`](../c/face-tracking.md#sona_track_defaults), [`sona_track_create`](../c/face-tracking.md#sona_track_create). |
| `close()` | Frees the tracker.<br>Calls [`sona_track_destroy`](../c/face-tracking.md#sona_track_destroy). |
| `feed(time, scores=None, head=None, layout="mediapipe")` | scores: 52 floats in the layout's order, None when the camera saw no face.<br>Calls [`sona_track_face_input_defaults`](../c/face-tracking.md#sona_track_face_input_defaults), [`sona_track_face_feed`](../c/face-tracking.md#sona_track_face_feed). |
| `state()` | What the tracker makes of the frames so far: the filtered, calibrated weights in ARKit order (sides swapped under SONA_TRACK_MIRROR, so Left is the avatar's left) and the head.<br>Calls [`sona_track_face_get`](../c/face-tracking.md#sona_track_face_get). |
| `calibrate_begin()` | Starts collecting a neutral face: every frame with a face from now on counts.<br>Calls [`sona_track_calibrate_begin`](../c/face-tracking.md#sona_track_calibrate_begin). |
| `calibrate_end()` | The calibration as bytes, to save and hand back to calibration_set in a later session.<br>Calls [`sona_track_calibrate_end`](../c/face-tracking.md#sona_track_calibrate_end). |
| `calibration_set(blob=None)` | A saved calibration, for the next session; NULL clears it.<br>Calls [`sona_track_calibration_set`](../c/face-tracking.md#sona_track_calibration_set). |
| `reset()` | Forgets the filters, the shapes held and the tracking state; keeps the options and the calibration.<br>Calls [`sona_track_reset`](../c/face-tracking.md#sona_track_reset). |
| `apply(avatar)` | Puts the state on a sona.Avatar; False until it is ready and posed.<br>Calls [`sona_track_apply`](../c/face-tracking.md#sona_track_apply). |
| `release(avatar)` | Hands the face and the tracker's joints back to the clip; nothing when a is not the avatar it drives.<br>Calls [`sona_track_release`](../c/face-tracking.md#sona_track_release). |

## Types

| Declaration | What it does |
|---|---|
| `class sona_editor_options(Structure)` | The C type sona_editor_options, field for field. |
| `class sona_editor_theme(Structure)` | Colours are 0xAARRGGBB, straight alpha. The C type sona_editor_theme, field for field. |
| `class sona_editor_input(Structure)` | The C type sona_editor_input, field for field. |
| `class sona_editor_control(Structure)` | The C type sona_editor_control, field for field. |
| `class sona_editor_vertex(Structure)` | The C type sona_editor_vertex, field for field. |
| `class sona_editor_command(Structure)` | Blend with SRC_ALPHA, ONE_MINUS_SRC_ALPHA (straight alpha), no depth, the scissor at clip. The C type sona_editor_command, field for field. |
| `class sona_editor_draw_data(Structure)` | The C type sona_editor_draw_data, field for field. |
| `class sona_editor_texture(Structure)` | The C type sona_editor_texture, field for field. |
| `class sona_track_options(Structure)` | The C type sona_track_options, field for field. |
| `class sona_track_face_input(Structure)` | One frame of a face tracker. The C type sona_track_face_input, field for field. |
| `class sona_track_face_state(Structure)` | What the tracker makes of the frames so far. The C type sona_track_face_state, field for field. |
| `class sona_track_calibration(Structure)` | Neutral face. The C type sona_track_calibration, field for field. |
