rhasspy / wyoming-piper

Wyoming protocol server for Piper text to speech system
MIT License
37 stars 11 forks source link

wyoming_piper handler crashes when trying to synthesize any text - File not found #8

Open mxmo0rhuhn opened 9 months ago

mxmo0rhuhn commented 9 months ago

Hi all Thanks a lot for the awesome TTS project! I really enjoy tinkering with it. However, after several working texts yesterday. Piper suddenly stopped working within my Home Assistant installation. I restarted the add-on as well as Home Assistant but nothing seems to work

Versions: Core: 2023.12.3 Supervisor: 2023.11.6 Operating System: 11.2 Frontend: 20231208.2 Piper Add-on version: 1.4.0

Service call:

service: tts.speak
data:
  media_player_entity_id: media_player.sonos_roam
  message: "Today is {{ now().strftime( '%B %d, %Y') }}"
target:
  entity_id: tts.piper

Output of the add-on:

DEBUG:wyoming_piper.handler:Synthesize(text='Today is December 17, 2023', voice=None)
DEBUG:wyoming_piper.handler:synthesize: raw_text=Today is December 17, 2023, text='Today is December 17, 2023.'
DEBUG:wyoming_piper.process:Starting process for: en_US-amy-medium (1/3)
DEBUG:wyoming_piper.download:Checking /data/en_US-amy-medium.onnx
DEBUG:wyoming_piper.download:Checking /data/en_US-amy-medium.onnx.json
DEBUG:wyoming_piper.process:Starting piper process: /usr/share/piper/piper args=['--model', '/data/en_US-amy-medium.onnx', '--config', '/data/en_US-amy-medium.onnx.json', '--output_dir', '/tmp/tmp74pljzel', '--json-input', '--noise-scale', '0.667', '--length-scale', '1.0', '--noise-w', '0.333']
DEBUG:wyoming_piper.handler:input: {'text': 'Today is December 17, 2023.'}
DEBUG:wyoming_piper.handler:
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-531' coro=<AsyncEventHandler.run() done, defined at /usr/local/lib/python3.11/dist-packages/wyoming/server.py:28> 

packages/wyoming/server.py:28> exception=FileNotFoundError(2, 'No such file or directory')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/wyoming/server.py", line 35, in run
    if not (await self.handle_event(event)):
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/wyoming_piper/handler.py", line 98, in handle_event
    wav_file: wave.Wave_read = wave.open(output_path, "rb")
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/wave.py", line 630, in open
    return Wave_read(f)
           ^^^^^^^^^^^^
  File "/usr/lib/python3.11/wave.py", line 280, in __init__
    f = builtins.open(f, 'rb')
        ^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: ''
1848 commented 9 months ago

Same problem here. Tried the master and the v1.4.0 branch.

1848 commented 9 months ago

Found the issue. If you print out stderr from the piper call you will find piper: error: unrecognized arguments: --json-input

I am using the python version of piper by the way: piper-tts

EDIT: Using the cpp version for now, works fine here.

baudneo commented 9 months ago

I am getting this error when using a custom built piper. Not sure how to get the piper binary logs to print to stdout.

llluis commented 8 months ago

I am getting this error when using a custom built piper. Not sure how to get the piper binary logs to print to stdout.

Try what I described here #7 to see if solves your problem.

llluis commented 8 months ago

Found the issue. If you print out stderr from the piper call you will find piper: error: unrecognized arguments: --json-input

I am using the python version of piper by the way: piper-tts

EDIT: Using the cpp version for now, works fine here.

Not sure what you mean by cpp and python version, but I have the --json-input and everything is working (Piper Add-on).

llluis commented 8 months ago

Hi all Thanks a lot for the awesome TTS project! I really enjoy tinkering with it. However, after several working texts yesterday. Piper suddenly stopped working within my Home Assistant installation. I restarted the add-on as well as Home Assistant but nothing seems to work

Piper is crashing when writing the resulting audio wav file, so the instruction to open it to continue is failing. You mention it was working. Anything changed? Missing space in disk, permissions, etc?

mxmo0rhuhn commented 7 months ago

Anything changed? Missing space in disk, permissions, etc?

Unfortunately I did not change anything. I restarted the add-on & the HA server a few times but this did neither result in a consistent result nor a better situation