Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to select the voice beside the language? #3

Closed
ptykamikaze opened this issue Sep 13, 2018 · 17 comments
Closed

Is it possible to select the voice beside the language? #3

ptykamikaze opened this issue Sep 13, 2018 · 17 comments
Assignees

Comments

@ptykamikaze
Copy link

In the nuance's website you can select the language and the voice so I was trying to find something in the documentation that describe how can I select the voice (if it is possible)

@Shmarkus
Copy link
Owner

Hello, thanks for your feedback! I belive it is possible to do it in the SDK but not in the plugin at the moment. I can implement it, if you are willing to test

@Shmarkus Shmarkus self-assigned this Sep 14, 2018
@ptykamikaze
Copy link
Author

Hello! Yes! I'm willing to test this.

@Shmarkus
Copy link
Owner

Very good. Are you using the plugin through Ionic or via cordova?

@ptykamikaze
Copy link
Author

Through Ionic

@Shmarkus
Copy link
Owner

Thanks for the info. The implementation is in progress, but I'll be away for a week, so no progress in the next week.

@Shmarkus
Copy link
Owner

Shmarkus commented Oct 4, 2018

Hi, the voice parameter is added in version 2.0.0. The sample app is updated to reflect these changes. The caveat here is ionic-native, which takes time to approve pull requests. The pull request to watch is danielsogl/awesome-cordova-plugins#2761

If you are eager to check it out now, I can send the compiled code (or you can clone https://github.com/Shmarkus/ionic-native repository and build the distribution package. from there, copy dist/@ionic-native/speechkit to your projects node_modules/@ionic-native/speechkit

@Shmarkus
Copy link
Owner

Shmarkus commented Oct 4, 2018

Please note that IOS is currently untested.

@Shmarkus
Copy link
Owner

Ionic pull request merged

@ptykamikaze
Copy link
Author

Thank you

@ptykamikaze
Copy link
Author

ptykamikaze commented Oct 29, 2018

While trying to compile the iOS version, I'm getting this error:

......./Plugins/cordova-plugin-nuance-speechkit/CDVSpeechKit.m:32:43: No visible @interface for 'SKSession' declares the selector 'speakString:withLanguage:withVoice:delegate:'

in the file CDVSpeechKit.m, in this piece of code

    SKTransaction* transaction = [session speakString:[command.arguments objectAtIndex:0]
                                         withLanguage:[command.arguments objectAtIndex:1]
                                         withVoice:[command.arguments objectAtIndex:2]
                                             delegate:self];

@ptykamikaze
Copy link
Author

I have a very basic knowledge about using xcode and I have changed the file SKSession.h adding the missing withVoice parameter to the interface... Now I can compile but the audio is not playing so I will wait for you :) thanks 4 your support

@Shmarkus Shmarkus reopened this Oct 29, 2018
@Shmarkus
Copy link
Owner

Yes, this won't work like that. The problem is that the session allows only either withLanguage or withVoice. I'll look into that. The most promising solution is to use options

@ptykamikaze
Copy link
Author

oh OK... thanks for your support

@Shmarkus
Copy link
Owner

@ptykamikaze could you please try on IOS, replace the following in CDVSpeechKit.m:

- (void) startTTS:(CDVInvokedUrlCommand*)command{

    NSLog(@"CDVSpeechKit.startTTS: Entered method.");
    // If the voice is nil, use language default voice. If the voice is set, ignore language and use voices default lang.
    if (command.arguments objectAtIndex:2 == nil) {
        SKTransaction* transaction = [session speakString:[command.arguments objectAtIndex:0]
                                             withLanguage:[command.arguments objectAtIndex:1]
                                             delegate:self];
    } else {
        SKTransaction* transaction = [session speakString:[command.arguments objectAtIndex:0]
                                             withVoice:[command.arguments objectAtIndex:2]
                                             delegate:self];
    }
    NSLog(@"CDVSpeechKit.startTTS: Leaving method.");
}

Note that this will either use selected language when voice parameter is null, or if voice is set it will ignore the language parameter, and use voices language instead!

@ptykamikaze
Copy link
Author

ptykamikaze commented Oct 29, 2018

Error CDVSpeechKit.m:33:49: Expected ']'...

I changed that line from if (command.arguments objectAtIndex:2 == nil) { to if ([command.arguments objectAtIndex:2] == nil) { and it is working!

@ptykamikaze
Copy link
Author

Thanks a lot for your help! I thought that language and voice parameters were required

@Shmarkus
Copy link
Owner

Thanks for the response! I try to create the fix today!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants