Created
October 15, 2016 04:28
The essentials for using my BasnikClass_improved.pde FreeTTS Processing code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.sun.speech.freetts.Voice; | |
import com.sun.speech.freetts.VoiceManager; | |
import com.sun.speech.freetts.audio.JavaClipAudioPlayer; | |
Basnik voice1; | |
Basnik voice2; | |
void setup() { | |
size(640, 480); | |
voice1 = new Basnik("kevin16"); | |
voice1.setRange(1); | |
voice2 = new Basnik("kevin16"); | |
voice2.setRange(1); | |
} | |
void draw() { | |
// call functions to set the voice controls. Use variables to set them dynamically | |
voice1.setPitch(220); | |
voice2.setPitch(330); | |
voice1.setVolume(1); | |
voice2.setVolume(1); | |
voice1.setTempo(150); | |
voice2.setTempo(150); | |
// speech | |
voice1.say("this is voice 1"); | |
voice2.say("this is voice 2"); | |
// harmony | |
thread("voice2"); //second voice threaded to get both voices to speak at once | |
voice1.say("this is harmony"); | |
} | |
void voice2() { | |
// delay(50); //may or may not need a small delay to get the voices in sync | |
voice2.say("this is harmony"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment