| project | morphogen | |||||||
|---|---|---|---|---|---|---|---|---|
| type | software | |||||||
| status | active | |||||||
| beth_topics |
|
|||||||
| tags |
|
A tested Python library of rigorous, interoperable scientific domains.
Morphogen is a Python library of analytically-validated scientific-computing domains — circuits, ODE integrators, control systems, thermodynamics, molecular mechanics, fluids, and more — that share one namespace and one testing discipline, plus a small coupling substrate that co-advances several of those domains with per-timestep feedback (model an engine: heat + mechanics + control, together).
Each domain is checked against analytic ground truth, not eyeballed: the circuit
solver's diode lands within 1 mV of the closed-form answer, the symplectic
integrators hold energy drift below 1e-4, the controllers match closed-form step
responses. That rigor — not a universal compiler or category-theoretic magic — is
the asset.
from morphogen.stdlib.circuit import ... # SPICE-grade MNA, validated
from morphogen.stdlib.integrators import integrate # symplectic, energy-conserving
from morphogen.coupling import Subsystem, couple # co-simulate them with feedbackMorphogen is a library, honestly tiered — not a finished "platform." What works:
- ~11 rigorous scientific domains — circuit, integrators, controls, molecular (MM force field), field (Stable-Fluids CFD), thermo, kinetics, electrochem, multiphase, acoustics, sparse_linalg — each with tests asserting physical invariants (~1,600+ tests total).
- ~5 applied-engineering domains and ~24 solid utilities (DSL/graph/CA/ color/render) — good code, just not rigorous physics; counted separately.
- ~16 single-hop cross-domain bridges (direct instantiation) +
compose()for explicit chaining. - The coupling substrate (
morphogen.coupling.couple) — co-simulate rigorous domains with per-timestep feedback. See docs/usage/coupled_simulation.md. - Deterministic execution — a fixed seed now reproduces (see
tests/test_determinism.py).
North star — designed, not yet built (do not read these as present-tense facts):
MLIR compilation (bindings inert), the .morph DSL (partial, honestly xfail-scoped),
symbolic+numeric and category-theoretic optimization (no code yet), and an intelligent
cross-domain planner. These are the vision, tracked in
docs/reviews/2026-07-11-vision-vs-reality.md
and BACKLOG.md — not shipped capabilities.
Morphogen is a production component of the Semantic Infrastructure Lab (SIL) — building the semantic substrate for intelligent systems.
Role in the Semantic OS:
- Layer 2: Domain Module (audio, physics, circuits, geometry)
- Layer 4: Deterministic Engine (MLIR compilation, reproducible execution)
SIL Principles Applied:
- ✅ Clarity — Explicit domain semantics (audio, field, agent, geometry)
- ✅ Simplicity — Four core operations unify all domains
- ✅ Composability — Domains compose via typed connections
- ✅ Correctness — Type system enforces units, rates, constraints
- ✅ Verifiability — Deterministic execution enables reproducibility
Quick Links: SIL Manifesto • Unified Architecture • Project Index
Morphogen presents two human-friendly faces powered by a single semantic kernel:
- Morphogen.Audio — Declarative language for compositional audio, physics, and multi-domain scenes
- RiffStack — Live performance environment for real-time interaction and improvisation
Both compile to the same Graph IR, share the same operator registry, and guarantee deterministic, reproducible results.
📐 Deep Dive: See docs/architecture/ for the complete stack design (kernel, frontends, Graph IR, MLIR compilation)
Rigor you can check (real today)
- Domains validated against analytic ground truth, not eyeballed — diode within
1 mV of closed form, integrator energy drift
<1e-4, controllers vs. exact step response - ~1,600+ tests that assert physical invariants, not just "it ran"
- One namespace, one testing discipline across every domain
Coupled multiphysics with feedback (real today)
morphogen.coupling.couple(...)co-advances several rigorous domains with per-timestep feedback — a plant and its controller, thermal ↔ mechanical states- Sequential (Gauss–Seidel) co-simulation with zero-order hold; multi-rate via
stride - This is the one coordinating layer the vision needed; the retired one-shot composer could not express it
Interoperable, not siloed (real today)
- ~16 single-hop cross-domain bridges (field → audio, terrain → field, physics → audio…)
compose()chains explicitly-built transforms;find_transform_path()discovers routes
North star — designed, not yet built (not present-tense facts)
- MLIR compilation, the
.morphDSL surface, symbolic+numeric optimization, and category-theoretic composition are the vision, not shipped. See BACKLOG.md and docs/reviews/.
Most people know Turing for the Turing machine or the Turing test. But his most visionary scientific work was his 1952 paper "The Chemical Basis of Morphogenesis" — showing how zebra stripes, leopard spots, and leaf arrangements emerge from two chemicals diffusing and reacting by simple local rules. No blueprint. No central controller. Just composition.
Morphogen the platform is a direct continuation of that work:
- Turing's equations are first-class — reaction-diffusion PDEs (
∂u/∂t = D_u ∇²u + f(u,v)) run natively in thefielddomain - Same philosophical structure — complex emergent behavior from typed local rules composing across domains
- Same unification impulse — Turing bridged chemistry, mathematics, and biology; Morphogen bridges audio, physics, circuit, fluid, geometry, and more
This is not a superficial naming choice. The name signals what kind of computation Morphogen is: emergent, compositional, continuous — the 1952 Turing, not the 1936 one.
"Simple rules. Unified domains. Emergent computation."
📖 Full lineage: docs/philosophy/heritage-and-naming.md
Morphogen (software) and Philbrick (hardware) are two halves of one vision — modular computation in different substrates.
- Design in Morphogen → Simulate and optimize continuous-time systems
- Build in Philbrick → Physical modules implementing the same primitives
- Validate Together → Software and hardware mirror each other
Both platforms share the same four core operations (sum, integrate, nonlinearity, events) and the same compositional philosophy. They will eventually compile to each other.
🔧 Learn More: Philbrick - Modular analog/digital hybrid computing platform
Here's what sets Morphogen apart — domains working together seamlessly:
# Couple fluid dynamics → acoustics → audio synthesis
use fluid, acoustics, audio
# Simulate airflow in a 2-stroke engine exhaust
@state flow : FluidNetwork1D = engine_exhaust(length=2.5m, diameter=50mm)
@state acoustic : AcousticField1D = waveguide_from_flow(flow)
flow(dt=0.1ms) {
# Fluid dynamics: pressure pulses from engine
flow = flow.advance(engine_pulse(t), method="lax_wendroff")
# Couple to acoustics: flow → sound propagation
acoustic = acoustic.couple_from_fluid(flow, impedance_match=true)
# Synthesize audio from acoustic field
let exhaust_sound = acoustic.to_audio(mic_position=1.5m)
# Real-time output
audio.play(exhaust_sound)
}
One program. Three domains. Zero glue code.
See docs/use-cases/2-stroke-muffler-modeling.md for the complete example.
git clone https://github.com/scottsen/morphogen.git
cd morphogen
pip install -e .Create hello.morph (Morphogen source files use .morph extension):
# hello.morph — heat diffusion
use field, visual
@state temp : Field2D<f32> = field.alloc((128, 128), fill_value=100.0)
const KAPPA : f32 = 0.1
flow(dt=0.1, steps=200) {
temp = diffuse(temp, KAPPA, dt, iterations=10)
output colorize(temp, palette="fire", vmin=0.0, vmax=100.0)
}
Run it:
morphogen run hello.morphNext steps:
- Try the examples directory
- Read Getting Started for a guided tutorial
- Explore the domain catalog to see what's possible
Current Status (v0.12.0):
- ✅ Python runtime with NumPy backend
- ✅ Broad multi-domain stdlib and cross-domain examples
- ✅ Active test suite and documentation set
- ⏳ MLIR compilation work exists, but the Python runtime is the current primary surface
- 📍 See STATUS.md for the latest counts and implementation status
v1.0 Release Plan (24 weeks):
Morphogen is on an aggressive path to v1.0 with a three-track strategy:
-
Track 1 - Language Evolution (13 weeks)
- Symbolic + numeric execution (SymPy integration)
- Transform space tracking with functorial translations
- Algebraic composition (
∘operator) + category theory optimization - Domain plugin system for user extensibility
-
Track 2 - Critical Domains (12 weeks)
- Circuit domain with audio coupling ⭐ Unique differentiator
- Fluid dynamics (Navier-Stokes)
- Chemistry Phase 2 expansion
- Target: 50+ domains
-
Track 3 - Adoption & Polish (ongoing)
- Git-based install path (not PyPI)
- 5 showcase examples with videos
- 7 progressive tutorials
- Complete API documentation
- Active community infrastructure
Read the full plan: Morphogen Roadmap
What makes v1.0 special:
- 🔬 Symbolic + numeric execution (first platform to combine both)
- 🎵 Circuit → Audio coupling (design pedal circuits, hear sound instantly)
- 📐 Category theory optimization (verified composition, automatic fusion)
- 🔌 User extensibility (plugin system for custom domains)
- 🎯 50+ integrated domains (audio, physics, chemistry, graphics, AI)
Timeline: Current v0.12.0 → v1.0 release in 2026-Q2
Morphogen programs describe time-evolving systems through flow blocks:
flow(dt=0.01, steps=1000) {
# Execute this block 1000 times with timestep 0.01
temp = diffuse(temp, rate=0.1, dt)
output colorize(temp, palette="fire")
}
Persistent variables are declared with @state:
@state vel : Field2D<Vec2<f32>> = zeros((256, 256))
@state agents : Agents<Particle> = alloc(count=1000)
flow(dt=0.01) {
vel = advect(vel, vel, dt) # Updates vel for next step
agents = integrate(agents, dt) # Updates agents for next step
}
All randomness is explicit via RNG objects:
@state agents : Agents<Particle> = alloc(count=100, init=spawn_random)
fn spawn_random(id: u32, rng: RNG) -> Particle {
return Particle {
pos: rng.uniform_vec2(min=(0, 0), max=(100, 100)),
vel: rng.normal_vec2(mean=(0, 0), std=(1, 1))
}
}
Types can carry dimensional information:
temp : Field2D<f32 [K]> # Temperature in Kelvin
pos : Vec2<f32 [m]> # Position in meters
vel : Vec2<f32 [m/s]> # Velocity in m/s
force : Vec2<f32 [N]> # Force in Newtons
# Unit checking at compile time
dist : f32 [m] = 10.0
time : f32 [s] = 2.0
speed = dist / time # OK: f32 [m/s]
# ERROR: cannot mix incompatible units
x = dist + time # ERROR: m + s is invalid
Morphogen provides 39 fully-integrated domains accessible via the use statement. Each domain offers specialized operators optimized for its computational model.
Field Operations (19 ops) - PDE solvers, diffusion, advection, stencils Agent Systems (13 ops) - Particle simulations, flocking, N-body forces Audio Synthesis (60 ops) - Oscillators, filters, effects, physical modeling RigidBody Physics (12 ops) - 2D dynamics, collisions, constraints
Physics & Simulation (8 domains) - field, agent, rigidbody, integrators, acoustics, thermal_ode, fluid_network, fluid_jet
Audio & Signal (5 domains) - audio, signal, temporal, audio_analysis, instrument_model
Graphics & Visual (7 domains) - visual, color, image, noise, palette, terrain, vision
AI & Optimization (5 domains) - neural, optimization, genetic, cellular, statemachine
Data & Infrastructure (4 domains) - graph, sparse_linalg, io_storage, geometry
Chemistry (9 domains) - molecular, qchem, thermo, kinetics, electrochem, catalysis, transport, multiphase, combustion
Circuit (1 domain) - circuit (DC/AC/transient analysis)
📋 View Full Domain Catalog - Detailed descriptions, code examples, and feature lists
use field, visual
@state vel : Field2D<Vec2<f32 [m/s]>> = zeros((256, 256))
@state density : Field2D<f32> = zeros((256, 256))
const VISCOSITY : f32 = 0.001
const DIFFUSION : f32 = 0.0001
flow(dt=0.01, steps=1000) {
# Advect velocity
vel = advect(vel, vel, dt, method="maccormack")
# Diffuse velocity (viscosity)
vel = diffuse(vel, rate=VISCOSITY, dt, iterations=20)
# Project (incompressibility)
vel = project(vel, method="cg", max_iterations=50)
# Advect and diffuse density
density = advect(density, vel, dt)
density = diffuse(density, rate=DIFFUSION, dt)
# Dissipation
density = density * 0.995
# Visualize
output colorize(density, palette="viridis")
}
use field, visual
@state u : Field2D<f32> = ones((256, 256))
@state v : Field2D<f32> = zeros((256, 256))
const Du : f32 = 0.16
const Dv : f32 = 0.08
const F : f32 = 0.060
const K : f32 = 0.062
flow(dt=1.0, steps=10000) {
# Gray-Scott reaction
let uvv = u * v * v
let du_dt = Du * laplacian(u) - uvv + F * (1.0 - u)
let dv_dt = Dv * laplacian(v) + uvv - (F + K) * v
u = u + du_dt * dt
v = v + dv_dt * dt
# Visualize
output colorize(v, palette="viridis")
}
📂 More Examples: See the examples/ directory for 24 working programs demonstrating all major domains!
- 2-Minute Pitch - What Morphogen is and why it matters
- Strategic Path to v1.0 - What's real, what to build next, post-v1.0 vision
- Getting Started Guide - Installation, first program, core concepts
- Domain Catalog - Complete catalog of all 40+ domains with examples
- docs/README.md - Documentation navigation and index
- SPECIFICATION.md - Complete language specification (2,282 lines)
- Architecture - System design and MLIR compilation
- Specifications - Domain-specific technical specs
- ADRs - Architectural decision records
- STATUS.md - Current implementation status by domain
- CHANGELOG.md - Version history and release notes
- Domain Implementation Guide - How to add new domains
Morphogen is building toward a future where professional domains seamlessly compose:
Education & Academia - Multi-physics simulations, interactive visualizations, reproducible research
Digital Twins & Enterprise - Real-time system simulation, predictive maintenance, optimization workflows
Audio Production & Lutherie - Physical modeling synthesis, instrument design, timbre extraction
Scientific Computing - Coupled PDE systems, reaction-diffusion, quantum chemistry
Creative Coding & Generative Art - Procedural generation, audio-reactive visuals, deterministic creativity
Morphogen v0.3.1 is the evolution of Creative Computation DSL v0.2.2, incorporating:
- Better semantics:
flow(dt)blocks,@statedeclarations, explicit RNG - Clearer branding: "Morphogen" is unique and memorable
- Same foundation: Frontend work carries forward, comprehensive stdlib preserved
RiffStack - Live performance shell for Morphogen.Audio
RiffStack is a stack-based, YAML-driven performance environment that serves as the live interface to Morphogen.Audio. While Morphogen.Audio provides the compositional language layer, RiffStack offers real-time interaction and performance capabilities. Together they form a complete audio synthesis and performance ecosystem built on Morphogen's deterministic execution kernel.
Morphogen is building toward something transformative: a universal platform where professional domains that have never talked before can seamlessly compose. Contributions welcome at all levels!
See CONTRIBUTING.md for:
- Development setup
- High-impact contribution areas
- Code style guidelines
- Pull request process
Quick links:
Apache 2.0 - see LICENSE for details
Copyright 2025 Semantic Infrastructure Lab Contributors
- GitHub: https://github.com/scottsen/morphogen
- Issues: https://github.com/scottsen/morphogen/issues
- Discussions: https://github.com/scottsen/morphogen/discussions
Status: v0.11.0 → v1.0 Release Plan Active | Current Version: 0.11.0 | Target: v1.0 (2026-Q2) | Last Updated: 2025-11-21
🚀 View Roadmap - Unified roadmap to v1.0 (Q2 2026)
