P1a: material import, sixteen faces, sample engine and quarry

This commit is contained in:
Emil
2026-11-01 00:56:51 +03:00
parent db4368efae
commit ebdeca3b92
28 changed files with 2799 additions and 114 deletions
+55
View File
@@ -91,3 +91,58 @@ The browser sets `binaryType = "arraybuffer"` and reads a `DataView`. The frame
- Project/asset commands.
- Agent tools and MCP.
- Per-client cursors or collaboration.
## P1a additions
The protocol remains version 1; the additions are backward-compatible for the P0 surface (unknown fields are ignored).
### Cores
```json
{
"type": "import_core",
"id": 100,
"name": "clicks-01.wav",
"seal": "found"
}
```
The next binary frame from the client is the encoded audio. The daemon answers with:
```json
{"type":"imported","id":100,"core":{
"id":"core-f298c4956d","name":"clicks-01","seal":"found",
"sample_rate":48000,"duration_sec":2.6,
"faces":[{"index":0,"rank":9,"start_sec":0.0,"end_sec":0.14,"rms":0.14}],
"peaks":[0.0,0.32,...]
}}
```
A snapshot follows and is broadcast to every client. `state.cores` carries the same summaries.
### Pattern rows
```json
{"vein":"bass","face":{"core":"core-f298c4956d","face":10},"velocities":[112,0,...]}
```
`face: null` means the procedural voice for that vein.
### Commands
| command | args | journal |
|---|---|---|
| `strike_face` | `core`, `face`, `velocity` 0..1 | no |
| `set_pattern_step` | `row` 0..4, `step` 0..15, `velocity` 0..127 | yes |
| `set_pattern_face` | `row`, `core`, `face` | yes |
Events: `pattern_step`, `pattern_face`, `face_struck`.
### Import semantics
- The import header must arrive immediately before the binary payload on the same connection.
- The daemon decodes in a blocking task; the meter stream and other clients continue.
- The archive id is a content hash prefix (`core-` + 10 hex); the same bytes get the same id.
- The import is journaled on the session as `import_core` (journal-only; clients cannot send it as a command).
- If the file cannot be decoded or is too short, the requester receives `error` with the import id.