Inital commit, some scripts to easily mess with piper-tts.

This commit is contained in:
Gabe Venberg 2025-10-20 12:14:31 +02:00
commit 2dfb7198fb
5 changed files with 110 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
.direnv
*.onnx
*.onnx.json
*.wav

61
flake.lock generated Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1760878510,
"narHash": "sha256-K5Osef2qexezUfs0alLvZ7nQFTGS9DL2oTVsIXsqLgs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5e2a59a5b1a82f89f2c7e598302a9cacebb72a67",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

28
flake.nix Normal file
View file

@ -0,0 +1,28 @@
{
description = "Basic text to speech repo.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
in
with pkgs; {
devShells.default = mkShell {
buildInputs = [
just
piper-tts
ffmpeg
python3
curl
];
};
});
}

16
justfile Normal file
View file

@ -0,0 +1,16 @@
default-voice := "en_US-ryan-high"
default:
just --list
dl-voice voice=default-voice:
python -m piper.download_voices --download-dir voices {{voice}}
start-server voice=default-voice:
python3 -m piper.http_server --data-dir voices -m {{voice}}
say-now phrase voice=default-voice:
echo "{{phrase}}" | piper -m voices/{{voice}} -f - | ffplay -nodisp -autoexit -
say phrase voice=default-voice:
curl -X POST -H 'Content-Type: application/json' -d '{ "text": "{{phrase}}", "voice": "{{voice}}" }' localhost:5000 | ffplay -nodisp -autoexit -