Heluhelu ʻōlelo ma ka ʻōlelo Pākē

Ua hoʻonoho wau iaʻu iho i ka hana o ke kākau ʻana i ka leo o ka kikokikona ma ka ʻōlelo Pākē.He mea maʻalahi kēia inā loaʻa iā ʻoe ka ʻike, akā ke hoʻomaka ʻoe e hana mai ka ʻohi ʻana, e hōʻiliʻili ʻoe i nā pilikia he nui e nalowale ai ka makemake ma mua.He ʻōlelo maʻalahi ka JavaScript, me he mea lā aia nā mea a pau a kou puʻuwai e makemake ai.

E nānā kākou i ka mana hope i hiki iā ʻoe ke hoʻopili i loko o nā DevTools a nānā iā ia.

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 - ʻo ia ke ʻano o ka ʻōlelo Kina i loko o ka ʻōpū o ka polokalamu kele pūnaewele.Ma kā mākou papahana, ʻimi mākou i ka polokalamu kele no ka leo o ka ʻōlelo Kina, a hoʻāʻo e hana hou i kā mākou ʻōlelo.ʻAʻole ʻokoʻa ka leo ʻana i nā ʻōlelo ʻē aʻe.Akā aia kekahi mau nuances ma aneʻi.Ke kānana ʻana i nā ʻōlelo i loaʻa iā mākou e ʻike i nā leo zh-CN Kina 2.He leo wahine ka Zero, a he leo kane ka mua.

Wahine

utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[0];

Kane

utterance.voice = voices.filter(function(voice) { return voice.lang == 'zh-CN'; })[1];

Eia kekahi, ʻokoʻa ka leo leo mai ka polokalamu kele pūnaewele a me ka polokalamu.Loaʻa i ka polokalamu kele Chrome kona mau leo ​​ponoʻī, ʻokoʻa loa ka polokalamu Edge, ʻoi aku ka leʻaleʻa, ma ke ala, a ʻaʻohe leo o ka polokalamu Opera, no laila ʻaʻohe leo hana.

Hiki ke kau ʻia kēia code ma ke pihi a leo i kāu mea ponoʻī.

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);
}

a me ke code pihi:

<button onclick="say(1)">👨🔉</button>

ʻAʻohe pilikia ʻē aʻe me ka hana leo.ʻAe, pehea ia e hana ai ma nā smartphones.ʻAe, maikaʻi, ʻoi loa i ka polokalamu kelepona Edge.Ma ke ala, ma muli o kēia ʻenehana, ke hoʻāʻo nei au e hana i kahi microservice no ke aʻo ʻana i ka ʻōlelo Haina, eia kēia:

http://jkeks.ru/china .Hoʻokō ʻia nā mea a pau e like me kaʻu i wehewehe ai ma aneʻi.





bg bs ca ceb co cs cy da de el en eo es et fa fi fr fy ga gd gl gu ha haw hi hmn hr ht hu id ig is it iw ja jw ka kk km kn ko ku ky la lb lo lt lv mg mi mk ml mn mr ms mt my ne nl no ny or pa pl ps pt ro ru rw sd si sk sl sm sn so sr st su sv sw ta te tg th tk tl tr tt ug uk ur uz vi xh yi yo zh zu
Text to speech
QR-Code generator
Parsedown cheatsheet. Markdown
Filter data by column with regular expressions
Engines for creating games on LUA ?
JavaScript: draw a point
JavaScript: Speaking text in Chinese