Text to Speech

Not sure which of the problems 1 or 2 your’re talking about now, but in either case, no.

For Android I build the .apk file and save it in a Google Drive folder which I again open/run on my Android phone. I don’t use USB.

For iOS I put the app on the device via XCode/USB and when I do this get no sound at all from text to speach.

Well, other apps makes sound on the device so…

Maybe I expressed myself exceptionally clumsy. Sorry. I’ll try again.

All buttons speaks, but the “Norwegian button” only speaks Norwegian if none of the other languages has been used in the meantime. If either English or Russian have been spoken, pressing the Norwegian button will only speak with the last non-Norwegian language.

Well, screw the explanation. Just watch this video dump:

https://youtu.be/ZPlCNCnJvsE

Ok. Let’s focus on iOS for now.

Well, other apps makes sound on the device so…

VLC, YouTube and some other apps have sound with the mute ON. So please double check the switch. Just to be sure.

Build the sample app using Corona Simulator 2979+ and run it on your iOS device. Does it work?

Hi, just tested with corona sdk 2980. Running the exact same code as my “slightly more advanced” example now results in the following error message on an iPhone:

Runtime error

attempt to index a function value

Looking at the new docs, there seems to be a typo in the build.settings example:

 settings = { plugins = { ['plugin.bluetooth'] = { publisherId = 'com.spiralcodestudio' } } }

It says “bluetooth”. 

From the XCode log window (which is completely bombed with logging as I don’t know how to reduce it…): 

Oct 26 23:03:47 Jenny-sin-iPhone \_SpeechLangSwitch[1136] \<Notice\>: ERROR: Runtime error attempt to index a function value stack traceback: [C]: in function 'init' /Users/Air/Google Drive/PROGRAMMING/CORONA/Test cases/\_SpeechLangSwitch/main.lua:46: in main chunk

This line (46) is:

texttospeech.init(initCB)

But as far as I know, initCB() is correctly defined above?

print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n Switch Lang\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n") W = display.actualContentWidth texttospeech = require("plugin.texttospeech") status = display.newText("", 50, 150, native.systemFont, 0.03\*W) status.anchorX = 0 status.anchorY = 0 function initCB(e) status.text = status.text .. "\nis error: " .. tostring(e.isError) end local txt = "værhane" function norTouch(e) if (e.phase == "ended") then status.text = status.text .. "\ntexttospeech.speak('" .. txt .. "', {language = 'no-NO'})" texttospeech.speak(txt, {language = "no-NO"}) end end function engTouch(e) if (e.phase == "ended") then status.text = status.text .. "\ntexttospeech.speak('" .. txt .. "', {language = 'en-GB'})" texttospeech.speak(txt, {language = "en-GB"}) end end function rusTouch(e) if (e.phase == "ended") then status.text = status.text .. "\ntexttospeech.speak('" .. txt .. "', {language = 'ru-RU'})" texttospeech.speak(txt, {language = "ru-RU"}) end end nor = display.newText("NOR", 0.20\*W, 50, native.systemFontBold, 0.1\*W) eng = display.newText("ENG", 0.50\*W, 50, native.systemFontBold, 0.1\*W) rus = display.newText("RUS", 0.80\*W, 50, native.systemFontBold, 0.1\*W) nor:addEventListener("touch", norTouch) eng:addEventListener("touch", engTouch) rus:addEventListener("touch", rusTouch) status.text = status.text .. "\ncalling init()" texttospeech.init(initCB)&nbsp;

chillfok, fixed, thanks.

runewinse, can you at least say that it’s working inside Corona Simulator on mac? Also try to build the sample app, does it work?

runewinse, not sure if it affects anything, but added some extra code that could solve the issue. Try in an hour.

In the Corona Simulator on the Mac I get no error messages when I start the app at all.

But when clicking on the language “buttons” I get:

“WARNING: The ‘plugin.texttospeech’ library is not available on this platform.”

Just as before, in other words. I hear no sound either, but that’s ok. The important thing for me is to make it work on a device.

