This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

1{ pkgs, ... }: 2let 3 model = pkgs.runCommand "model" { } '' 4 mkdir -p $out 5 ln -s ${ 6 pkgs.fetchurl { 7 url = "https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/libritts/high/en_US-libritts-high.onnx?download=true"; 8 hash = "sha256-kSelWeEWA/ELNm0aIKx0JoJggdvFId5MJCDFdyjXPw8="; 9 } 10 } $out/model.onnx 11 ln -s ${ 12 pkgs.fetchurl { 13 url = "https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/libritts/high/en_US-libritts-high.onnx.json?download=true"; 14 hash = "sha256-Lv3G1/lUWIuBgBMsvZuAAZM/3QCTLJK8kv0NICip6z0="; 15 } 16 } $out/model.onnx.json 17 ''; 18 19 tts = pkgs.writers.writeBashBin "tts" '' 20 set -efu 21 set -x 22 23 offset=0 24 OUTPUT=$(mktemp -d) 25 trap 'rm -rf "$OUTPUT"' EXIT 26 SPEAKER=$[ $RANDOM % 900 ] 27 while read line; do 28 filename=$(printf '%04d' $offset).wav 29 echo "$line" | 30 ${pkgs.piper-tts}/bin/piper \ 31 --model ${model}/model.onnx \ 32 -s "$SPEAKER" \ 33 -f "$OUTPUT"/"$filename" >/dev/null 34 35 ((offset+=1)) 36 done 37 38 ${pkgs.sox}/bin/sox "$OUTPUT"/*.wav "$OUTPUT"/all.wav 39 cat "$OUTPUT"/all.wav 40 ''; 41in 42{ 43 environment.systemPackages = [ 44 tts 45 ]; 46}