Drag a gate onto the wire to place. Drag a placed gate to move, or off the canvas to remove. Drop a Control (●) in the same step as a gate to make it controlled.
Harmoniq sonifies a quantum state. You build a quantum circuit in the editor, and a playhead scrubs through it step by step. At each step the full quantum state is reconstructed, and its probability distribution is turned into sound. You hear the quantum state evolve in real time.
The system starts with all qubits in |0⟩ (default
3 qubits, adjustable from 1 to 8). With n qubits there are
2n basis states. Each step applies gates that transform
the state into a superposition of all basis states, each with a
complex probability amplitude. The probabilities always sum to 1.
The state vector display shows the full amplitudes — magnitudes
and phases — so you can see exactly what the simulator is doing.
A quantum state looks different depending on how you measure it. Harmoniq reads the state in two complementary bases simultaneously:
|0⟩ and |1⟩.
To read X-basis probabilities without collapsing the state, the simulator applies a Hadamard to each qubit, reads probabilities, then reverses with inverse Hadamard.
Each basis state (2n for n qubits) is assigned a note from the selected scale, extending into higher octaves as needed. The mapping adapts when you change the scale, root octave, qubit count, or X-basis octave offset in the sound controls.
All oscillators run continuously. The probability of
each basis state controls its oscillator's volume:
gain = √probability × scale.
The square root gives a perceptually linear loudness curve. Zero
probability means silence; equal superposition plays all notes as a
chord.
| Gate | N | What It Does |
|---|---|---|
| H | 1 | Hadamard — creates or destroys superposition. |
| X | 1 | Bit flip. The quantum NOT gate. |
| Z | 1 | Phase flip. No change to Z probabilities; rotates X. |
| T | 1 | π/8 phase gate. A gentle Z. Subtle X-basis shifts. |
| ● | 1 | Control marker. Drop in the same step as another gate to make it controlled. Multiple controls in one step give multi-controlled gates (e.g. ● + ● + X = Toffoli). |
| M | 1 | Measurement. Collapses a qubit, creating a mixed state. |
Instead of dedicated CNOT/CZ gates, harmoniq uses a generic control marker (●). Drop a control on one wire and any other gate on another wire at the same step, and the control becomes a predicate for that gate. The control wire and target gate are automatically connected with a vertical line.
This gives you any controlled gate without needing a separate type:
All quantum simulation runs through
Quantum Forge
via the public quantum-forge npm package. Gate
operations, probability queries, and density matrix reads are
delegated to the WASM backend — there is no custom quantum math
in this project.