Skip to content

Record tapes, and hear them while they play - #6

Merged
BlueJayLouche merged 6 commits into
mainfrom
recorder
Oct 14, 2026
Merged

BlueJayLouche merged 6 commits into
mainfrom
recorder

Conversation

@BlueJayLouche

Copy link
Copy Markdown
Owner

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.

  • Start: press Record with the deck stopped, wait for ARMED, press Play. The master begins one second before the tape's first sound, and a click does not count as the tape.
  • End: the side ends by itself after the deck has been stopped for 30 seconds, three seconds after its last sound. The stop level (blue mark) is learned from the lead-in, or set by hand and movable during a side. A target max (orange mark, −6 dBFS by default) and "loudest so far" help set the gain.
  • Stopping by hand: Stop needs two presses while sound is coming; once the deck has stopped the button reads End side now. Cancel while armed records nothing.
  • Recording a side again: a taken name is refused, then offered for recording again; the old master goes to the bin.
  • Problems are reported: clipping and any sound lost are reported with their times. After a crash, the cut-short recording is named the next time the panel opens.
  • Monitor: plays the input through to a chosen output, as recorded or with one track in both ears. It is a separate program and takes no part in the master.

How it is built

app.py --record is the recorder, a program of its own; app.py --monitor is 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.
  • By hand on an Audient iD44 with a cassette deck: 301 tenths of a second arrived in 30.0 s of clock; a 20 s side came out at exactly 960,000 frames; a real side was taking in 20.0 s of sound per 20.0 s of clock with nothing lost. Monitoring was run silently, inputs 3–4 to BlackHole: the inputs' noise floor arrived there, and with "left in both ears" left and right were identical.
  • The panel was driven in a headless browser against a made-up tape playing at real speed, with presses held as long as a hand holds them.

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

BlueJayLouche and others added 6 commits October 14, 2026 21:51
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>
@BlueJayLouche
BlueJayLouche merged commit e2bdea8 into main Oct 14, 2026
3 checks passed
@BlueJayLouche
BlueJayLouche deleted the recorder branch October 14, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant