Question

I want to load multiple languages to use IVONA SDK with SSML for iPhone. There is no documentation for use in Xcode/objective-C, only the SDK itself is given and several C/java examples.

How can you load multiple languages for text to speach with IVONA SDK for iOS?

EDIT 1: see my code below

load the voices at first:

- (NSInteger) loadVoice: (NSString*) vox {

if(voice != nil) {
    XLog(@"(voice != nil)");
    [voice unload];
    voice = nil;
}


NSString *pathIvona = [[NSString alloc] initWithFormat:@"%@", vox];

self.paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
self.documentsDirectory = [self.paths objectAtIndex:0];
self.path = [self.documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", pathIvona]];



voice = [[IvonaVoice alloc] init:instance withLibrary:self.path withVox:self.path];

[pathIvona release];

if (voice == nil) {
    XLog(@"Cannot load voice");
    [self setTtsError: @"Cannot load voice"];
    return 0;
}
[voice setParam:@"vol" withInteger: 99];
return 1;
}  

trying to load multiple languages to one streamer with (the streamer is still nil, it doesnt change):

NSArray *allVoices = [self getAvaliableVoxes];  

/**
* Here the streamer is still nil, 
* i cant find the mistake here.
*
*/
IvonaStreamer *streamer = [[IvonaStreamer alloc] initWithVoices:allVoices  
withText:[NSString stringWithContentsOfFile:self.path  
encoding:NSUTF8StringEncoding error:&error] atSpeed:[NSNumber numberWithFloat:-1]];

Method getAvailableVoices:

- (NSArray*)getAvaliableVoxes {
XLog(@"-----------------------------------entered");


self.paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
self.documentsDirectory = [self.paths objectAtIndex:0];


NSFileManager *manager = [NSFileManager defaultManager];
NSArray *fileList = [manager contentsOfDirectoryAtPath:[self.paths objectAtIndex:0] error:nil];
for (NSString *s in fileList){
    //XLog(@"s: %@", s);
}


NSMutableArray *pathsIvona = [[NSMutableArray alloc] init];
NSEnumerator *e = [fileList objectEnumerator];
NSString *vox;
while (vox = [e nextObject]) {

if([[vox lastPathComponent] hasPrefix:@"vox_"]) {
        XLog(@"vox: %@", vox);
        [pathsIvona addObject: [vox lastPathComponent]];
        XLog(@"pathsIvona: %@", pathsIvona);
    }   

}

XLog(@"pathsIvona: %@", pathsIvona);

return [pathsIvona autorelease];
}

How can you load multiple languages in one streamer on iOS with IVONA SDK?

Was it helpful?

Solution

perhaps the objects added to the array allVoices do not conform to the expected array of initWithVoices: ...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top