Skip to main content

Events

The events array is a time-ordered sequence of state declarations. Each event describes what exists at a given moment.

LIFE events are declarative, not imperative. They do not say do this. They say this is.

This distinction is fundamental. An imperative format encodes instructions for a specific machine. A declarative format encodes truth that any sufficiently capable system can act upon.

Event structure

FieldTypeDescription
tfloatTime offset in seconds from the beginning of the file. Non-negative. Non-decreasing.
voicesarrayOne or more voice objects active at this moment. May be empty to represent silence.

Voice structure

FieldTypeDescription
idintegerVoice identifier. Stable across events. Analogous to a MIDI channel.
ratiostringFrequency as a ratio to the reference. Example: "3:2". Primary field.
hzfloatDerived frequency in hertz. Provided for convenience.
wavelength_nmfloatDerived electromagnetic wavelength in nanometres.
intensityfloatRelative amplitude or brightness. Range 0.0 to 1.0. Default 1.0.
colourstringHex colour approximation of wavelength_nm. Not canonical.
duration_sfloatOptional. Duration in seconds. If absent, extends to next event on this voice.

The primacy of ratio

The ratio field is the authoritative representation of frequency in a LIFE file. All other frequency fields - hz, wavelength_nm, colour - are derived values provided for convenience and human readability.

A parser encountering a conflict between ratio and hz must use ratio. A parser generating a .life file must compute hz and wavelength_nm from ratio, not the reverse.

The ratio must be expressed as two colon-separated integers in their simplest form. The ratio 4:2 is invalid. The ratio 2:1 is correct.

Example

"events": [
{
"t": 0.0,
"voices": [
{
"id": 1,
"ratio": "3:2",
"hz": 391.9954,
"wavelength_nm": 562.16,
"intensity": 1.0,
"colour": "#c9ff00"
}
]
},
{
"t": 1.2,
"voices": [
{
"id": 1,
"ratio": "2:1",
"hz": 523.2511,
"wavelength_nm": 548.78,
"intensity": 1.0,
"colour": "#9eff00"
},
{
"id": 2,
"ratio": "1:1",
"hz": 261.6256,
"wavelength_nm": 580.89,
"intensity": 1.0,
"colour": "#fffc00"
}
]
}
]