This commit is contained in:
Lennart J. Kurzweg (Nx2)
2024-10-09 23:32:39 +02:00
parent d46530edd8
commit 7639bed3fe

18
home-modules/tts.nix Executable file
View File

@@ -0,0 +1,18 @@
{ pkgs, lib, user, ... }:
lib.mkIf (user != "tv")
{
home.packages = with pkgs; [
(writeShellApplication {
name = "ttss";
text = let
cmd = inp: "piper -m /home/nx2/tts/en_GB-cori-high.onnx --output_raw ${inp} | ffmpeg -hide_banner -loglevel error -f s16le -ar 22050 -ac 1 -i - -f wav - | mpv -";
in /* bash */ ''
if [ -p /dev/stdin ]; then
${cmd "</dev/stdin"}
else
${cmd ''<<< "$@"''}
fi
'';
})
];
}