TTS saved to a local wav file

Hi all!

My goal is to create a wav (raw PCM) file from a text prompt and save the file to the file system in a www folder that I can access with HA URL directly.

In media, I can play on the web browser the text file generated audio in piper and HA cloud. It’s quite nice!

But is there a way to save this wav file to a local folder? I tried many things in dev mode actions, but nothing point to a solution there.

Maybe with API calls from node-red?

Other options?

In my tts folder there is a bunch of cached tts files.
These are saved by default I believe unless you untick the cache.
Can’t you use those?

I could, and I see those with certain config. But, i’m looking to create wav file, according to piper doc, I could, but don’t know how. Also, I would like to have those file created from a script or API call, to automate their creation.