The Codec
The codec defines the translation rules applied to produce a .life file. It must be fully specified within the file itself. A LIFE parser must be able to reverse the translation using only the codec object and the preamble.
Required fields
| Field | Type | Description |
|---|---|---|
type | string | "harmonic_ratio" in v1.0 |
source_medium | string | One of: "acoustic", "electromagnetic", "spectral", "synthetic" |
target_medium | string | One of: "acoustic", "electromagnetic" |
scaling_constant | integer | Must match preamble.scaling.value |
scaling_expression | string | Must match preamble.scaling.constant |
frequency_representation | string | Must be "ratio" in v1.0 |
reference_frequency_hz | float | Must match preamble.reference.frequency_hz |
mappings | object | Explicit declaration of source to target property mappings |
reversible | boolean | Whether the file can be decoded back to its source medium |
lossless | boolean | Whether all source frequency information is preserved |
The mappings object
Mappings must be explicit and human-readable. They serve as documentation for future parsers and as a verification layer for current ones.
"mappings": {
"pitch": "frequency_ratio -> wavelength_nm",
"velocity": "intensity_0_to_1 -> photon_flux_relative",
"duration": "seconds -> seconds",
"channel": "voice_index -> light_source_index"
}
The reversible and lossless flags
These are explicit promises made by the file about its own contents. A conformant parser must honour them.
A file marked reversible: true must be decodable back to its source medium without ambiguity. A file marked lossless: true must contain all source frequency information - nothing discarded during encoding.
Example
"codec": {
"type": "harmonic_ratio",
"source_medium": "acoustic",
"target_medium": "electromagnetic",
"scaling_constant": 1099511627776,
"scaling_expression": "2^40",
"frequency_representation": "ratio",
"reference_frequency_hz": 440.0,
"mappings": {
"pitch": "frequency_ratio -> wavelength_nm",
"velocity": "intensity_0_to_1 -> photon_flux_relative",
"duration": "seconds -> seconds",
"channel": "voice_index -> light_source_index"
},
"reversible": true,
"lossless": true
}