Ndakazvigadzirira basa rekunyora izwi richiita zvechinyorwa muchiChinese.Iyi inyaya yakapusa kana iwe uchitova neruzivo, asi kana uchinge watanga kuzviita kubva pakutanga, unounganidza matambudziko akawanda zvekuti chishuwo chinogona kunyangarika kare.JavaScript mutauro unoshanda chaizvo, unoratidzika kunge une zvese zvinodiwa nemoyo wako.
Ngatitarisei iyo yekupedzisira vhezheni yaunogona kunamira muDevTools uye woitarisa kunze.
var utterance = new SpeechSynthesisUtterance('菜');
var voices = window.speechSynthesis.getVoices();
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[0];
window.speechSynthesis.speak(utterance);
zh-CN - iyi ndiyo nzira iyo mutauro weChinese unosarudzwa mumatumbo ebrowser.Muchirongwa chedu, tinotsvaga izwi remutauro weChinese mubrowser, uye edza kuburitsa mutsara wedu.Hazvina kumbosiyana nokutaura chero mumwe mutauro.Asi pane akati wandei nuances pano.Tichisefa ruzhinji rwemitauro iripo tinosangana nemanzwi maviri echiChinese zh-CN.Zero richava izwi rechikadzi, uye rekutanga izwi rechirume.
Mukadzi
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[0];
Murume
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[1];
Uye zvakare, kuita kwezwi kuchasiyana kubva kubrowser kuenda kubrowser uye kubva kune mudziyo kuenda kune mudziyo.Iyo Chrome browser ine manzwi ayo, iyo Edge browser ine zvakasiyana zvachose, zvinofadza zvakanyanya, nenzira, uye Opera browser haina manzwi zvachose, saka hapazove nezwi rinoita.
Iyi kodhi inogona kusungirirwa pabhatani uye taura chimwe chinhu chako.
function say(voiceId){
let text = document.getElementById("pole").innerHTML
console.log (text)
var utterance = new SpeechSynthesisUtterance(text);
var voices = window.speechSynthesis.getVoices();
utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[voiceId];
window.speechSynthesis.speak(utterance);
}
uye bhatani kodhi:
<button onclick="say(1)">👨🔉</button>
Hapana mamwe matambudziko nekuita kwezwi.Ehe, zvese zvinoshanda sei pane smartphones.Ehe, hongu, kunyanya mune mobile Edge browser.Nenzira, zvichibva pane tekinoroji iyi, ndiri kuyedza kugadzira microservice yekudzidza chiChinese, hezvino izvi:
http://jkeks.ru/china .Zvese zvinoitwa sezvandatsanangura pano.