Text To Speech
Another 'because I can' add on function/feature added to TrainThing that really has nothing to do with solving the problem.
The pyttsx3 TTS application is a blocking process. All 'setProperty()' and 'say()' commands are queued and executed with the 'runAndWait' command which is blocking until the queue is empty. With trains running this blocking could cause a sensor change to be missed or other disruption of the fundamental TrainThing operation.
For now 4 ideas:
- During set-up in addition to error messages on the laptop screen, Voice errors i.e. "Only one train can be assigned to travel ..."
- Before starting/during state "zero" announce the path a train will follow (as it exits the staging yard); "RED train assigned Small figure-8 clockwise."
- Announce as the TrainThing progresses from one state to the next; "Starting state 2, transition."
- During set-up give the option to 'follow' one of the trains. Then during run announce each change in path; "YELLOW train starting Big Oval, counter clockwise." "YELLOW train starting assigned Big figure-8 clockwise" "YELLOW train parked."
- Have all TrainThing state voiced in the default male voice.
- Have the 'follow' statements in the female voice to differentiate.
- With the "save_to_file" each voiced line (runAndWait) is saved in a mp3 file. These files can be added to videos, at the appropriate location.