| | |
| | | let fileAudio = new FileReader();
|
| | | fileAudio.readAsArrayBuffer(this.files[i]);
|
| | | file_ext=this.files[i].name.split('.').pop().toLowerCase();
|
| | | if(file_ext==="wav"){
|
| | | file_ext="pcm";
|
| | | }
|
| | |
|
| | | fileAudio.onload = function() {
|
| | | var audioblob= fileAudio.result;
|
| | | file_data_array=audioblob;
|
| | |
| | | }
|
| | | function start_file_send()
|
| | | {
|
| | | sampleBuf=new Int16Array( file_data_array );
|
| | | sampleBuf=new Uint8Array( file_data_array );
|
| | |
|
| | | var chunk_size=960; // for asr chunk_size [5, 10, 5]
|
| | |
|
| | |
| | | }
|
| | | tmptext=tmptext.replace(/。/g, ","); // in case there are a lot of "。"
|
| | | var words=tmptext.split(",");
|
| | | var jsontime=JSON.parse(tmptime.replace(/\]\]\[\[/g, "],[")); // in case there are a lot segments by VAD
|
| | | var jsontime=JSON.parse(tmptime); //JSON.parse(tmptime.replace(/\]\]\[\[/g, "],[")); // in case there are a lot segments by VAD
|
| | | var char_index=0;
|
| | | var text_withtime="";
|
| | | for(var i=0;i<words.length;i++)
|