Search code examples
c++database-connectiontext-to-speech

Text-to-speech from my file/database?


I've made a little alarm program that is supposed to say one of a few things. There's a similar program on macs, but I couldn't find it for Windows, so I just wrote it in C++. Right now, I'm using a text file. The format of the text file I am parsing should help you to understand how the program works:

alarmName_Wakeup //There's a prefix alarmName, so I know when one list starts and another ends.
Cock-a-doodle-doo! //One thing to say.
Get out of bed! //Another thing to say.
Hello.  Would you like to buy some guava juice? //Yet another thing to say.

So, I'm basically just trying to have the alarm randomly read one of these lines of text every five minutes until the user goes to his or her computer and presses the hotkey or clicks 'Stop Alarm'. I haven't been able to figure out how to get text-to-speech from a file or a database, though. I always need to have the text pasted in notepad or something, which is really shoddy. Please, help me figure out how.


Solution

  • The closest I can find to what I'm looking for is Open-SAPI, which works for both Linux and Windows.