10-09-2018 10:18 AM
I am looking for a modern (Windows 10) method to convert text to speech in CVI. I have tried the 10 year old suggestions here in the forum without success.
Any help is much appreciated.
/Dan
10-11-2018 04:52 AM
Hi Dan,
Below are some ways that other people have implemented text to speech in CVI before:
https://forums.ni.com/t5/LabWindows-CVI/Is-quot-Speech-5-1-SDK-quot-CVI-compatible/td-p/27183
https://forums.ni.com/t5/LabWindows-CVI/Text-to-speech-in-CVI/td-p/7613
Kind regards,
Kelly
10-14-2018 12:09 PM
Thanks Kelly, for trying to help.
I have seen those posts. They are 10-15 years old, I was looking for some more up-to-date for current version of CVI and Windows OS.
As you can see two of them are not on subject, one for LabView and and stupid answer (have people time for such in this forum?).
Though, after some trial-and-error I now have some working code put in a DLL for easy use in CVI. I can share here if interested.
/Dan
11-18-2019 04:23 PM - edited 11-18-2019 04:24 PM
danaxe,
Can you provide an example of what you are using or did? I am porting code from MAC OS X to labwindows on Windows 10 and need and easy text to speech function to use. I had used the MAC OS X API.
Like text_to_speech( const char * )
text_to_speech("Hello World");
Thanks for any feedback
11-20-2019 11:13 AM
I have put together a package with dll and a test program.
Enjoy,
/Dan
11-20-2019 11:29 AM
Thanks,
I ended up finding this link and was able to accomplish without a DLL. I just followed the instructions and just used a portion.
https://wenku.baidu.com/view/24e02d3ee2bd960590c6771a.html
Had to Tools->Create ActiveX Controller, then open the ActiveX controller Wizard Choose Server, Select the Microsoft Speech Object Library, and renamed to TTS.fp as shown in above link. A TTS.h header file is created and just did the minimum.
Quite suprised how good it works. Solved all my issues. One thing though, since CA_InitActiveXThreadStyleForCurrentThread(0,COINIT_APARTMENTTHREADED); is needed per this thread.
void speak_string( char *string )
{
long speech_volume = 100;
long speech_speed = 0; // -10 to 10
CAObjHandle appHandle = 0;
SpeechLib_NewISpeechVoice(NULL,1,LOCALE_NEUTRAL,0,&appHandle); // create a new voice function, the function is to call voice interface functions
SpeechLib_ISpeechVoiceSetVolume(appHandle,NULL,speech_volume); // this function sets the volume 0 to 100
SpeechLib_ISpeechVoiceSetRate(appHandle, NULL,speech_speed);
SpeechLib_ISpeechVoiceSpeak (appHandle, NULL, string, SpeechLibConst_SVSFlagsAsync, NULL); //Read the text
}
Hope this helps others. I downloaded the newest version 11 of what the article mentions for the Microsoft Speech Platform SDK 11 and the SpeechPlatformRuntime 11.