This repository was archived by the owner on Oct 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 890
This repository was archived by the owner on Oct 6, 2025. It is now read-only.
Only the first sentence is read when using the standard output as output file #815
Copy link
Copy link
Open
Description
As the following examples show, when the text to read turn into voice contains multiple sentences, and I am using the standard output as output file, piper would fail:
(venv) myuser@my-linux:~/piper$ echo "First sentence." | piper --model en_US-amy-medium.onnx --output-file - | wc -c
58924
(venv) myuser@my-linux:~/piper$ echo "First sentence. Second sentence." | piper --model en_US-amy-medium.onnx --output-file - | wc -c
Traceback (most recent call last):
File "/home/myuser/piper/venv/lib/python3.12/site-packages/piper/__main__.py", line 151, in main
voice.synthesize(text, wav_file, **synthesize_args)
File "/home/myuser/piper/venv/lib/python3.12/site-packages/piper/voice.py", line 103, in synthesize
wav_file.writeframes(audio_bytes)
File "/usr/lib/python3.12/wave.py", line 578, in writeframes
self._patchheader()
File "/usr/lib/python3.12/wave.py", line 633, in _patchheader
curpos = self._file.tell()
^^^^^^^^^^^^^^^^^
OSError: [Errno 29] Illegal seek
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/myuser/piper/venv/bin/piper", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/myuser/piper/venv/lib/python3.12/site-packages/piper/__main__.py", line 150, in main
with wave.open(sys.stdout.buffer, "wb") as wav_file:
File "/usr/lib/python3.12/wave.py", line 471, in __exit__
self.close()
File "/usr/lib/python3.12/wave.py", line 585, in close
self._patchheader()
File "/usr/lib/python3.12/wave.py", line 633, in _patchheader
curpos = self._file.tell()
^^^^^^^^^^^^^^^^^
OSError: [Errno 29] Illegal seek
121900
(venv) myuser@my-linux:~/piper$ echo "First sentence.\nSecond sentence." | piper --model en_US-amy-medium.onnx --output-file - | wc -c
148012
(venv) myuser@my-linux:~/piper$ echo "First sentence. Second sentence." | piper --model en_US-amy-medium.onnx --output-file my.wav && ls -lh my.wav && rm my.wav
-rw-rw-r-- 1 myuser myuser 119K Jun 28 23:50 my.wav
I really need this to work, because I'm trying to use Piper in Open WebUI through a Python script as OpenAI Speech API endpoint, and I can't accept writing to temporary files.
Thanks in advance.
PS.: Installing piper-tts was already a challenge, due to no compatible piper-phonemize version being available, see: rhasspy/piper-phonemize#33 (comment) .
Metadata
Metadata
Assignees
Labels
No labels