Jump to content

Simplest possible example in pure C++ for voce

Greetings fellow-comrades,

 

I've just downloaded voce, which is a text-to-speech (and vice-versa too) SDK that pairs with Microsoft's Speech API. They have given a couple of examples right on their website, but they're obviously incomplete. I'd like those who've used it to come forward, and help me understand a very simple sample, which is a complete program in C++, and also I'll certainly need help pertaining to the selection of libraries and headers to include.

 

Thanks a metric ton! :) 

Anand S

Nothing to see here ;)

Link to comment
Share on other sites

Link to post
Share on other sites

#include <thread>
#include <chrono>
#include "voce.h"
  
int main()
{
	voce::init(".", true, false, "", "");
	voce::synthesize("fizzle sticks");
	
	std::this_thread::sleep_for(std::chrono::seconds(1));
	voce::destroy();
	return 0;
}

You'll need to:

add "<Java jdk dir>/include" and "<Java jdk dir>/include/win32" to your c++ include path

link with "jvm.lib" found in "<Java jdk dir>/lib"

add "<Java jdk dir>/jre/bin" and "<Java jdk dir>/jre/bin/client" to your system path

have the Voce .jar files next to your .exe (or change the first parameter to voce::init)

 

I think that's all...

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, fizzlesticks said:

#include <thread>
#include <chrono>
#include "voce.h"
  
int main()
{
	voce::init(".", true, false, "", "");
	voce::synthesize("fizzle sticks");
	
	std::this_thread::sleep_for(std::chrono::seconds(1));
	voce::destroy();
	return 0;
}

You'll need to:

add "<Java jdk dir>/include" and "<Java jdk dir>/include/win32" to your c++ include path

link with "jvm.lib" found in "<Java jdk dir>/lib"

add "<Java jdk dir>/jre/bin" and "<Java jdk dir>/jre/bin/client" to your system path

have the Voce .jar files next to your .exe (or change the first parameter to voce::init)

 

I think that's all...

I understand the include and lib dirs, and the code itself is super-simple, but could you explain to me what is system path (is it the PATH variable) ? And change the first parameter of what exactly to voce::init()? Thanks!

Nothing to see here ;)

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Anand_Geforce said:

I understand the include and lib dirs, and the code itself is super-simple, but could you explain to me what is system path (is it the PATH variable) ? And change the first parameter of what exactly to voce::init()? Thanks!

Yes, it's the PATH variable. It tells your program where to search to find the jvm.dll and java.dll it needs.

The first parameter to voce::init() is the Java class path. It tells the JVM where to find the Voce .jars you're using. "." means the current directory. 

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×