Text To Speech and Voice Recognition - Ionic


Someone know if it possible to use those functions in Ionic2 framework?
I’m looking for speech recognition in particular.

If yes, could you gently provide an example of code (.html and .ts)?
I really appreciate any help you can provide, and sorry for my little english.


Maybe the simplest approach is to use:

I’m looking to something like this: http://devgirl.org/2016/01/08/speaking-with-cordova/
I’m building an ionic2 project with cordova, but that link is for ionic1.

No one have the solution?
I find code for Ionic only, but i don’t know how to convert to a Ionic 2 environment…
I’m quite new in Ionic 2, and don’t have so much flexibilities.

We have a TTS (text-to-speech) added to our Ionic2 application using the cordova library https://github.com/vilic/cordova-plugin-tts. There is some documentation at the bottom of the page to use it with typescript. Basically what it does is adds a global variable named “TTS” and you can just call that with to issue any text speaking. The instructions on the page on how to install work for installing it into an Ionic2 application. Hopefully that helps.

Thank you for your answer!
I will give it a try as soon as i can.

And in the opposite side, for speech-to-text functionality (I’m looking at this in particular), have you something that maybe can help me?

If you will only use it with an internet connection you could use a web api, like google(https://www.google.com/intl/en/chrome/demos/speech.html) or ibm

Here the answer.

Here’s an example using Ionic Native.

1 Like

Hi @PWHSoftware, the video was removed by user… Where can i find Ionic Native TTS? Thx! :grin:

Btw, i’m interested in native Speech to Text function :cry:

@Moscardini Oops! I had to re-render the video and forgot to update the link.

It should work now.

@PWHSoftware It works now, thank you!

Sadly, i’m using Voice Recognition (Speech to Text - STT) in my project and not TTS (Text to Speech)…

However, I looked at your https://learnionic2.com/ blog… Very interesting the ES6 concepts with “async” and “await”! :heart_eyes:

Ah I see! I’ll do a video on STT sometime later today or tomorrow. :slight_smile:

Thanks for checking it out! Once you go async you never go back!

1 Like

Much appreciated, I’m really looking forward to your news! :+1:

@Moscardini Here’s a live implementation as promised of Speech to Text with Ionic 2:


That’s perfect!
Unfortunately, this plugin has some Quirks, like iOS:

  • Requirements - iOS 10

On older devices, will not work :cry:

Error Speech to Text!

When I call listenForSpeech method, I get this error message:
listenForSpeech() recognitionTask error: Error Domain=kAFAssistantErrorDomain Code=203 “Timeout” UserInfo={NSLocalizedDescription=Timeout, NSUnderlyingError=0x60800005bc00 {Error Domain=SiriSpeechErrorDomain Code=100 “(null)”}}

What does it mean? and how do I solve it?

ios 10.2 – Ionic 2



this one.

Have you gotten this to work in Ionic?
Would love to see a code sample or explanation how.