SPB Git

Repository Public

compiler.md 3.0 KB 61 lines markdown

1<!--2ORIX Sonata3File: Documentation/manual/compiler.md4Author: Simon-Pierre Boucher5Contact: contact@spboucher.ai6-->7# Compiler89The Compiler space shows what the last compilation did and produced. Nothing here is10decorative: every number comes from that compilation.1112## Pipeline1314`source → tokens → AST → symbols and types → Musical IR → DSP IR → execution plan`1516The plan is interpreted by the runtime; **no machine code is generated**.1718| Figure | Meaning |19|---|---|20| Lexer, Parser, Semantics, Graph | Time spent in each phase, measured by the compiler for this compilation (not an average). |21| Total | Wall-clock time of the whole call, including what is outside the four phases (studio overrides, JSON, cache lookup). |22| Cache hit | The result came from the content-hash cache: same module texts and options as a previous compilation. |23| Note events, tracks, maximum polyphony | Counted on the Musical IR. Polyphony is the largest number of notes sounding at once, release tails excluded. |24| DSP nodes | Nodes of the mixing graph at the project sample rate. |25| Estimated memory | An estimate of the runtime working set (events, voices, buffers). It is not a measurement. |2627A failed compilation keeps the previous valid program: it is what plays and what the other28spaces show. Diagnostics are grouped by code; click a group to go to its first occurrence.2930## AST, Musical IR, DSP IR3132The three artefacts as trees. Rows exist only for what is open, so a composition with33hundreds of thousands of notes stays usable; a container shows its first 500 children and34says how many it does not show.3536- **Search** matches keys and scalar values, case-insensitive (first 1 000 matches); Return and37  the arrows walk through them, opening the path to each.38- **Keyboard**: ↑ ↓ move, → opens, ← closes, Return shows the node in the code.39- The arrow button on a node with a source span selects that span in the editor. Spans of the40  main source are addressable; nodes that come from an imported module are not, yet.41- **Export JSON…** writes exactly what the compiler returned, atomically.4243The same artefacts on the command line: `sonata build piece.sonata --emit ast|ir|graph`.4445## Graph4647The mixing graph for the project sample rate, laid out left to right in topological columns:48instruments and audio clips, insert effects, faders, sends, bus and master sums, the master49chain, the limiter and the output. **Compensation delays** (amber) are the pure delays the50compiler inserts so parallel paths arrive aligned; the header gives the total latency of the51graph. Click a node for its channel counts, its own latency and the latency accumulated up to it.5253The engine rebuilds this graph at the rate of the audio device when that differs from the54project rate, so the latency in samples can differ there.5556## Tempo map5758Tempo points, time signatures and markers with their time in seconds and their musical59position in whole notes. Seconds come from the tempo map (a ramp is linear in seconds per whole60note); samples are `floor(seconds × rate + 0.5)` everywhere.61
Files main
Menu

Theme