Tagline

The Studio of Eric Valosin

Saturday, October 15, 2016

Processing and FreeTTS speech synthesizer - voice, pitch, tempo, volume control

This summer I participated in an experimental sound art exhibition, and in my quest to create a computer vision based Text-to-Speech sketch in Processing, I discovered there are really no good options out there.

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.

  1. Follow his advice and download the FreeTTS speech synthesizer

  2. Put all the .jar files you download inside a folder called "CODE" within your Processing sketch's folder

  3. Open a separate tab in your Processing Sketch and paste in this class:
  4. In your main code, use this as a basic template:
  5. 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.