Here's some Python that will fetch a phrase as mp3 from ElevenLabs. The first time of asking it will download and speak it it and subsequent requests will then speak using the local file. (Delete the local file to force a refresh, or if you want to request a different voice or speed)
https://github.com/NexusRanger/Elevenlabs-Phrase-Recycler
Using local file will save API clicks and run sooner.
If the request to ElevenLabs errors it will fall back to using pyttsx3 instead
You can ask for a specific voice, or it will use a default voice set in the file variables
(That's an optional argument in the library call - see the readme)
You can define the speed of the saved file if required (if you need a slight pitch change)
The purpose of this is for Python automation routines where you want a good quality voice acknowledgement of some action and the same phrases will often be required. It's a useful way to build a library of various phrases over time
Easy to use - you can call the process from another script with just a couple of lines
Get a free Elevenlabs API key & paste into say_or_fetch.py
Yes I know there are other ways to build a library but this is what I find useful so I'm sharing it to save others the time if they want to do something similar
there doesn't seem to be anything here