The FreeTTS java library is more than sufficient in theory, but I could not find a Processing friendly wrapper that actually takes advantage of all FreeTTS has to offer.
Luckily,deep in the recesses of the Processing forum, the user Kof offered this "messy class called Basnik." in response to another user baffled by the same problems.
Kudos to Kof and his brilliant tutorial. He said to "modify as you need," so I did:
I'm not a polished full-stack programmer by any stretch, but this should get the job done.
Here's a cleaned up, beefed up version of his Basnik class that allows for dynamic control of the voice, pitch, volume, tempo, range, transposition, and more.
- Follow his advice and download the FreeTTS speech synthesizer
- Put all the .jar files you download inside a folder called "CODE" within your Processing sketch's folder
- Open a separate tab in your Processing Sketch and paste in this class:
- In your main code, use this as a basic template:
- create as many instances of Basnik as you want - you can thread them together to create polyphonic effects, use variables for dynamic control of the voices, and iterate through string arrays ("String") of words so you can change those controls mid sentence.
I hope you find this useful. Feel free to use and adapt this and make it even better.