Last active
January 23, 2018 21:07
-
-
Save kashimAstro/4035aaa51b0fa6f32c6b0dd1ac996470 to your computer and use it in GitHub Desktop.
simple script audio synth for openframeworks
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
class ofLogAudio : public ofThread{ | |
public: | |
bool startSpeak = false; | |
string msg; | |
string speak; | |
void start(string _c="/usr/bin/espeak -v mb-it3") | |
{ | |
speak = _c; | |
startThread(true); | |
} | |
void LogAudio(string _msg) | |
{ | |
msg = _msg; | |
startSpeak = true; | |
} | |
void threadedFunction() | |
{ | |
while(isThreadRunning()) | |
{ | |
if(startSpeak) | |
{ | |
ofSystem(speak+" '"+msg+"' > /dev/null 2>&1"); | |
startSpeak = false; | |
} | |
} | |
} | |
}; | |
class ofApp: public ofBaseApp{ | |
public: | |
ofLogAudio log; | |
void setup(){ | |
log.start("/usr/bin/espeak"); | |
log.LogAudio("Hello World"); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment