HomeForumsOpenEars[Resolved] flite and variables

This topic has 2 voices, contains 7 replies, and was last updated by  Halle 186 days ago.

Viewing 8 posts - 1 through 8 (of 8 total)
Author Posts
Author Posts
November 14, 2011 at 5:26 pm #8063

mishapetty

When I insert @” Hello me” into the syntax directly I get Flite to read the text.
But when I use a string variable Flite says nothing. I get no error message. Why is this?

November 14, 2011 at 5:36 pm #8064

Halle

What do you see when you log the contents of the string variable at the time that you pass it to Flite? The odds are pretty great that the string has just autoreleased by the time it is passed to Flite, because as far as FliteController’s concerned there’s no real difference between text that is somehow dynamically assigned to an NSString and an NSString with fixed content.

November 14, 2011 at 5:43 pm #8065

mishapetty

When I do NSLog on the variable I see Hello me. I don’t think it is autoreleasing…
Other suggestions?

November 14, 2011 at 5:53 pm #8066

Halle

Can I ask you to clarify what you mean by variable? It sounds unusual to me because you would ostensibly have some initialized NSString object and at some point it would be assigned a value, either programmatically or at initialization time, with really no difference between those two things. Referring to it as a variable rather than an object with whatever value makes me wonder if there is something nonstandard about your code. Would you like to show the code where you initialize the NSString, something is assigned to it, you log it, and then you pass it to the FliteController method?

November 14, 2011 at 5:58 pm #8067

mishapetty

NSString* BookPath = @”/Users/mishapetty/Desktop/ReadOutLoud3/test.txt”;
NSString* book = [NSString stringWithContentsOfFile:BookPath encoding: NSASCIIStringEncoding error:nil];
NSLog(@”%@”,book);
reading=[[FliteController alloc] init];
[reading say:book withVoice:@"cmu_us_rms8k"];

Here you go…

November 14, 2011 at 6:13 pm #8068

Halle

Try it with NSUTF8StringEncoding if you are reading in text contents.

November 14, 2011 at 7:32 pm #8069

mishapetty

Thank you. That worked!!

November 14, 2011 at 7:39 pm #8070

Halle

Glad to hear it!

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.