LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-21-2010, 09:13 PM   #1
transmogrifox
LQ Newbie
 
Registered: Jan 2009
Posts: 12

Rep: Reputation: 1
Festival C++ API and pthread()


Hi all. I am attempting to write a program using Festival as the TTS output. It is a weather system, so
1) takes raw data from sensors on the input.
2) converts it into a text message
3) let festival take the message and turn it into audio that I can then route out to the telephone system.

Here is my main block of code using festival:
Code:
void *process(void* buf)
{
      char *message;
      message = (char *) buf;
      printf("%s", message);
     
     EST_String words = message;
   printf("it's called here \n");
   
  for(int i = 0; i<20; i++) {  
       printf("%s\n", message); 
   festival_say_text(words);
   usleep(900000);
   printf("finished festival\n\n");
   }
If in the main calling function I call it directly:
Code:
process(buf)
It works as expected.

However, if I try to put it into another thread:
Code:
pthread_create( &process1, NULL, process, (void*) sbuf);
I get the following output:
Code:
SIOD ERROR: the currently assigned stack limit has been exceded
which is coming from the function
Code:
festival_say_text(words);
I imagine some of my problem is being a C/C++ newbie, but is there anybody out there able to give me some hints? Maybe there is a different or better way to fork that process.

My plan is to keep updating the buffer whose pointer is passed to the function process() with my serial port processing program in the main loop. I can protect it with a mutex during the festival_say_text() function, but otherwise it will be accessible. If there are other ways to fork a process than pthread, then also those types of hints may help too.

Thanks in advance.
 
Old 10-22-2010, 11:40 AM   #2
transmogrifox
LQ Newbie
 
Registered: Jan 2009
Posts: 12

Original Poster
Rep: Reputation: 1
Solved

For those interested in my problem here is what I did wrong:

The festival engine is initialized by the following code:
Code:
void init_process()
{
     printf("process initialization...\n");
    int heap_size = 210000;  // default scheme heap size
    int load_init_files = 1; // we want the festival init files loaded
    festival_initialize(load_init_files,heap_size);    
    printf("process initialized \n");
}
I discovered that needs to be called within the same thread, like this:
Code:
void *process(void* buf)
{
      init_process();
      char *message;
      message = (char *) buf;
      printf("%s", message);
     
     EST_String words = message;
   printf("it's called here \n");
   
  for(int i = 0; i<20; i++) {  
       printf("%s\n", message); 
   festival_say_text(words);
   usleep(900000);
   printf("finished festival\n\n");
   }

}
I had been calling it from the main program prior to sending it off into a thread.

Of course, the printf() statements, for loop and usleep() are all just debugging code My for loop will turn into a while loop that will go on indefinitely.

I hope this is of some value to somebody else.
 
Old 03-16-2020, 07:36 PM   #3
bb_
LQ Newbie
 
Registered: Mar 2020
Posts: 1

Rep: Reputation: Disabled
thanks for leaving this description; i've hit the same problem (many years later)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
libtest.a uses pthread: user of libtest.a should not link pthread again debulu Programming 2 01-31-2007 09:23 PM
Festival rvijay Linux - Software 5 09-28-2006 05:04 PM
Two Issues with Festival irfanhab Slackware 2 09-01-2006 11:48 PM
Festival ORiGiNAl-SiN Slackware 1 12-25-2005 01:20 AM
festival and c++ ximiansavior Programming 1 12-04-2003 12:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration