FreePBX Weather Forecast

I would concatenate the resulting .wav files with sox to write one .wav file that you can play, It will sound ‘unnatural’ but you could try festival if want a robotic version a little easier

How would I set that up.

I will leave that as a exercise for the student :wink:

man sox

So does this go in the dial plan

for i in $(curl -sf “https://api.weather.gov/gridpoints/EPZ/106,54/forecast”|jq -j '.properties.periods[0:5]|.[]|.name +" “+(.temperature|tostring)+” degrees " '); do echo $i;done

and then write the words to a .wav file and then play back the .wav file.

No, that would all be done in the AGI script you will have to write.

TTS could however be done in the dialplan, get the string, send it to google/amazon/IBM, whatever, playback() the result.

So I put the curl with the api in the AGI script and then use concatenate in the script.

You can do anything you want, I wont write it for you but I have given you all the bits you need.

There are TTS recipes here in these fora

being one good place to start, (kudos to @lgaetz )

edit: OOPS, that’s speech to text but the recipe is still basically good for text to speech

TTS sounds ‘natural’, is mostly free for small volumes and will save you a lot of RTFM’s.

You could cronjob it every 12 hours (completely outside any asterisk/dialplan integration) and have a prebuilt .wav file ready for your location and easily added to your dialplan without ever going over your monthly free allowance of 500 minutes

I’m just not understanding your reticence to try it.

paste

This Afternoon, the forecast is A slight chance of rain showers between 1pm and 2pm, then a slight chance of showers and thunderstorms between 2pm and 4pm. Mostly sunny, with a high near 64. West northwest wind around 18 mph, with gusts as high as 26 mph. New rainfall amounts less than a tenth of an inch possible.--Tonight, the forecast is Mostly clear, with a low around 41. North northeast wind 8 to 16 mph, with gusts as high as 23 mph.--Sunday, the forecast is Sunny, with a high near 70. East wind 5 to 9 mph.--Sunday Night, the forecast is Mostly clear, with a low around 43. East southeast wind 7 to 10 mph.--Monday, the forecast is Sunny, with a high near 79. South wind 7 to 12 mph. 

into

https://www.ibm.com/demos/live/tts-demo/self-service/home

to hear what it would sound like

1 Like

How do I set the api up with IBM Watson to convert the forecast to a .wav file?

You need an account with IBM, use the key they provide and 'RTTheirFManual?

https://cloud.ibm.com/apidocs/text-to-speech

Choose your preferred language on the right.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.