<feed xmlns='http://www.w3.org/2005/Atom'>
<title>sketchbook.git/examples/micscope/test, branch main</title>
<subtitle>A small Zig platform for sketching games and toys</subtitle>
<id>https://git.0x4200.cafe/sketchbook.git/atom?h=main</id>
<link rel='self' href='https://git.0x4200.cafe/sketchbook.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/sketchbook.git/'/>
<updated>2026-11-17T15:15:01Z</updated>
<entry>
<title>micscope off the Store, its takes files written through Host.appendFile</title>
<updated>2026-11-17T15:15:01Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-11-17T03:38:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/sketchbook.git/commit/?id=a1ae80096bd69ee7d92ea9e4564e960d8553395e'/>
<id>urn:sha1:a1ae80096bd69ee7d92ea9e4564e960d8553395e</id>
<content type='text'>
The library could read a file and not write one, so micscope kept its
takes in the Store: a tape appended every frame while recording, which a
save of 64 MiB could not hold (under six minutes of 48 kHz audio, and
micscope allows ten-minute takes). Now a sketch has one call that
writes: f.host.appendFile(name, bytes) appends to `&lt;state&gt;.&lt;name&gt;`, beside
the state file (in .sketchbook/ under `zig build run`), creating it, and
returns the file's path for readFile, or "" when nothing was written. It
is pointer and length in, a C-callconv entry in the vtable like newSound.
Only draw and command have a host, so a write is not replayed, like
sound. The web host writes nothing and returns "". readFile still maps a
file once, so what is appended after is not in what it returned.

A scripted --fresh run works on `&lt;state&gt;.&lt;pid&gt;`; the files it appends to
are `&lt;state&gt;.&lt;pid&gt;.&lt;name&gt;`, and the exit now moves every file of the run
(found by that prefix in the state's directory) to the given name, or
removes them for an export, where it moved the state and its store by
two fixed suffixes.

micscope: State lists the takes (sk.List(Take, 64): id, source) and the
counter, next_id; `update` adds a take when recording starts and removes
one on delete. Each take's samples are `take-&lt;id&gt;.f32` (mono f32 at the
host's rate), appended to by draw as it records and by `open`, which also
puts them straight into Session (the web keeps no files). Session holds
the tape (every take's samples, read from their files once a process)
and a clip per take (start, len, and heard, the playhead, which a restart
no longer keeps); draw makes the tape follow State: a take State lost
leaves it, one it lacks is read from its file. A deleted take's file
stays, so a seek back finds it again; after a jump (start, seek, load,
set, reload) draw moves next_id past take files already written
(--fresh keeps them, and a seek back finds the future's) with a
`next-id N` command. Gone: the Store, the remove request, the `takes N`
command that told State the Store's count, adoptTape. Old
micscope.state.store files are not read: their takes stay in them.

README: appendFile among the host calls, a paragraph on it, and the
private run's appended files.

Tests: zig build test, 164/164 steps, 133/133 tests (one new: appendFile
appends beside the state and names the file). micscope's zig build test,
67/67 steps, 10/10 tests; transport.script reads `takes.len`, loses the
miscounted-takes check with its mechanism, and gains a deleted take read
back from its file after `load` and the counter moved past written files.
Pictures: the four scripts' 18 screenshots before and after, compared by
pixel: the differences are where two runs of one build differ by
themselves (playheads, the microphone's take lengths, the live view).

Co-Authored-By: Claude Opus 5.5 &lt;noreply@anthropic.com&gt;
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
</content>
</entry>
<entry>
<title>examples: micscope and spheres come home, as they were, building</title>
<updated>2026-11-17T15:15:01Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-11-17T03:15:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/sketchbook.git/commit/?id=9bd77e54943d954291b5faef287ccca5dcebd7a4'/>
<id>urn:sha1:9bd77e54943d954291b5faef287ccca5dcebd7a4</id>
<content type='text'>
Both lived outside any repository, beside sketchbook, with manifests that
pointed at ../01-drat-meout/lib/sketchbook, which no longer exists. They
are copied into examples/micscope and examples/spheres (their sources,
shaders, tests, test material and web icons; not their caches, builds,
packages, state files or .gitignore, which the root's covers), their
manifests depend on "../.." as the other examples do, and their
READMEs link sketchbook there. Nothing else changed: both build against
today's library and pass their own zig build test (micscope 62/62 steps,
11/11 tests, its transport, record, render and tuner scripts; spheres
75/75 steps, 3/3 tests, its play script). The originals are untouched.

micscope's test/reference.flac (3.7 MiB, CC BY-SA 3.0, credited in its
test/README.md) is the rendering reference its render script opens. The
README lists both examples.

Co-Authored-By: Claude Opus 5.5 &lt;noreply@anthropic.com&gt;
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
</content>
</entry>
</feed>