Running your sample project (https://github.com/Lerg/plugins-sample-texttospeech) in the simulator gives me the following error:

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

runewinse, now that makes at least some sense. These warning and the error about enableDebug say that you are using an old version of the plugin.

If you are using a proper Corona Simulator version, the plugin should self update. If not - maybe clean everything and reinstall.

Make sure that you are running the proper version if you have several installed. The latest one should be “Version 2016.2980 (2016.10.26)” in the about window.

Lerg, I don’t have access to my build Mac right now, but I’m pretty sure that I have an updated Corona Simulator. If the plugin is not updated correctly, there must be a bug in the Corona plugin system. Could it be related to the switch to paid plugin?

Anyway, I think maybe there should be some versioning info system ala:

texttospeech = require("plugin.texttospeech") print( texttospeech.version() )

So that we plugin users could quickly get an idea about the version that is being used.

I will try a reinstall of the corona simulator tonight.

Try logging out and logining back in

Thanks for the tip, scottrules44! I will certainly try this first!

Well, deauthorizing/reautorizing helped a bit.

Now I can run your sample project without crashing the app (so I guess the plugin is now the version with enableDebug).

Still hear no sound in the simulator though. Only 

“WARNING: The ‘plugin.texttospeech’ library is not available on this platform.”

I will try on an actual device later tonight.

Ok, success! Now deploying the app directly to a device seems to work correctly with the latest plugin version and corona simulator.

Well, at least for iOS.

On Android devices, language switching doesn’t seem to work at all.

Lerg, I don’t remember. Did you say that the language switching works for you on Android devices, or did you only test on iOS?

Ok, success!

Yay! Congratulations!

Yes, language switching works on Android.

Can I ask which Android version / device you tested on? It’s really strange that it won’t work on my devices…

runewinse, Android 6, Moto G with Cyanogen.

Inside the init listener you can get the list of available tts engines. Post it here.

Ok, here’s the output from the init:

Android

apiLevel: 25

Engines:     {

 “Google Text-to-speech Engine”:“com.google.android.tts”

}

Default engine:      com.google.android.tts

Languages and voices:        {

 “languages”:[“yue-HK”,“ca-”,“en-GB”,“fr-FR”,“ko-KR”,“in-ID”,“en-AU”,“zh-TW”,“ja-JP”,“sv-SE”,“it-IT”,“pt-BR”,“hr-”,“pt-PT”,“cs-”,“fi-FI”,“tr-TR”,“es-US”,“hi-IN”,“cy-”,“es-ES”,“ru-RU”,“en-IN”,“sr-”,“da-DK”,“sq-”,“sw-”,“bs-”,“bn-BD”,“nb-NO”,“nl-NL”,“vi-VN”,“ta-”,“ku-”,“th-TH”,“zh-CN”,“hu-HU”,“sk-”,“la-”,“de-DE”,“pl-PL”,“en-US”,“fr-BE”],

 “voices”:{

     “en-au-x-afh-local”:“en-AU”,

     “fr-fr-x-vlf#female_1-local”:“fr-FR”,

     “es-US-language”:“es-US”,

     “es-es-x-ana-network”:“es-ES”,

     “ko-kr-x-ism#female_2-local”:“ko-KR”,

     “hi-in-x-cfn#male_3-local”:“hi-IN”,

     “fr-fr-x-vlf#female_3-local”:“fr-FR”,

     “en-au-x-afh-network”:“en-AU”,

     “hi-in-x-cfn#male_1-local”:“hi-IN”,

     “hi-in-x-cfn-network”:“hi-IN”,

     “sk”:“sk-”,

     “ja-jp-x-htm#male_2-local”:“ja-JP”,

     “fr-BE”:“fr-BE”,

     “ja-jp-x-htm#female_3-local”:“ja-JP”,

     “en-gb-x-fis#male_2-local”:“en-GB”,

     “pt-PT”:“pt-PT”,

     “ru-RU-language”:“ru-RU”,

     “cs”:“cs-”,

     “bs”:“bs-”,

     “id-id-x-dfz#male_1-local”:“in-ID”,

     “hr”:“hr-”,

     “th-th-x-mol#male_3-local”:“th-TH”,

     “sv-se-x-lfs-local”:“sv-SE”,

     “ru-ru-x-dfc#female_1-local”:“ru-RU”,

     “en-us-x-sfg#male_1-local”:“en-US”,

     “pl-pl-x-oda#male_1-local”:“pl-PL”,

     “sr”:“sr-”,

     “en-gb-x-fis#female_2-local”:“en-GB”,

     “hu-hu-x-kfl-local”:“hu-HU”,

     “en-gb-x-rjs#male_3-local”:“en-GB”,

     “ja-jp-x-htm#female_1-local”:“ja-JP”,

     “it-it-x-kda#female_1-local”:“it-IT”,

     “en-in-x-ahp-network”:“en-IN”,

     “en-gb-x-rjs#female_2-local”:“en-GB”,

     “pl-pl-x-oda-local”:“pl-PL”,

     “hi-in-x-cfn#male_2-local”:“hi-IN”,

     “es-us-x-sfb-local”:“es-US”,

     “pt-br-x-afs#female_2-local”:“pt-BR”,

     “ru-ru-x-dfc#female_3-local”:“ru-RU”,

     “de-de-x-nfh#male_3-local”:“de-DE”,

     “it-it-x-kda-network”:“it-IT”,

     “id-id-x-dfz#female_1-local”:“in-ID”,

     “th-th-x-mol#male_2-local”:“th-TH”,

     “bn-bd-x-ban-local”:“bn-BD”,

     “th-th-x-mol#female_3-local”:“th-TH”,

     “pl-pl-x-oda#male_2-local”:“pl-PL”,

     “ja-JP-language”:“ja-JP”,

     “sq”:“sq-”,

     “zh-CN-language”:“zh-CN”,

     “tr-tr-x-mfm-network”:“tr-TR”,

     “sv-se-x-lfs-network”:“sv-SE”,

     “la”:“la-”,

     “ko-kr-x-ism#male_2-local”:“ko-KR”,

     “en-gb-x-rjs-local”:“en-GB”,

     “ta”:“ta-”,

     “th-th-x-mol-local”:“th-TH”,

     “cmn-cn-x-ssa-network”:“zh-CN”,

     “es-us-x-sfb#male_1-local”:“es-US”,

     “it-it-x-kda#female_3-local”:“it-IT”,

     “pl-pl-x-oda#female_2-local”:“pl-PL”,

     “en-in-x-cxx-network”:“en-IN”,

     “id-id-x-dfz#female_3-local”:“in-ID”,

     “en-in-x-ahp-local”:“en-IN”,

     “pl-pl-x-oda-network”:“pl-PL”,

     “pt-BR-language”:“pt-BR”,

     “nl-nl-x-tfb-network”:“nl-NL”,

     “yue-HK-language”:“yue-HK”,

     “en-gb-x-fis#male_1-local”:“en-GB”,

     “nb-no-x-rfj-network”:“nb-NO”,

     “hi-in-x-cfn#female_1-local”:“hi-IN”,

     “it-it-x-kda#female_2-local”:“it-IT”,

     “sv-SE-language”:“sv-SE”,

     “vi-vn-x-gft-network”:“vi-VN”,

     “es-us-x-sfb#male_2-local”:“es-US”,

     “en-gb-x-fis#female_1-local”:“en-GB”,

     “es-us-x-sfb-network”:“es-US”,

     “it-it-x-kda#male_1-local”:“it-IT”,

     “ru-ru-x-dfc#male_1-local”:“ru-RU”,

     “ru-ru-x-dfc-network”:“ru-RU”,

     “de-de-x-nfh#female_2-local”:“de-DE”,

     “bn-BD-language”:“bn-BD”,

     “fi-FI-language”:“fi-FI”,

     “fr-fr-x-vlf#male_3-local”:“fr-FR”,

     “pt-br-x-afs#male_3-local”:“pt-BR”,

     “fr-FR-language”:“fr-FR”,

     “es-us-x-sfb#female_2-local”:“es-US”,

     “it-IT-language”:“it-IT”,

     “ko-kr-x-ism#male_1-local”:“ko-KR”,

     “hu-HU-language”:“hu-HU”,

     “en-us-x-sfg-network”:“en-US”,

     “fi-fi-x-afi-local”:“fi-FI”,

     “ca”:“ca-”,

     “en-gb-x-fis-local”:“en-GB”,

     “hi-in-x-cfn#female_3-local”:“hi-IN”,

     “es-us-x-sfb#female_3-local”:“es-US”,

     “pt-br-x-afs#female_1-local”:“pt-BR”,

     “en-gb-x-fis-network”:“en-GB”,

     “zh-TW-language”:“zh-TW”,

     “en-gb-x-fis#male_3-local”:“en-GB”,

     “de-de-x-nfh-network”:“de-DE”,

     “es-us-x-sfb#male_3-local”:“es-US”,

     “ko-kr-x-ism#female_1-local”:“ko-KR”,

     “de-de-x-nfh#female_3-local”:“de-DE”,

     “fr-fr-x-vlf#male_2-local”:“fr-FR”,

     "en-gb-x-rjs#mal

I don’t see any “no-NO” voices, but have no clue if that should influence anything. After all the Norwegian voice works very well - as long as I don’t use any other languages…