Skip to content

Instantly share code, notes, and snippets.

@kashimAstro
Last active January 23, 2018 21:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kashimAstro/4035aaa51b0fa6f32c6b0dd1ac996470 to your computer and use it in GitHub Desktop.
Save kashimAstro/4035aaa51b0fa6f32c6b0dd1ac996470 to your computer and use it in GitHub Desktop.
simple script audio synth for openframeworks
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