PNGtuber (.lairava)
The .lairava format for PNGtuber avatars, a ZIP of avatar.json and PNG layers, with every field, role and default, so other tools can read and write it.
In short
- A
.lairavafile is a ZIP holdingavatar.jsonand the layers' PNG pictures. - Each layer is a picture placed on a design canvas, with a role that says when it shows (always, blinking, a mouth frame, talking…).
mic,motionandblinkset how it moves with a voice. Version 1; the format is free to implement.
A .lairava file is one PNGtuber: pictures placed on a canvas, what each is for, and how it moves
with a voice. Lightair’s PNGtuber editor writes it, and Lightair reads it anywhere it takes an
avatar. Anyone may read and write the format.
The container
Section titled “The container”A ZIP file holding:
avatar.json, the description below;- each layer’s picture, as PNG, at the path its layer’s
imagenames. Lightair useslayers/<id>.png.
Any ZIP compression is read. Lightair deflates avatar.json and stores the PNGs as they are.
Readers read the archive into memory and never unpack it to disk, so no path in it can reach outside it. Limits:
- a picture is at most 8192 pixels on a side;
- the whole archive unpacks to at most 1 GB.
Pictures use straight (not premultiplied) alpha. Any PNG colour type works; Lightair writes 8-bit RGBA.
avatar.json
Section titled “avatar.json”{ "format": "lightair-pngtuber", "version": 1, "name": "Mochi", "width": 1024, "height": 1024, "layers": [ { "id": "body", "name": "Body", "image": "layers/body.png", "x": 212, "y": 380, "width": 600, "height": 644, "pivot": [512, 1024], "role": "part" }, { "id": "eyes-open", "name": "Eyes open", "image": "layers/eyes-open.png", "x": 380, "y": 330, "width": 270, "height": 90, "pivot": [515, 375], "role": "eyes_open" }, { "id": "mouth-0", "name": "Mouth shut", "image": "layers/mouth-0.png", "x": 470, "y": 470, "width": 90, "height": 40, "pivot": [515, 490], "role": "mouth", "frame": 0 }, { "id": "blush", "name": "Blush", "image": "layers/blush.png", "x": 380, "y": 420, "width": 270, "height": 60, "pivot": [515, 450], "role": "extra" } ], "anchors": [{ "name": "Head", "x": 512, "y": 260, "layer": "body" }], "expressions": [ { "name": "Shy", "show": ["blush"] }, { "name": "Hat", "show": ["hat"], "costume": true } ], "mic": { "open_db": -34, "close_db": -42, "gate_db": -58, "attack_ms": 30, "release_ms": 120 }, "motion": { "bounce": 1, "squash": 1, "breathing": 1, "hop": 1 }, "blink": { "every_s": 4, "length_ms": 140, "double": 0.15 }}| Field | Meaning |
|---|---|
format |
Always "lightair-pngtuber". Anything else is refused. |
version |
1. A reader refuses a version higher than it knows. Later versions only add fields, with defaults that keep version 1 files as they were. |
name |
The avatar’s name. |
width, height |
The design canvas, in pixels. Everything is placed on it: x to the right, y down, (0, 0) at the top left. |
layers |
The pictures, back to front. |
anchors |
Named points things can be pinned to. Optional. |
expressions |
Expressions and costumes. Optional. |
mic, motion, blink |
How it moves. Optional; each missing value takes the default shown above. |
A layer
Section titled “A layer”| Field | Required | Meaning |
|---|---|---|
id |
Yes | Unique in the file. Expressions and anchors name layers by it. |
name |
Yes | The name people see. |
image |
Yes | Its PNG’s path in the archive. |
x, y, width, height |
Yes | Its box on the canvas. The picture is stretched to fill it. |
pivot |
Yes | [x, y]: the point it turns and grows about. Kept for per-layer motion in later versions. |
role |
No | When it shows (below). Default part. |
frame |
No | For a mouth layer: which frame, 0 shut, then each more open. Default 0. |
motion |
No | How much it moves with the avatar, 0 (stays put, like a background) to 1. Default 1. |
opacity |
No | 0 to 1. Default 1. |
| Role | Shows |
|---|---|
part |
Always. |
eyes_open |
Except while blinking (when the avatar has an eyes_closed layer). |
eyes_closed |
Only while blinking. |
mouth |
When its frame is the one chosen: 0 while quiet; while talking, 1 and up with loudness. With a single frame, frame 0 always shows. |
talking |
Only while talking. |
quiet |
Only while quiet. |
extra |
Only when an expression shows it. |
Anchors
Section titled “Anchors”{"name", "x", "y", "layer"}: a point on the canvas. It moves with the layer whose id is layer,
or with the avatar as a whole when layer is left out.
Expressions and costumes
Section titled “Expressions and costumes”{"name", "show": [layer ids], "hide": [layer ids], "costume"}. One is on at a time, chosen by
name. While it’s on, its hide layers are hidden, and its show layers show whenever their role
would show them (an extra layer: always). costume: true only lists it apart from moods; it
works the same way.
How it moves
Section titled “How it moves”The voice’s level is in dBFS.
- Talking starts at or above
open_db, and stops once the voice has stayed belowclose_db(lower, so it doesn’t flicker) forrelease_ms. Belowgate_db, it’s silence. - Loudness goes from 0 at
close_dbto 1 at 12 dB aboveopen_db. It rises with time constantattack_msand falls withrelease_ms. It picks the mouth frame and drives the motion.
motion
Section titled “motion”Each value goes from 0 (off) to 2 (twice as much); 1 is as designed. The whole avatar moves
about the middle of the canvas’s bottom edge:
- bounce: up by as much as 3.5% of the canvas height, with loudness;
- squash: as much as 4.5% taller and 3% narrower, with loudness;
- breathing: while quiet, a 3.6-second cycle, 0.8% taller and 0.4% higher at its top;
- hop: 5% of the height, over 0.28 seconds, when it starts talking or the expression changes.
Each layer moves by its own motion share of this.
| Field | Meaning | Default |
|---|---|---|
every_s |
About how often it blinks, in seconds. Each wait is 60–140% of it. 0 means never. |
4 |
length_ms |
How long the eyes stay shut. | 140 |
double |
The chance, 0 to 1, that a blink comes twice. |
0.15 |
Versions
Section titled “Versions”| Version | Change |
|---|---|
| 1 | The first version. |