Using a better free TTS service

I was looking for a text-to-speech TTS voice generator alternative that is better than the default google_translate which frankly is quite poor quality/sounds very robotic.

After some googling and testing various online demos and checking how they call the service in the backend using Chrome dev tools, I came across murph.ai which not only is very natural sounding and high quality, but also uses a very simple URL request method.
Examples:
https://murf.ai/Prod/anonymous-tts/audio?name=en-US-nate
https://murf.ai/Prod/anonymous-tts/audio?name=en-UK-hazel
https://murf.ai/Prod/anonymous-tts/audio?name=en-CA-ethan

My question now is how do I enable caching for this, similar to how google_translate caches files in the TTS folder, so that I do not make a request to their servers every time? As it is, without caching, this would probably not work without an internet connection and it risks putting too much load on their servers and potentially closing this method / api.

You can try it yourself in the Dev Tools – Services

service: media_player.play_media
target:
  entity_id: media_player.[your_media_player]
data: 
  media_content_id: "https://murf.ai/Prod/anonymous-tts/audio?name=en-CA-ethan&text=Hello.%20I%20can%20say%20anything%20you%20want"
  media_content_type: provider
  metadata:
    title: Hello. I can say anything you want
    thumbnail: "https://brands.home-assistant.io/_/homeassistant/logo.png"
    media_class: app

Unfortunately, the above is not sustainable long-term without a caching solution.
So what I ended up doing is to continue using the default google_translate TTS in automations and manually replace the cache files stored in /config/tts
These don’t seem to ever be overwritten/refreshed so looks safe long term and it’s a straightforward drop-in replacement from murf.ai (ie no need to convert the files)

Hope this helps anyone looking for better voice alerts

Suggestions on how to enable caching are still welcome

So where did you get the voices to put into the folder ? Did you have to purchase Murf.ai first ? A step by step would be nice :slight_smile:

You don’t need a subscription, you can use the Murf.ai preview tool to generate the files:

  • Go to murf.ai/text-to-speech
  • Before anything else, open the Developer Tools of your browser, go to Network tab and clear the results
  • Type in your desired text into the Murf preview page and chose your language and hit play
  • In the Network tab of Dev Tools an audio/media file should be logged; right click it and choose Open in new tab
  • from there you should be able to save your audio file

Alternatively, you can simply edit the url of the media file to whatever text you desire, just replace spaces with %20
https://murf.ai/Prod/anonymous-tts/audio?name=en-US-nate&text=Hi%20there!%20What%20would%20you%20like%20me%20to%20say?

What about HA’s own Piper (Wyoming)