Skip to main content

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

FieldTypeDescription
typestring"harmonic_ratio" in v1.0
source_mediumstringOne of: "acoustic", "electromagnetic", "spectral", "synthetic"
target_mediumstringOne of: "acoustic", "electromagnetic"
scaling_constantintegerMust match preamble.scaling.value
scaling_expressionstringMust match preamble.scaling.constant
frequency_representationstringMust be "ratio" in v1.0
reference_frequency_hzfloatMust match preamble.reference.frequency_hz
mappingsobjectExplicit declaration of source to target property mappings
reversiblebooleanWhether the file can be decoded back to its source medium
losslessbooleanWhether 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
}