Last active
September 26, 2015 01:28
-
-
Save getflourish/1017503 to your computer and use it in GitHub Desktop.
STT Example
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
/* | |
// This is a basic example to demonstrate how the Speech-To-Text Library | |
// can be used. See http://stt.getflourish.com for more information on | |
// available settings. | |
// | |
// Florian Schulz 2014, www.getflourish.com | |
*/ | |
import com.getflourish.stt.*; | |
STT stt; | |
String result; | |
void setup () | |
{ | |
size(600, 200); | |
// Init STT with default manual record mode | |
String key = "YOUR API KEY"; | |
stt = new STT(this, key); | |
stt.enableDebug(); | |
stt.setLanguage("en"); | |
// Some text to display the result | |
textFont(createFont("Arial", 24)); | |
result = "Say something!"; | |
} | |
void draw () | |
{ | |
background(0); | |
text(result, mouseX, mouseY); | |
} | |
// Method is called if transcription was successfull | |
void transcribe (String utterance, float confidence) | |
{ | |
println(utterance); | |
result = utterance; | |
} | |
// Use any key to begin and end a record | |
public void keyPressed () { | |
stt.begin(); | |
} | |
public void keyReleased () { | |
stt.end(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment