This topic created in 2594 days ago, the information mentioned may be changed or developed.
18 replies 2019-04-25 08:30:36 +08:00  | | 2 ihidchaos Apr 24, 2019 via Android secong mark |
 | | 4 logicr Apr 24, 2019 via Android third mark |
 | | 5 w292614191 Apr 24, 2019 我是用微信 Js-sdk 实现的,只能录制 60 秒。到 58 秒,我就 stop 了。 |
 | | 7 ddllzz Apr 24, 2019 via Android 感谢,已经用上了 |
 | | 8 shell314 Apr 24, 2019 via Android Star 一波 |
 | | 10 Exia Apr 24, 2019 很赞 |
 | | 11 xnode Apr 24, 2019 mark++!!!! |
 | | span class="no">13 dearxe2v Apr 24, 2019 帮顶 |
 | | 14 ThirdParty Apr 24, 2019 我再来一个 H5 语音转文字 和 文字转语音, 是 w3c 定义的标准,由浏览器实现
``` <form action=""> <input type="text" /> <select> </select> <input type="submit" /> </form> <div class="output"></div> <script> window.Onload= function () {
// var grammar = '#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' // //var recognition = new SpeechRecognition(); // var recognition = new webkitSpeechRecognition(); // //var speechRecognitiOnList= new SpeechGrammarList(); // var speechRecognitiOnList= new webkitSpeechGrammarList(); // speechRecognitionList.addFromString(grammar, 1); // recognition.grammars = speechRecognitionList; // //recognition.cOntinuous= false; // recognition.lang = 'en-US'; // recognition.interimResults = false; // recognition.maxAlternatives = 1;
// var diagnostic = document.querySelector('.output'); // var bg = document.querySelector('html');
// document.body.Onclick= function () { // recognition.start(); // console.log('Ready to receive a color command.'); // }
// recognition.Onresult= function (event) { // var color = event.results[0][0].transcript; // diagnostic.textCOntent= 'Result received: ' + color; // bg.style.backgroundColor = color; // }
var synth = window.speechSynthesis;
var inputForm = document.querySelector('form'); var inputTxt = document.querySelector('input'); var voiceSelect = document.querySelector('select');
function populateVoiceList() { voices = synth.getVoices();
for (i = 0; i < voices.length; i++) { var option = document.createElement('option'); option.textCOntent= voices[i].name + ' [' + voices[i].lang + '] ';
if (voices[i].default) { option.textContent += ' DEFAULT'; }
option.setAttribute('data-lang', voices[i].lang); option.setAttribute('data-name', voices[i].name); voiceSelect.appendChild(option); } }
populateVoiceList(); if (speechSynthesis.onvoiceschanged !== undefined) { speechSynthesis.Onvoiceschanged= populateVoiceList; }
inputForm.Onsubmit= function (event) { event.preventDefault();
var utterThis = new SpeechSynthesisUtterance(inputTxt.value); var selectedOption = voiceSelect.selectedOptions[0].getAttribute('data-name'); for (i = 0; i < voices.length; i++) { if (voices[i].name === selectedOption) { utterThis.voice = voices[i]; } } synth.speak(utterThis); inputTxt.blur(); } }; </script> ``` |
 | | 15 xiangyuecn Apr 24, 2019 @ ThirdParty 语音合成看起来靠谱点,语音识别嘛... 推荐一波:用 Recorder 来录音,然后把音频发送给第三方接口进行识别,简单可靠准确率奇高 |
 | | 17 ouou8 Apr 24, 2019 赞一个 |