MCPcopy Create free account
hub / github.com/modelscope/FunASR / onReceive

Function onReceive

runtime/html5/static/recorder-core.js:134–153  ·  view source on GitHub ↗
(float32Arr)

Source from the content-addressed store, hash-verified

132
133 //浏览器回传的音频数据处理
134 var onReceive=function(float32Arr){
135 for(var k0 in calls){//has item
136 var size=float32Arr.length;
137
138 var pcm=new Int16Array(size);
139 var sum=0;
140 for(var j=0;j<size;j++){//floatTo16BitPCM
141 var s=Math.max(-1,Math.min(1,float32Arr[j]));
142 s=s<0?s*0x8000:s*0x7FFF;
143 pcm[j]=s;
144 sum+=Math.abs(s);
145 };
146
147 for(var k in calls){
148 calls[k](pcm,sum);
149 };
150
151 return;
152 };
153 };
154
155 var scriptProcessor="ScriptProcessor";//一堆字符串名字,有利于压缩js
156 var audioWorklet="audioWorklet";

Callers 3

oldScriptFunction · 0.70
createNodeFunction · 0.70
connWebMFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…