commit 2dfb7198fb715558c3e8a01a4790c2ba2702d377 Author: Gabe Venberg Date: Mon Oct 20 12:14:31 2025 +0200 Inital commit, some scripts to easily mess with piper-tts. diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed7ecf9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.direnv +*.onnx +*.onnx.json +*.wav diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..aa43e24 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7fc6605 --- /dev/null +++ b/flake.nix @@ -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 + ]; + }; + }); +} diff --git a/justfile b/justfile new file mode 100644 index 0000000..04d734a --- /dev/null +++ b/justfile @@ -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 -