| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`pub const audio_pull = 256`; each frame `draw` runs synth.comp over as
many samples as keep the host's lead queued (`in.lead -| queued`, 8192
at most) and streams the block with f.audioBuffer, as spheres does. Time
is a sample clock in Session: set from State's time at every jump (a
seek, a step, a replay's start; the queue is dropped then, so the jump is
heard at once), and free-running otherwise, so a paused replay keeps
sounding its moment. When the out tape differs from the one the last
block played, the block crosses from the old tape to the new over its
length (`set crossfade false` turns that off, to hear what it saves).
The blocks are read back for the scope (an oscilloscope and a spectrum
along the bottom) and, after the console's `capture`, appended to the
sketch's capture.f32 beside its save. The status line shows the lead.
The tapes reach synth.comp in a storage buffer, uploaded per block: two
tapes are 4 KiB, and SDL_GPU's Vulkan backend binds a uniform block 4
KiB at a time (MAX_UBO_SECTION_SIZE), so a 4128-byte Synth block read its
count as 0 past the cut and the kernel wrote nothing, silently: the
probe's first synth numbers timed that. Measured again (RTX 3050, Debug
host, two runs): every synth dispatch 0.08-0.14 ms, 60 or 128
instructions, 256 or 1024 samples, fading or not, the empty pass's cost
alone; the 4 KiB upload 0.07-0.08.
Measured on SDL's dummy driver (nothing audible) from captures:
out = 0.3 * sin(t * tau * 220): peak 0.3000, RMS 0.2121, fundamental
220.000 Hz; edited to 330 in one keystroke, 330.000 Hz. The largest
sample-to-sample step across the edit: 0.0131 with the crossfade (a
330 Hz sine's own steepest step is 0.0130), 0.3725 without; into the
first sound, 0.0011 and 0.2967. The survey's program: peak 0.50, RMS
0.16, its bass at 55.0 Hz.
Test: live.script also expects the stream to receive the GPU's blocks,
and compares screenshots above the scope. zig build test: 68 of 68 steps.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
|
|
|
The sketch: State holds the text (a plain 4 KiB buffer, typed characters
appended, backspace deleting the last, return a newline: marked ponytail,
the place pardes's editor takes in part 2), the last good out and color
tapes, the problem and the time, summed from recorded ticks. `update`
compiles the text at every keystroke; a program that parses replaces the
tapes and clears the problem, one that does not sets the problem and
changes nothing else, so the last good picture stays.
`draw` runs picture.frag over the color tape into an image the size of
the canvas, 1280x720, or half of it when the tape is longer than 64
instructions (the probe: 128 took 2.7 ms at full size, 0.85 at half),
and scales it up. The text is drawn over it on a dark band with the
library's text calls (the code face at 1.25, a column a fixed advance),
the caret at the end, the problem as a red mark under its byte and its
words under the text, and live/recording/replay/paused with the time in
a corner.
Test: test/live.script, the start of the scripted proof: a tone typed
(its eight instructions asserted), a gradient (hsv over x and y, four),
an edit (y to x: three, the picture different), a broken line (the
problem at byte 52, the tape and the picture the same) and its mend.
zig build test: 56 of 56 steps, 6 of 6 tests.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
|