rhasspy / piper

A fast, local neural text to speech system
https://rhasspy.github.io/piper-samples/
MIT License
4.37k stars 297 forks source link

Quiet Mode #463

Closed the-arkhive closed 1 month ago

the-arkhive commented 1 month ago

I've made a simple bash script to take my voice, transcribe it, feed that to a LLM and then output the result through Piper. The script itself works great, but I'm looking to clean up my command line while suing it. All the other tools I'm using have logging modes to suppress terminal output, or I can just send outputs to /dev/null. As far as I can tell based on the documentation Piper either doesn't have this option or it isn't documented in any way. Trying the same >/dev/null 2>&1 trick just ends up sending the audio, effectively muting Piper.

Any assistance would be great!

jn64 commented 1 month ago

What text output specifically are you getting from piper that you want to suppress?

Trying the same >/dev/null 2>&1 trick just ends up sending the audio, effectively muting Piper.

Send only stderr to /dev/null, i.e. 2>/dev/null

If you need more help please give an example command

the-arkhive commented 1 month ago

Sorry, should have included the output I'm looking ti suppress.

Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
[2024-04-13 01:00:32.861] [piper] [info] Loaded voice in 0.510618259 second(s)
[2024-04-13 01:00:32.865] [piper] [info] Initialized piper
[2024-04-13 01:00:44.554] [piper] [info] Waiting for audio to finish playing...
[2024-04-13 01:00:58.918] [piper] [info] Real-time factor: 0.17720824387626397 (infer=3.0901903070000003 sec, audio=17.438185941043084 sec)
[2024-04-13 01:01:01.388] [piper] [info] Waiting for audio to finish playing...

The bash script I made looks like this.

#!/bin/sh

ffmpeg -y -f alsa -i default -acodec pcm_s16le -ac 1 -ar 44100 -t 4 -f wav ~/.cache/audio.wav >/dev/null 2>&1

vosk-transcriber -m ~/.config/speechmodels/vosk/vosk-model-small-en-us-0.15 -i ~/.cache/audio.wav -o ~/.cache/transcript.txt >/dev/null 2>&1

PROMPT=$(cat ~/.cache/transcript.txt)

tgpt -w "${PROMPT}" | ~/.config/speechmodels/piper/piper --model ~/.config/speechmodels/piper/en_GB-cori-high.onnx --output-raw | aplay -D "default" -r 22050 -f S16_LE -t raw -
jn64 commented 1 month ago

First line is from aplay, not piper. Give aplay -q or --quiet

Rest of the lines are from piper (seems specific to C++ version?). piper also has -q or --quiet in latest release (after v1.2.0). See https://github.com/rhasspy/piper/issues/270#issuecomment-1811437985

the-arkhive commented 1 month ago

Ahh, okay. I was trying this and it was still not working, but I realized it was because I downloaded the version linked in the readme for 64 bit desktop linux, which would seem to be an older version that does not include the quiet option. I went to the releases page, downloaded the appropriate version, and everything is working fine. Thanks so much for the help, though unless there is some specific reason to keep the old version there it might be worth updating those links. Marking as closed.