feat(box): the box's NixOS system as a module, and lib.mkBox from a few names

The box within reach of the couch: a Raspberry Pi 3B with the AIY Voice
HAT, from the first household's configuration, made generic.

- box/body: the button service, in Python: press and talk, turns by
  voice, a press interrupts; the look signal
- box/*.js: the ir and look capabilities, behind gates, for the brain;
  the ask client, the box's side of a conversation
- box/module.nix: the services, each confined to the devices and
  addresses it needs; the private network as an option (a tailnet by
  default); the Pico found by its USB IDs, as /dev/pdtv26-ir
- box/voicehat.nix: the Voice HAT's device tree overlay and ALSA setup
- lib.mkBox: a box's whole system from its name, the home server's,
  the Wi-Fi network's, and who looks after it
- checks: box-js, box-py (doctests and pyflakes), and box-system (an
  example box's system evaluates)

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-12-02 18:57:03 -06:00
1 parent 2e7156dc36
commit 190600a696
35 files changed
+2152 -3

No files matched your search

Executable
+29
View File
@@ -0,0 +1,29 @@
#!/bin/sh
# earcons.sh DIR: the box's earcons, told apart by contour; low and long enough for older ears.
# 16 kHz, the mics' rate: they play while the mics record, on one I2S bus.
# open C E G rising, with a little echo: a press; a conversation starts; your turn
# turn one soft G: your turn again
# gotit E C falling, short: heard you; thinking
# huh D A low: didn't catch that; your turn again
# bye G E C falling, with echo: the conversation is over
# look A A, two quick taps, like a shutter: the brain is looking through the camera
set -eu
dir=$1
mkdir -p "$dir"
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
note() { # note NAME HZ SECONDS GAIN
sox -R -n -r 16000 -c 1 -b 16 "$tmp/$1.wav" synth "$3" sine "$2" fade q 0.005 "$3" 0.04 gain "$4"
}
note C5 523.25 0.09 -7; note E5 659.25 0.09 -7; note G5 783.99 0.09 -7
note G5soft 783.99 0.14 -11
note E5s 659.25 0.07 -9; note C5s 523.25 0.10 -9
note D4 293.66 0.12 -6; note A3 220.00 0.16 -6
note A5 880.00 0.06 -9
sox -n -r 16000 -c 1 -b 16 "$tmp/gap.wav" trim 0 0.08
sox -R "$tmp/C5.wav" "$tmp/E5.wav" "$tmp/G5.wav" "$dir/open.wav" echo 0.8 0.7 60 0.3 pad 0 0.1
sox -R "$tmp/G5soft.wav" "$dir/turn.wav" echo 0.8 0.7 60 0.3 pad 0 0.05
sox -R "$tmp/E5s.wav" "$tmp/C5s.wav" "$dir/gotit.wav" pad 0 0.05
sox -R "$tmp/D4.wav" "$tmp/A3.wav" "$dir/huh.wav" pad 0 0.05
sox -R "$tmp/G5.wav" "$tmp/E5.wav" "$tmp/C5.wav" "$dir/bye.wav" echo 0.8 0.7 60 0.3 pad 0 0.1
sox -R "$tmp/A5.wav" "$tmp/gap.wav" "$tmp/A5.wav" "$dir/look.wav" pad 0 0.05