Text to Speech

try commenting this line out

--texttospeech.enableDebug()

by removingĀ texttospeech.enableDebug() the simulator works and show:

WARNING: The ā€˜plugin.texttospeech’ library is not available on this platform.

When built and run for iOS, there were same result of erros

Runtime error - attempt to index a function value

Xcode console

Nov &nbsp;3 10:03:33 Wilson-iPhoneSE plugins-sample-texttospeech-master[8393] \<Notice\>: ERROR: Runtime errorattempt to index a function value stack traceback: [C]: in function 'init' /Users/lwkApple/Desktop/plugins-sample-texttospeech-master/main.lua:38: in main chunk Nov &nbsp;3 10:03:33 Wilson-iPhoneSE plugins-sample-texttospeech-master[8393] \<Notice\>: Runtime Error: Runtime error: attempt to index a function value stack traceback: [C]: in function 'init' /Users/lwkApple/Desktop/plugins-sample-texttospeech-master/main.lua:38: in main chunk

The sample project no longer works. I don’t know if the two problems below are the result of Mac OS Sierra and/or XCode 8.1. But, this is really crazy. I’ve had the old text to speech plugin working and submitted my apps to Google Play and the App Store. And now, I find myself without the ability to continue development with Corona after 2 years of development, unless this plugin can function! So, to say I’m a bit disappointed would be a gross understatement.

Here are the clear problems for anyone who will take the time to verify and fix.

  1. under Mac OS Sierra, after commenting out line 15 of main.lua (to resolve one problem), Corona outputs ā€œWARNING: The ā€˜plugin.texttospeech’ library is not available on this platform.ā€

  2. even if I go to the trouble of building the project for iOS, and then install it on my iPhone 6 Plus, the app loads up with the message, ā€œRuntime error - attempt to index a function valueā€

Please help!

troylyndon, looks like something wrong with plugin update. In your home folder, try to go to ~/Library/Application Support/ and delete Corona folder, it contains downloaded plugin.

Wilson solved the problem on Mac Sierra - it turns out that the old text-to-speech plug-in was cached (just as you suspected Lerg) …Android now works, but iOS still doesn’t

troylyndon, darn, I need to buy an iOS 10 device. If it’s urgent, you can fall back to the old plugin (if it somehow works) before Corona 2979, but you have to use the old syntax.
I am trying to boot up iOS 10 simulator, takes ages for some reason.

Yes the simulator version works after removingĀ Ā ~/Library/Application Support/Corona folder…

However, same problem for both iOS and Android build of your sample code…

iOS

Runtime error - attempt to index a function value

Android:

main.lua:15:attempt to call field ā€˜enableDebug’ (a nil value).

it’s confirmed - that’s iOS 10 issue. Now I need something to debug on.

On Android if enableDebug() is not found that means the plugin is old, sure using the latest Corona version?

@troylyndon and anyone else having issues on iOS 10

I don’t know the details of your implementations, butĀ if you don’t need to call getLanguagesAndVoices()Ā and you don’t need to hook into any onComplete events, then you should be able to safely call init() without passing any parameters , and you should still be able to use speak(), just don’t specify an onComplete etc. callback in the params.

I had a similar error message. Deauthorizing Corona Simulator and logging on again solved it.

I’ve just got a new iPad Pro and now I see the error myself. Now I can debug it.

Found the issue, it only happened on iOS devices with 64bit CPU like all modern iOS devices only. Just uploaded the new build.

Thank you @Lerg. We’ll try and implement it today.

@Lerg, oddly, any idea what this problem is? I removed the cached plugins beforehand. And now, although it works on Mac, I cannot get a build to finish properly to test it on iOS. I’m running build 2984 (latest).

ERROR: with exit code 1 and output:
/Users/troylyndon/Documents/plugins-sample-texttospeech-master.app: resource fork, Finder information, or similar detritus not allowed
BUILD ERROR: ERROR: code signing failed: /Users/troylyndon/Documents/plugins-sample-texttospeech-master.app: resource fork, Finder information, or similar detritus not allowed
iOS build failed (12) after 30 seconds
ERROR: Build Failed: ERROR: code signing failed: /Users/troylyndon/Documents/plugins-sample-texttospeech-master.app: resource fork, Finder information, or similar detritus not allowed

troylyndon, errors, errors everywhere. This one though looks like a local issue (not plugin’s fault).
http://stackoverflow.com/questions/39652867/code-sign-error-in-macos-sierra-xcode-8-resource-fork-finder-information-or

@Lerg

The good news is that the iOS build and simulator version worked perfectly.

Unfortunately, Android version didn’t work.

same problem at startup as:

main.lua:15:attempt to call field ā€˜enableDebug’ (a nil value).

When I comment (removed) this line 15. The program started with buttons shown but line 80Ā 

print(ā€˜Init callback’)

was never called.

and program crashed when a speech is started.

I built with the latest Corona build 2984.

I tried to de-authorize and re-login but it didn’t help.

wilsonwansun, looks like I’ve accidentally uploaded a wrong binary for Android. Just reuploaded. Will become available in an hour.

@Lerg, it works… finally… :)Ā  :)Ā  :slight_smile:

Just a remind for all who used the previous version

  1. Remove (Mac) ā€œ~/Library/Application Support/Corona/ā€ for any cached plugin files.

  2. Use updated Corona SDK (2984 for me)

  3. Use xCode 8.1 for iOS 10.1 build

  4. De-authorize and re-login of Corona Simulator may help.

  5. There are minor changes of API usage from previous version. Please check the ā€œmain.luaā€ at publisher’s sample code at Github:

https://github.com/Lerg/plugins-sample-texttospeech

happy coding.

wilsonwansun, yay! Deauth is not needed as long as the plugins cache is removed.
Corona Simulator is smart to detect that there is a fresh plugin update to download, but for some reason it failed for this particular update. Maybe because I’ve added macOS support, somehow.

Hi Lerg.
Finally got back to working on my app and implementing the new text to speech plugin.
Thanks again for the great work.

It’s excellent that there is now the possibility to save the audio to file, will this eventually work on iOS? And is it possible to save the audio and play it at the same time rather than doing one or the other?
It might be more versatile to break this out into it’s own function likeĀ texttospeech.save( filename, baseDir ) ?

Also, remember ages ago I was asking if there was a way of returning aĀ predicted speech time in milliseconds from the speak function? Is this possible now, given the new functionality in the peach engines?