How to Implement the TTS Text Read-Out Feature in monaca

Asked 1 years ago, Updated 1 years ago, 118 views

Hello, is it possible to implement TTS (text-to-speech) in monaca?
When I put in the Web Speech API, the IDE preview on chrome reads it out, but iOS and Android were not working with debugger and built apps.

The application under development is a word learning application, and although the number of characters read is small, there are thousands of words.<audio> tag playback on mp3 is also a capacity issue, so we are looking for another way.

Thank you for your cooperation.

monaca cordova

2022-09-30 21:14

1 Answers

You can use the Cordova Text-to-Speech Plugin.

The first language to read will result in downloading and installing the read audio data.

// Japanese Read Example
// I'm checking on Android.
document.addEventListener('device ready', function(){
    document.getElementById("speech").addEventListener('click', function(){
        TTS.speak({
            text: 'Hello, the world of voices.'
            locale: 'ja-JP',
            rate —1,
        }, function(){
            alert('success');
        }, function(reason){
            alert(reason);
        });
    });
}, false);


2022-09-30 21:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.