I suggest you ...

Text to Speech with speechSynthesis API

I've developed a rough version of this for russian, and it may not be too difficult to make it more general to work with many languages. Many modern browsers have this built in, and it works on mobile devices as well. Here is a link with information about the API: https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#tts-section

When I implemented for Russian I added a new function, playAudio, in jq_pgm.js. and called it four different times in the if-else portion of word_click_event_do_text_text.

function word_click_event_do_text_text() {
var status = $(this).attr('data_status');
var ann = '';
if ((typeof $(this).attr('data_ann')) != 'undefined')
ann = $(this).attr('data_ann');

if ( status < 1 ) {
run_overlib_status_unknown(WBLINK1,WBLINK2,WBLINK3,$(this).attr('title'),
TID,$(this).attr('data_order'),$(this).text(),$(this).attr('data_mw2'),
$(this).attr('data_mw3'),$(this).attr('data_mw4'),$(this).attr('data_mw5'),
$(this).attr('data_mw6'),$(this).attr('data_mw7'),$(this).attr('data_mw8'),
$(this).attr('data_mw9'),RTL);
top.frames['ro'].location.href='edit_word.php?tid=' + TID + '&ord=' +
$(this).attr('data_order') + '&wid=';
playAudio($(this).text());

}
else if ( status == 99 ){
run_overlib_status_99(WBLINK1,WBLINK2,WBLINK3,$(this).attr('title'),
TID,$(this).attr('data_order'),$(this).text(),$(this).attr('data_wid'),
$(this).attr('data_mw2'),$(this).attr('data_mw3'),$(this).attr('data_mw4'),
$(this).attr('data_mw5'),$(this).attr('data_mw6'),$(this).attr('data_mw7'),
$(this).attr('data_mw8'),$(this).attr('data_mw9'),RTL,ann);
playAudio($(this).text());
}
else if ( status == 98 ){
run_overlib_status_98(WBLINK1,WBLINK2,WBLINK3,$(this).attr('title'),
TID,$(this).attr('data_order'),$(this).text(),$(this).attr('data_wid'),
$(this).attr('data_mw2'),$(this).attr('data_mw3'),$(this).attr('data_mw4'),
$(this).attr('data_mw5'),$(this).attr('data_mw6'),$(this).attr('data_mw7'),
$(this).attr('data_mw8'),$(this).attr('data_mw9'),RTL,ann);
playAudio($(this).text());
}
else{
run_overlib_status_1_to_5(WBLINK1,WBLINK2,WBLINK3,$(this).attr('title'),
TID,$(this).attr('data_order'),$(this).text(),$(this).attr('data_wid'),status,
$(this).attr('data_mw2'),$(this).attr('data_mw3'),$(this).attr('data_mw4'),
$(this).attr('data_mw5'),$(this).attr('data_mw6'),$(this).attr('data_mw7'),
$(this).attr('data_mw8'),$(this).attr('data_mw9'),RTL,ann);
playAudio($(this).text());
}
return false;

function playAudio(txt){
var u = new SpeechSynthesisUtterance();
var voices = speechSynthesis.getVoices();
u.text = txt;
u.voice = voices[16]; //16 is for russian
u.lang = 'ru-RU';
u.rate = 1;
window.speechSynthesis.speak(u);

The only changes would be for u.voice and u.lang to change the languages. Sorry for the poor code. I am not a programmer.

3 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Taylor WoodruffTaylor Woodruff shared this idea  ·   ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Taylor WoodruffTaylor Woodruff commented  · 

        Here's a list of the voices, language code, array value.
        Change the code in the original post as follows.
        u.voice = voices[*insert array value*]; and u.lang = '*insert language code*'

        native,(),0
        Google Deutsch,de-DE,1
        Google US English,en-US,2
        Google UK English Female,en-GB,3
        Google UK English Male,en-GB,4
        Google español,es-ES,5
        Google español de Estados Unidos,es-US,6
        Google français,fr-FR,7
        Google हिन्दी,hi-IN,8
        Google Bahasa Indonesia,id-ID,9
        Google italiano,it-IT,10
        Google 日本語,ja-JP,11
        Google 한국의,ko-KR,12
        Google Nederlands,nl-NL,13
        Google polski,pl-PL,14
        Google português do Brasil,pt-BR,15
        Google русский,ru-RU,16
        Google 普通话(中国大陆),zh-CN,17
        Google 粤語(香港),zh-HK,18
        Google 國語(臺灣),zh-TW,19

        Let me know if anyone would like help doing this.

      Feedback and Knowledge Base