register_cmu_us_kal() function in flite

791 Views Asked by At

I'm a beginner to unix as well as to the flite.

#include "flite.h"

cst_voice *register_cmu_us_kal();

int main(int argc, char **argv)
{
    cst_voice *v;

    if (argc != 2)
    {
        fprintf(stderr,"usage: flite_test FILE\n");
        exit(-1);
    }

    flite_init();

    v = register_cmu_us_kal(NULL);

    flite_file_to_speech(argv[1],v,"play");

}

From the above program i understand that the register_cmu_us_kal() would return a english voice. and the file entered in argv[1] will be read in english.

cst_wave *flite_text_to_wave(const char *text,cst_voice *voice); => for text to wave

I'm working on a project where application code is already there and i want to convert the text displayed into voice. register_cmu_us_kal() i could not understand what it does. How to see the different functions available in flite.h library and its functionality.

Please help to understand

1

There are 1 best solutions below

0
On

the file entered in argv[1] will be read in english.

cst_wave *flite_text_to_wave(const char *text,cst_voice *voice); => for text to wave

This function will return a cst_wave* and not read it out, the function to read the given text out is

float flite_text_to_speech(const char *text, cst_voice *voice, const char *outtype);

which should be called as flite_text_to_speech("Hello world!", v, "play");.

The function cst_voice *register_cmu_us_kal(const char*); is called to register with the flite engine that this cst_voice is going to be used by your program. To see a list of voices available on the machine, the command

flite -lv

can be given. My machine outputs

Voices available: kal awb_time kal16 awb rms slt

Hence I could register all the above voices to be used with the flite_text_to_speech function.