Manifold interpolation engine for openFrameworks — continuous preset morphing via barycentric weights over a network of nodes. Geometry that doesn't know what its values mean.
README
ofxManifold
Continuous preset morphing for openFrameworks.
Place your presets as nodes. Drag a point between them. Get a weighted blend.

example-mapping: the point sits out among the null nodes ringing the edge. The node weights still sum to 1.000, but the resolved targets total only 0.303 — the missing 0.697 is held by nodes bound to nothing. That shortfall is the fade, and it is the reason silent nodes were invented.ofxManifold::Manifold2D m;
auto a = m.addNode("calm", {0.2f, 0.8f});
auto b = m.addNode("bright", {0.8f, 0.8f});
auto c = m.addNode("heavy", {0.5f, 0.2f});
m.addTriangle(a, b, c);
ofxManifold::Evaluator ev(m);
auto e = ev.evaluate({0.45f, 0.6f}); // point -> weights
MyPreset blended = interpolate(e.weights, presets); // weights + valuesThe manifold never learns what a
MyPreset is. It answers which nodes influence this point, and by how much. Everything after that is interpretation.---
What it is for
A single continuous gesture can drive several independent things at once — synthesis parameters, rhythmic density, colour, lighting, speaker gains, OSC output — without any of them being hardcoded into the thing producing the gesture.
Spatial audio panning is the historically important application and the narrowest one. If you have four presets you like and want to move smoothly between them, that is the same problem.
---
Lineage, and what is owed to whom
This is an independent implementation of an idea with a long history. It carries no code from the work below.
Steve Ellison devised barycentric amplitude panning in 1986 for a sixteen-channel geodesic dome in Canberra. The dome's triangular arrangement suggested panning between triplets of loudspeakers, and barycentric coordinates turned out to be a cheap way to derive power-preserving gains from it. He arrived at the technique intuitively and learned only later that Möbius had introduced the mathematics in 1827.
The software became SpaceNodes, then SpaceMap, commercialized through LCS Audio and later Meyer Sound across four hardware generations. His account of it — SpaceMap: 20 Years of Audio Origami, Lighting & Sound America, April 2013 — is the reason several decisions here are what they are. Every feature in SpaceMap exists because a production broke without it, which makes the feature set evidence rather than one arrangement among many.
Zachary Seldess reimplemented the approach for Max/MSP and Pure Data as MIAP — Manifold-Interface Amplitude Panning, presented at the AES 137th Convention in 2014, and generalized it considerably in the process. His paper and externals are at zacharyseldess.com, and anyone working in Max or Pd should go there rather than here.
Three things in MIAP shaped this addon directly.
It generalized the approach past panning. MIAP interpolates between HRTFs, between reverb impulse responses, across VST parameter sets — the weights are treated as influence over whatever sits at each node, and speaker gain is one case among several. Seldess has said the non-panning use cases were a large part of why he committed to the project, alongside making the manifold approach known outside the small circle of theatrical sound designers working on very expensive systems. That generalization is the premise this addon starts from rather than something it arrived at.
The response curve is selectable — cosine, square root, linear — precisely because the weights might be driving plugin parameters or lighting-board faders rather than audio, where constant-power is meaningless or actively wrong.
Non-centricity. Unlike VBAP or Ambisonics, the map need not be a projection of physical space and need not assume a listener at the origin. Two nodes adjacent on the map may be the two most distant outputs in the room.
MIAP has since generalized further, from triangles to polysets of N ≥ 3 nodes using mean-value coordinates — a generalized barycentric scheme that reduces exactly to ordinary barycentric coordinates at N = 3.
Try it: Seldess's interactive demoScot Gresham-Lancaster's Tibetan Yantra map, described in Ellison's article, is the clearest demonstration that the geometry is genuinely independent of spatial meaning: intersections in a diagram assigned to eight real channels with every other intersection virtual, producing sheets and planes of sound collapsing into points rather than movement from A to B.
lets you drag a source through a polyset and watch each node's influence
resolve in real time. It is the fastest way to understand what a manifold
does, and it shows the idea through speaker gains. ofxManifold isolates the
step before that — the weights themselves — and leaves what they mean to
whatever consumes them.
---
How this differs
Not better, and not a wider scope — MIAP already generalized past panning. The differences are of host, packaging, and where the seams fall.
Different host. MIAP is a set of Max/MSP and Pd externals. This is a C++ library for openFrameworks, usable from any C++ project. If you are working in Max or Pd, MIAP is the mature tool and you should use it.
No audio at all. MIAP interpolates non-audio parameters, but it lives in an audio environment and panning is first-class in it. There is no audio code anywhere in this addon, and the square-root conversion to constant-power gains is one optional curve among several rather than the default path.
Blending arbitrary values is a first-class operation.
interpolate() takes weights and any C++ type supporting + and * float — a colour, a struct of parameters, a glm::vec3 — so a blended value comes back in the consumer's own type rather than as a list of gains to distribute.The node taxonomy collapses to cardinality. MIAP has Speaker, Silent, Virtual and Derived node types. Here the kernel has **no node type field at all**: terminal, null and composite nodes are the same struct, differing only in whether the mapping layer resolves them to zero, one, or many targets. And a Derived node — which runs the routing backwards, receiving a sum rather than distributing one — is not a node here. It is an aggregator, a separate object outside the geometry, because a non-participating object inside the geometry forces every region operation to filter it out.
The kernel has no openFrameworks dependency and is proved independently.
src/core builds and tests with a compiler and make. Every layer is verified against a second implementation written in Python from a different formulation — Cramer's rule against signed sub-areas, edge-sign containment against barycentric non-negativity, the standard library's JSON parser against a hand-written one. Agreement is evidence rather than a tautology.Triangles only, for now. MIAP's mean-value coordinates handle polygons of any size; this handles triangles.
Region is an interface so a second coordinate kernel can be added without touching anything downstream, but that is future work rather than a claim (see ROADMAP.md).A manifold and a mapping are separate files. A manifold is portable; a mapping is installation-specific. That split is what lets a recorded path survive a change of venue: the map is rebuilt for the new rig and the cues are not touched.
---
Install
cd openFrameworks/addons
git clone https://github.com/leeMeredith/ofxManifold.gitThen add
ofxManifold in Project Generator. No dependencies beyond openFrameworks itself. glm is vendored only so the kernel tests build without an openFrameworks checkout.---
Examples
example-basic — drag the point, watch the weights. Drag a node and watch it refuse to move when it would turn a region inside out. Three fixtures: a clean fan, a deliberately broken T-junction, two overlapping regions where the answer depends on which side you entered from, and a 144-node grid for looking at the renderer at density.example-osc — the smallest player: one map, its points, and OSC out that grows and shrinks with the map, for SuperCollider, Max, Pd, TouchDesigner or a script. The receiver needn't know how many outputs there are; the app describes them, and again when they change. It opens on a room of three levels -- four corners on the floor, the middle and the top, twelve outputs -- with the editor's column of level dots and its 3D view beside the map. Drag the point, hold ↑ or ↓ to move it through the levels; 3 shows or hides the 3D view (drag in it to turn it); e the room again, E the editor's flat example, o a map of your own; p and i switch packed and per-output messages, [ ] the rate. What it sends is smoothed -- one number per output, a list the map fixes, so a click across the room or the point leaving the map glides instead of stepping; s turns it off to compare, - = change the half-life a step, shift a hundredth of a second. The map is drawn as the editor draws it, without the editing -- node shapes, halos, values, links -- and the editor's faders run along the bottom, showing what is sent; tab or a click on a fader rings that output's nodes in its colour. In place of a selection it follows one node, the loudest at the point or one pinned with shift-click, drawn as the editor draws a selected node: its share as a brighter band on every fader it feeds, a dot over each, its links (l: the nodes heard, every node, none). Each map's messages go under its own name -- /manifold/room/levels -- with a roll call on /manifold/map, and each copy of the app hears answers on the first port free from 57121, so several copies with different maps play at once and the receivers (the SuperCollider patch, receive.py) follow every one (ofxManifoldPlayer/OSC.md). The point can also move itself (m): a recording of your hand (r, its path drawn as you go), looped; random jumps; random glides -- and the height on its own (h): by hand with ↑ ↓, jumping or gliding, whatever moves the floor, so you can drag the point while the height wanders, or hold ↑ while the floor glides; that stay on the map and never cut across it -- on a timer (, .), on your clicks, or on the beats of Lee's ofxScPhaseBridge (c). Every movement counts in the clock's units: the app's own seconds, or bars from SuperCollider's /phase on port 9001 (b), so a step every 1/16 lands on SuperCollider's sixteenths and stretches with its tempo. The height can be measured on the levels (k): a level position that rides the levels' bends and stays between the bottom and the top, so moving sideways over a raised node rises with it, and a random height never drops out of the map. Levels may touch: x opens an octahedron, a bottom and a top level meeting at the rim, and riding up by the rim the point is heard on both. ? shows every key on one page; ? again hides every key and the status, leaving the map and the 3D view as large as the window allows -- for screen recordings, or when you know the keys -- and a third ? brings them back. The editor does the same, and in both the map names each node as on the level shown (FL-2 on level 2), as does the readout beside the point, its numbers first. With it a SuperCollider patch (supercollider/manifold-receive.scd) that builds a voice per output and plays it over headphones, and receive.py, a receiver with no dependencies. On headphones the outputs are speakers in a room (3B-3a): each placed output at its node's place and its level's height, heard from the middle of the room through a model of a head -- the far ear later, duller and quieter, height as a change of tone, distance as level and air, one shared reverb -- in core SuperCollider alone; or, with the Ambisonic Toolkit installed (3B-3b), each speaker encoded at its direction and heard through measured ears, front and back, up and down far clearer; or panned in stereo as before. The patch and its modes file need nothing installed: the toolkit's room is an extra, in supercollider/extras/atk, with a choices file of its own (manifold-atk-modes.scd: START, the room, what is installed and how to install the rest) -- rooms plug into the patch, a folder each. **To hear what it can do without reading the patch, open supercollider/manifold-modes.scd**: run its START block, start example-osc, and pick one block from each group -- notes, shared outputs, sound, points, room -- each explained, with what to try and what to expect. For your own speakers, open supercollider/manifold-speakers.scd (3B-4a): no music, nothing installed, nothing else loaded -- one sound (a test tone, pink noise, a sound file or a live input) on every speaker at the level the map gives it, so the map pans it. Put a node in the editor where each speaker stands; the outputs' channels choose the speakers (channel 0 is speaker 1; in the editor, s and S move the picked output to the speaker before or after, the two changing places). Its blocks: SETUP (the device and how many speakers), CHECK THE SPEAKERS (one pulse for speaker 1, two for speaker 2 ...), the sounds, and ON HEADPHONES, every speaker folded left to right by where its node is. Each map also tells its shape -- its levels, and where each output sits -- and the patch decides what that sounds like, in settings at its top: a chord progression up the levels, every chord in one register so only the harmony changes (\progression, the default; \somber in a minor key), each level the same chord a step higher (\registers), or the overtone series (\series); the point's height opening each voice; each output panned by its node's place. openFrameworks decides none of it. Anything on the same machine can also move the point -- your SuperCollider engine, a controller app -- by taking it over OSC (/manifold/<map>/point/1/take, then xy, z, u), answered as the SuperCollider Audio Engine answers; the ? page shows the addresses and the port, the hand can always take the point back, and C writes the map's control file to narrow what a point takes (ofxManifoldPlayer/OSC.md). A map can have more than one point: a adds one at the mouse, up to sixteen, A removes the last; ← → or a press on its dot chooses which the keys act on, each keeping its own movement -- point 2 gliding while your hand drives point 1 -- and the control file says how many a map opens with. A point added follows the one before it: on each step it goes where that one was at the step before, so the points move in a line, a step apart; it never ends a step within a gap of another point on its level (g: 0.04, 0.08, 0.15 of the map, or off), waiting there instead, so a line folding back on itself -- or a shape, later -- never bunches up. Each sends its own levels and position (point 1 as always, the others under /point/2/ ...), and the patch decides what they are: every point playing the same voices, louder where they meet (\together), or the first playing and the rest shaping it by FM or ring modulation (\carrier) -- the level a shaping point is on setting the modulator's ratio (protocol 5). The panel and the ? page are in sections, each under its own coloured header -- sending, points, the point, movement, smoothing, from outside, showing, maps -- the panel what is true now with the key that changes it, the ? page every key; the editor's headers are drawn the same way. With SuperCollider installed, make sc checks the patch's music in sclang and make sc-live runs it whole on your sound card for a second. The protocol is ofxManifoldPlayer/OSC.md. It needs ofxManifoldPlayer (beside src/, copied into addons/ like the editor's), ofxManifoldEditor for opening maps, and openFrameworks' own ofxOsc.example-editor needs a second addon, ofxManifoldEditor, which lives in this repository beside src/: copy it into your addons/ folder next to ofxManifold. It is kept out of ofxManifold's own src/ on purpose, so projects that want only the manifold never compile the editor.The package has two halves.
ofxManifoldEditor.h is the editing logic -- the model, selection, undo, files, keys, fader layout -- with no openFrameworks, so it can be tested and reused anywhere. ofxManifoldEditorViews.h is the drawing -- the map, node shapes, faders, the side panel -- in src/views/, for any app that wants to show a map the way the editor does.example-editor — the first piece of the editor. Click empty space to place a node on the active grid, drag a box or shift-click to select, drag the selection to move it as one operation, press f to join the selection into a region, delete to remove nodes, u to unjoin, ⌘N for an empty map, s and l to save and load. Outputs: o makes one, b binds the selection to it or unbinds it (a toggle), ⇧B to every output, q and w step a node's fill down and up by 5% (shift for 1%), d makes a derived output. ⌘Z undoes and ⇧⌘Z redoes, any edit. ⌘S saves the map and its outputs as a pair of files, ⇧⌘S under a new name, ⌘O opens either file of a pair. Node shape shows what a node does with its share -- circle for one output, triangle for several, hollow square for none -- and its fill shows how much reaches an output. The listening point stays on the map and the faders always show its levels; hold space to audition, so dragging moves that point and never a node, and the chart along the bottom shows every output, and silence, live, while a halo on each node shows its share -- green where it reaches an output, grey where it goes to silence. With auto-output on (the default, p to toggle), each new node gets its own output; O removes the current one. Free, square, triangular and polar grids, all rotatable; hold alt for a free-hand drag. Drag a corner of the quad across its opposite edge and the move is refused, because the ring would cross itself.A map can have levels: the same floor plan at several heights, for a 3D map. A level can have a shape of its own (round 3B-5):
a then 6 brings a whole level out from its centre and 5 in -- by the grid when one is on, the farthest node a grid step and every node onto a grid point; 5% a press (shift 1%) with the grid free -- for a stadium's tiers, a funnel or an hourglass; a level stays on the map, a press or drag that would carry any node past its edge refused whole; t turns "this level only" on, and a dragged node then moves on the current level alone, off its column; x puts the selected nodes back over their columns. The map draws the current level in its own shape, the others faint beneath; the player and each output's place follow it. A change that would flatten or turn over a region, or fold the map over itself between two levels, is refused. A shaped map is saved at version 5. n copies the current level to a new one above, N below; with auto-output on, each node of the new level gets an output of its own (N-2, E-2), so every level puts out its own numbers -- what they drive is up to what they are connected to; ↑ and ↓ move between them; y and h raise and lower the selected nodes on the current level (shift for fine steps), refused if a node would reach the next level; ⌘⌫ removes a level. A column of dots beside the map shows the levels and which one you are on, and a raised node shows its offset. Click a dot to go to that level; drag it to move the whole level, its start and every node on it, closer to or further from its neighbours -- or i and k for the current level. m gives the selected nodes the height of the one you selected first; M puts them back at their level's start.Each node can also carry values: named numbers per node per level, such as a distance or a brightness, whose meaning is up to whatever reads them.
g ma
ofxAddons