Repository navigation
Record tapes, and hear them while they play - #6
Merged
Merged
Conversation
On a Mac, Record… transfers a tape through any sound input and makes the master: a 24-bit, 48 kHz stereo WAV written into the session's recordings folder as <tape>/<side>.wav, then transcribed without being asked. - Press Record with the deck stopped, wait for ARMED, press Play. The master begins a second before the tape's first sound; a click is not the tape. - The side ends by itself once the deck has been stopped for 30 seconds, three seconds after its last sound. The stop level is learned from the lead-in, or set by hand on a slider and moved while a side runs. A target-max slider and "loudest so far" are there for setting the gain. - Stop asks twice while sound is still coming; once the deck has stopped it reads "End side now". A name already used can be recorded again; the old master goes to the bin. - Monitor plays the input through to a chosen output, as recorded or with one track in both ears. It is a program apart from the recorder and takes no part in the master. The recorder is `app.py --record`, a program of its own. Sound comes from the sound system through sounddevice/PortAudio, every buffer queued. An earlier version read ffmpeg's Mac input, which keeps only the newest buffer: on the interface this was built with it lost one buffer in nine. The recorder now reports any sound lost, from PortAudio's overflow flag and from jumps in the buffers' own clock. The file on disk is a playable WAV at every moment, finished properly on quitting, and named next time after a crash. The page no longer rewrites unchanged text: redrawing a button several times a second can lose a press in the Mac's web view. smoke.py records from a file standing in for the input, on every system. Monitoring and the real devices are Mac only and were tried by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows the ffmpeg started by the recorder to play the stand-in file never delivered anything. Tests only ever give it a WAV, which needs no ffmpeg: 16- and 24-bit come out as the same 24-bit samples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows the recorder never got past loading numpy: it did so after starting the thread that waits on standard input, and loading it while that thread waits on the pipe does not finish. The signposts used to find this are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 1 of recording, as agreed: the recorder, with the side transcribed as soon as it ends. Transcribing while the tape plays is stage 2 and not in this.
What it does (Mac)
Record… (beside Recordings…) transfers a tape through any sound input into a 24-bit, 48 kHz stereo WAV in the session's recordings folder, as
<tape>/<side>.wav.How it is built
app.py --recordis the recorder, a program of its own;app.py --monitoris the pass-through. Capture is sounddevice (PortAudio), a new dependency on macOS only, with every buffer queued. The first version used ffmpeg's avfoundation input, which keeps only the newest buffer; on an Audient iD44 it lost 85 buffers of 512 samples in 8 seconds (11.3%), shown by the buffers' own time stamps. The recorder now flags lost sound from PortAudio's overflow flag and from jumps in the buffers' clock. The WAV header is kept current, so the file on disk always plays.Also: the page now only sets text that has changed, because redrawing a button many times a second can lose a press in the Mac's web view.
Tested
app.py --check: made-up sides go through the keep/stop logic and the master is compared byte for byte (lead-in, pauses, the end, a tape already running, a hand-set and a moved stop level, clipping, the WAV header).smoke.py, on all three systems: a file stands in for the input. A side is recorded, ends by itself, matches what was played sample for sample, and is transcribed; recording it again sets the old one aside; monitoring is refused with no output.Not tested: the panel in the Mac's own window, monitoring through real speakers, and recording on Windows or Linux (not offered there).
🤖 Generated with Claude Code