feat(speech): the speech capability over Cap'n Web, behind a gate
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
The agent's ears and voice: a server on the home server transcribes a clip (sox, whisper.cpp) and speaks text (piper), one job at a time. A gate hands the capability to whoever presents its key; the key comes from systemd's credentials, not argv. make test runs the unit tests in Nix's sandbox; make smoke starts a real server on localhost, speaks a phrase, and hears it back. Generated-by: Claude Opus 5.5
This commit is contained in:
1 parent
a6e8f97b9f
commit
b3e4eb0336
20 files changed
+621
No files matched your search
@@ -0,0 +1,24 @@
|
||||
# The speech server and clients, with node, and the sox, whisper, and piper the server's scripts use.
|
||||
# bin/speech-server HOST PORT MODEL VOICE [PIPER_OPTION...]
|
||||
# bin/hear-client URL < clip.wav
|
||||
# bin/speak-client URL < text > speech.wav
|
||||
{ callPackage, runCommand, nodejs-slim, sox, whisper-cpp, piper-tts }:
|
||||
let
|
||||
js = callPackage ./default.nix { };
|
||||
dir = "${js}/lib/node_modules/pdtv26-speech";
|
||||
in
|
||||
runCommand "pdtv26-speech" { } ''
|
||||
mkdir -p $out/bin
|
||||
substitute ${./hear.sh} $out/bin/hear.sh --subst-var-by sox ${sox} --subst-var-by whisper ${whisper-cpp}
|
||||
substitute ${./speak.sh} $out/bin/speak.sh --subst-var-by piper ${piper-tts}
|
||||
chmod +x $out/bin/hear.sh $out/bin/speak.sh
|
||||
cat > $out/bin/speech-server <<EOF
|
||||
#!/bin/sh
|
||||
host=\$1 port=\$2 model=\$3 voice=\$4; shift 4
|
||||
exec ${nodejs-slim}/bin/node ${dir}/server.js "\$host" "\$port" $out/bin/hear.sh "\$model" $out/bin/speak.sh "\$voice" "\$@"
|
||||
EOF
|
||||
for c in hear-client speak-client; do
|
||||
printf '#!/bin/sh\nexec %s %s/%s.js "$@"\n' ${nodejs-slim}/bin/node ${dir} $c > $out/bin/$c
|
||||
done
|
||||
chmod +x $out/bin/speech-server $out/bin/hear-client $out/bin/speak-client
|
||||
''
|
||||
Reference in new issue
Block a user