@Lerg, any updates on the guide to implementing Siri in iOS?
@troylyndon, hi, language codes are all engine specific. What OS and what speech engine has this issue? My guess it could be that there is no Portuguese support and it defaults to Brazil.
@gamebit.labs working on that.
Plugin Updated
Added support for new voices on iOS.
Now when you call texttospeech.getLanguagesAndVoices() you would get a list of named voices.
Languages and voices: { "languages":["ar-SA","cs-CZ","da-DK","de-DE","de-DE","de-DE","el-GR","en-AU","en-AU","en-AU","en-GB","en-GB","en-GB","en-IE","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-ZA","es-ES","es-MX","fi-FI","fr-CA","fr-FR","fr-FR","fr-FR","he-IL","hi-IN","hu-HU","id-ID","it-IT","ja-JP","ja-JP","ja-JP","ko-KR","nl-BE","nl-NL","no-NO","pl-PL","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","sv-SE","th-TH","tr-TR","zh-CN","zh-CN","zh-CN","zh-HK","zh-TW","en-US"], "name":"getLanguagesAndVoices", "voices":{ "victoria":"en-US", "xander":"nl-NL", "laura":"sk-SK", "ting-ting":"zh-CN", "alva":"sv-SE", "catherine":"en-AU", "milena":"ru-RU", "mariska":"hu-HU", "arthur":"en-GB", "mei-jia":"zh-TW", "gordon":"en-AU", "ava":"en-US", "default":"", "allison (enhanced)":"en-US", "monica":"es-ES", "li-mu":"zh-CN", "daniel":"fr-FR", "lekha":"hi-IN", "paulina":"es-MX", "marie":"fr-FR", "ioana":"ro-RO", "ellen":"nl-BE", "o-ren":"ja-JP", "damayanti":"id-ID", "sin-ji":"zh-HK", "karen":"en-AU", "zosia":"pl-PL", "susan (enhanced)":"en-US", "moira":"en-IE", "yelda":"tr-TR", "nora":"no-NO", "yuna":"ko-KR", "susan":"en-US", "sara":"da-DK", "samantha":"en-US", "maged":"ar-SA", "hattori":"ja-JP", "yu-shu":"zh-CN", "fred":"en-US", "joana":"pt-PT", "kanya":"th-TH", "carmit":"he-IL", "amelie":"fr-CA", "zuzana":"cs-CZ", "thomas":"fr-FR", "martin":"de-DE", "allison":"en-US", "melina":"el-GR", "anna":"de-DE", "luciana":"pt-BR", "aaron":"en-US", "tessa":"en-ZA", "alex":"en-US", "satu":"fi-FI", "nicky":"en-US", "samantha (enhanced)":"en-US", "alice":"it-IT", "martha":"en-GB", "helena":"de-DE", "ava (enhanced)":"en-US", "kyoko":"ja-JP" }, "isError":false }
Voices with “(enhanced)” mark are particularly good. “samantha (enhanced)” was a siri voice for some time. I personally like enhanced Ava and Susan.
However these voices don’t come by default, they have to be downloaded by the user.
On your iOS device go to Settings -> General -> Accessibility -> VoiceOver -> Speech -> Voice
Here you can download and test additional voices.
When you want to use the voice, pass it to the texttospeech.speak() call in lowercase.
Unfortunately the new siri voice is not available for developers, so it can’t be selected.
Thanks for the update Lerg!
Ben
Hi, recently I’ve started to experience crashes with my app an the error message looks like this:
Any idea what’s going on?
CoronaSDK 2018.3194
Android 8.1
Nexus 6P
runewinse, hi, maybe not calling init before using other functions?
No, I call init immediately after the require line. Like this:
texttospeech = require(“plugin.texttospeech”)
texttospeech.init()
The log looks like this:
01-12 08:44:31.043 13479 22398 I Corona : u.lua has been loaded. 01-12 08:44:31.044 13479 22398 I Corona : s.lua has been loaded. 01-12 08:44:31.048 13479 22398 V Corona : \> Class.forName: plugin.vibrator.LuaLoader 01-12 08:44:31.049 13479 22398 V Corona : \< Class.forName: plugin.vibrator.LuaLoader 01-12 08:44:31.049 13479 22398 V Corona : Loading via reflection: plugin.vibrator.LuaLoader 01-12 08:44:31.049 13479 22398 V Corona : \> Class.forName: plugin.texttospeech.LuaLoader 01-12 08:44:31.049 13479 22398 V Corona : \< Class.forName: plugin.texttospeech.LuaLoader 01-12 08:44:31.049 13479 22398 V Corona : Loading via reflection: plugin.texttospeech.LuaLoader 01-12 08:44:31.058 13479 22398 I Corona : ERROR: Runtime error 01-12 08:44:31.058 13479 22398 I Corona : java.lang.IllegalArgumentException: Service not registered: android.speech.tts.TextToSpeech$Connection@70016ba 01-12 08:44:31.058 13479 22398 I Corona : Java Stack Trace: 01-12 08:44:31.058 13479 22398 I Corona : android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1484) 01-12 08:44:31.058 13479 22398 I Corona : android.app.ContextImpl.unbindService(ContextImpl.java:1638) 01-12 08:44:31.058 13479 22398 I Corona : android.content.ContextWrapper.unbindService(ContextWrapper.java:703) 01-12 08:44:31.058 13479 22398 I Corona : android.speech.tts.TextToSpeech$Connection.disconnect(TextToSpeech.java:2281) 01-12 08:44:31.058 13479 22398 I Corona : android.speech.tts.TextToSpeech$1.run(TextToSpeech.java:855) 01-12 08:44:31.058 13479 22398 I Corona : android.speech.tts.TextToSpeech$1.run(TextToSpeech.java:851) 01-12 08:44:31.058 13479 22398 I Corona : android.speech.tts.TextToSpeech$Connection.runAction(TextToSpeech.java:2301) 01-12 08:44:31.058 13479 22398 I Corona : android.speech.tts.TextToSpeech.runAction(TextToSpeech.java:752) 01-12 08:44:31.058 13479 22398 I Corona : android.speech.tts.TextToSpeech.runActionNoReconnect(TextToSpeech.java:738) 01-12 08:44:31.058 13479 22398 I Corona : android.speech.tts.TextToSpeech.shutdown(TextToSpeech.java:850) 01-12 08:44:31.058 13479 22398 I Corona : plugin.texttospeech.LuaLoader.init(LuaLoader.java:113) 01-12 08:44:31.058 13479 22398 I Corona : plugin.texttospeech.LuaLoader.access$1000(LuaLoader.java:27) 01-12 08:44:31.058 13479 22398 I Corona : plugin.texttospeech.LuaLoader$InitWrapper.invoke(LuaLoader.java: 01-12 08:44:31.059 13479 22398 I Corona : ERROR: Runtime error 01-12 08:44:31.059 13479 22398 I Corona : java.lang.IllegalArgumentException: Service not registered: android.speech.tts.TextToSpeech$Connection@70016ba 01-12 08:44:31.059 13479 22398 I Corona : Java Stack Trace: 01-12 08:44:31.059 13479 22398 I Corona : android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1484) 01-12 08:44:31.059 13479 22398 I Corona : android.app.ContextImpl.unbindService(ContextImpl.java:1638) 01-12 08:44:31.059 13479 22398 I Corona : android.content.ContextWrapper.unbindService(ContextWrapper.java:703) 01-12 08:44:31.059 13479 22398 I Corona : android.speech.tts.TextToSpeech$Connection.disconnect(TextToSpeech.java:2281) 01-12 08:44:31.059 13479 22398 I Corona : android.speech.tts.TextToSpeech$1.run(TextToSpeech.java:855) 01-12 08:44:31.059 13479 22398 I Corona : android.speech.tts.TextToSpeech$1.run(TextToSpeech.java:851) 01-12 08:44:31.059 13479 22398 I Corona : android.speech.tts.TextToSpeech$Connection.runAction(TextToSpeech.java:2301) 01-12 08:44:31.059 13479 22398 I Corona : android.speech.tts.TextToSpeech.runAction(TextToSpeech.java:752) 01-12 08:44:31.059 13479 22398 I Corona : android.speech.tts.TextToSpeech.runActionNoReconnect(TextToSpeech.java:738) 01-12 08:44:31.059 13479 22398 I Corona : android.speech.tts.TextToSpeech.shutdown(TextToSpeech.java:850) 01-12 08:44:31.059 13479 22398 I Corona : plugin.texttospeech.LuaLoader.init(LuaLoader.java:113) 01-12 08:44:31.059 13479 22398 I Corona : plugin.texttospeech.LuaLoader.access$1000(LuaLoader.java:27) 01-12 08:44:31.059 13479 22398 I Corona : plugin.texttospeech.LuaLoader$InitWrapper.invoke(LuaLoader.java:502) 01-12 08:44:31.059 13479 22398 I Corona : com.ansca.corona.JavaToNativeShim.nativeResize(Native Method) 01-12 08:44:31.059 13479 22398 I Corona : com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:381) 01-12 08:44:31.059 13479 22398 I Corona : com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:382) 01-12 08:44:31.059 13479 22398 I Corona : com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1612) 01-12 08:44:31.059 13479 22398 I Corona : com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1378) 01-12 08:44:31.059 13479 22398 I Corona : stack traceback: 01-12 08:44:31.059 13479 22398 I Corona : [C]: ? 01-12 08:44:31.059 13479 22398 I Corona : [C]: in function 'init' 01-12 08:44:31.059 13479 22398 I Corona : ?: in main chunk 01-12 08:44:31.059 13479 22398 I Corona : [C]: in function 'require' 01-12 08:44:31.059 13479 22398 I Corona : /Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resources/init.lua:906: in function 'require' 01-12 08:44:31.059 13479 22398 I Corona : ?: in main chunk 01-12 08:44:31.098 13479 22398 V Corona : \> Class.forName: CoronaProvider.licensing.google.LuaLoader 01-12 08:44:31.098 13479 22398 V Corona : \< Class.forName: CoronaProvider.licensing.google.LuaLoader 01-12 08:44:31.098 13479 22398 V Corona : Loading via reflection: CoronaProvider.licensing.google.LuaLoader
Hm, ok, maybe something has changed in Android 8, I’ll try to workaround that issue.
Hi Lerg,
Been using your API to get list of voices on iOS 11.2.x. The last voice always appears corrupted/truncated. Any thoughts?
iPhone 6, iOS 11.2.2 - “catherine”<\M-b\M^@\M-&>
iPad Air, iOS 11.2.5 (beta) - "karen<\M-b\M^@\M-&>
Ben.
Hi,
I now have another user that experience this often.
This phone is running Android 7.x so it’s has probably nothing to do with Android 8.
By experience, the first call to texttospeech() takes some time, so I have tried to avoid this pause the first time by immediately calling texttospeech() with a space (" ") just in case something needs to be loaded (typically the sounds in the selected language). Could it be this that sometimes makes the app crash?
runewinse, do you use the init listener function to detect when the plugin has been initialized? If not, that could be the issue.
http://docs.spiralcodestudio.com/plugin/texttospeech/init/
Hi, I’ll put that first use of texttospeech.speak inside the init listener (if not error) and see it that helps.
Thanks!
Unfortunately, the “Service not registered” error still appears now and then.
03-14 10:20:25.361 14083 18143 I Corona : ****** TEST MODE *****
03-14 10:20:25.361 14083 18143 I Corona : About to call u.speechInit()
03-14 10:20:25.369 14083 18143 I Corona : ERROR: Runtime error
03-14 10:20:25.369 14083 18143 I Corona : java.lang.IllegalArgumentException: Service not registered: android.speech.tts.TextToSpeech$Connection@a22f6c4
03-14 10:20:25.369 14083 18143 I Corona : Java Stack Trace:
03-14 10:20:25.369 14083 18143 I Corona : android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1488)
03-14 10:20:25.369 14083 18143 I Corona : android.app.ContextImpl.unbindService(ContextImpl.java:1655)
03-14 10:20:25.369 14083 18143 I Corona : android.content.ContextWrapper.unbindService(ContextWrapper.java:716)
03-14 10:20:25.369 14083 18143 I Corona : android.speech.tts.TextToSpeech$Connection.disconnect(TextToSpeech.java:2281)
03-14 10:20:25.369 14083 18143 I Corona : android.speech.tts.TextToSpeech$1.run(TextToSpeech.java:855)
03-14 10:20:25.369 14083 18143 I Corona : android.speech.tts.TextToSpeech$1.run(TextToSpeech.java:851)
03-14 10:20:25.369 14083 18143 I Corona : android.speech.tts.TextToSpeech$Connection.runAction(TextToSpeech.java:2301)
03-14 10:20:25.369 14083 18143 I Corona : android.speech.tts.TextToSpeech.runAction(TextToSpeech.java:752)
03-14 10:20:25.369 14083 18143 I Corona : android.speech.tts.TextToSpeech.runActionNoReconnect(TextToSpeech.java:738)
03-14 10:20:25.369 14083 18143 I Corona : android.speech.tts.TextToSpeech.shutdown(TextToSpeech.java:850)
03-14 10:20:25.369 14083 18143 I Corona : plugin.texttospeech.LuaLoader.init(LuaLoader.java:113)
03-14 10:20:25.369 14083 18143 I Corona : plugin.texttospeech.LuaLoader.access$1000(LuaLoader.java:27)
03-14 10:20:25.369 14083 18143 I Corona : plugin.texttospeech.LuaLoader$InitWrapper.invoke(LuaLoader.java:
03-14 10:20:25.370 14083 18143 I Corona : ERROR: Runtime error
03-14 10:20:25.370 14083 18143 I Corona : java.lang.IllegalArgumentException: Service not registered: android.speech.tts.TextToSpeech$Connection@a22f6c4
03-14 10:20:25.370 14083 18143 I Corona : Java Stack Trace:
03-14 10:20:25.370 14083 18143 I Corona : android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1488)
03-14 10:20:25.370 14083 18143 I Corona : android.app.ContextImpl.unbindService(ContextImpl.java:1655)
03-14 10:20:25.370 14083 18143 I Corona : android.content.ContextWrapper.unbindService(ContextWrapper.java:716)
03-14 10:20:25.370 14083 18143 I Corona : android.speech.tts.TextToSpeech$Connection.disconnect(TextToSpeech.java:2281)
03-14 10:20:25.370 14083 18143 I Corona : android.speech.tts.TextToSpeech$1.run(TextToSpeech.java:855)
03-14 10:20:25.370 14083 18143 I Corona : android.speech.tts.TextToSpeech$1.run(TextToSpeech.java:851)
03-14 10:20:25.370 14083 18143 I Corona : android.speech.tts.TextToSpeech$Connection.runAction(TextToSpeech.java:2301)
03-14 10:20:25.370 14083 18143 I Corona : android.speech.tts.TextToSpeech.runAction(TextToSpeech.java:752)
03-14 10:20:25.370 14083 18143 I Corona : android.speech.tts.TextToSpeech.runActionNoReconnect(TextToSpeech.java:738)
03-14 10:20:25.370 14083 18143 I Corona : android.speech.tts.TextToSpeech.shutdown(TextToSpeech.java:850)
03-14 10:20:25.370 14083 18143 I Corona : plugin.texttospeech.LuaLoader.init(LuaLoader.java:113)
03-14 10:20:25.370 14083 18143 I Corona : plugin.texttospeech.LuaLoader.access$1000(LuaLoader.java:27)
03-14 10:20:25.370 14083 18143 I Corona : plugin.texttospeech.LuaLoader$InitWrapper.invoke(LuaLoader.java:502)
03-14 10:20:25.370 14083 18143 I Corona : com.ansca.corona.JavaToNativeShim.nativeResize(Native Method)
03-14 10:20:25.370 14083 18143 I Corona : com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:381)
03-14 10:20:25.370 14083 18143 I Corona : com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:382)
03-14 10:20:25.370 14083 18143 I Corona : com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1612)
03-14 10:20:25.370 14083 18143 I Corona : com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1378)
03-14 10:20:25.370 14083 18143 I Corona : stack traceback:
03-14 10:20:25.370 14083 18143 I Corona : [C]: ?
03-14 10:20:25.370 14083 18143 I Corona : [C]: in function ‘init’
03-14 10:20:25.370 14083 18143 I Corona : ?: in function ‘?’
03-14 10:20:25.370 14083 18143 I Corona : ?: in main chunk
As far as I know, I do NOTHING before calling u.speechInit(), which again calls u.texttospeech.init(TTSListener).
As you can see from the log, the last thing I print is “About to call u.speechInit()”.
Here’s the code:
local function TTSListener(event) print("event.name: " .. tostring(event.name)) print("event.isError: " .. tostring(event.isError)) print("event.errorMessage: " .. tostring(event.errorMessage)) print("event.errorCode: " .. tostring(event.errorCode)) print("event.engines: " .. tostring(event.engines)) print("event.defaultEngine: " .. tostring(event.defaultEngine)) print("event.maxLength: " .. tostring(event.maxLength)) if (event.isError == false) then composer.state.ttsEngineInitialized = true -- u.speech(" ", composer.state.settings.foreignLang, 0, nil, nil, nil) end end u.speechInit = function() u.texttospeech.init(TTSListener) end -- START OF ACTIVE CODE print("About to call u.speechInit()\n") u.speechInit() print("Returned from u.speechInit()\n")
Is there ANYTHING different I can do to avoid this from happening? The users of my app is not fond of this instability…
Hi Lerg, can you put a working link to the docs here? The old link still doesn’t work.
Docs here http://docs.spiralcodestudio.com/plugin/texttospeech
Main site is down, will reconstruct it.
Hi Lerg,
Is enableDebug() still available?
The reason I ask is that I get the good old “attempt to call field ‘enabeDebug’ (a nil value)” error when I do this:
u.texttospeech = require("plugin.texttospeech") if (u.texttospeech ~= nil) then u.texttospeech.enableDebug() end
Is it possible that after all this time, I still am using an old version of the plugin?
Very doubtful, old plugin is downloaded for a very old Corona build. If you are using the latest daily of the latest public release, it’s the fresh one.
Double check the spelling. Are other functions working?