0 votes
by (130 points)

##Trying to get Win' task-scheduler to open a Twine story AND read it to me (either via Edge Read aloud OR a Chrome addon, Windows narrator...)##

1) I used Twine to setup my daily routine Q&A and guide me through a flowchart of the time I wake up --> I start being productive

2) I used Windows Task Schedule ==> My twine story opens every day at a certain time.  

3) GOAL: Improve it --> so Task scheduler doesn't --just-- open the Twine-story/HTML page but also reads it to me out loud (TTS).

--

--

Currently: Task sched' opens the html page (Twine story) but doesn't read it out loud

Desired: Open the page AND read it to me ...

--- was thinking that maybe there's an argument I can add to run a Chrome addon that will make it read it to me ?

1 Answer

+1 vote
by (44.7k points)

I don't know much about the text to speech tools you named, but if you put the following code into any Twine story that uses the SugarCube story format, then it should read the text within each passage:

$(document).on(":passagerender", function (ev) {
	var synth = window.speechSynthesis;
	var utterThis = new SpeechSynthesisUtterance(Story.get(passage()).text);
	utterThis.voice = speechSynthesis.getVoices()[0];
	synth.speak(utterThis);
});

That code uses the speech synthesis system built into some browsers.  However, you will probably need to use Firefox to open the HTML file, since, just this month, Chrome and Opera changed their browsers to require user interaction before the speech synthesis system can work.

There is probably a way to convert that code to work in Harlowe, but I don't use Harlowe myself, so I can't help with converting it.

You should be able to use the speech synthesis code I gave above to implement other systems as well, such as if you want it to only speak the passage if you hit a certain key.

For details on the speech synthesis system, you can read through the Mozilla Developer Network documentation on the SpeechSynthesis API here.

I hope that helps!

by (130 points)

Sending you HUGE virtual-hugs HiEv 

Move to Sugarcube and Speechsynth' it is ! Thanks 

 

ps: started looking at using macros and it was getting somewhat complicated. . . 

ps#2: Task Scheduler is just a super easy Windows mechanism that runs my Twine story periodically (every day at 8am for example)

 

...