Parcourir la source

唐洋场站调试

KEYSTAR\KR0293 il y a 2 ans
Parent
commit
aa017b105d
1 fichiers modifiés avec 19 ajouts et 11 suppressions
  1. 19 11
      index.html

+ 19 - 11
index.html

@@ -2,7 +2,7 @@
 <html>
 
 <head>
-  <!-- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -->
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <meta http-equiv="pragma" content="no-cache">
 
   <title>节点实时播放</title>
@@ -16,7 +16,7 @@
         <input id="ws_url" type="text" value="ws://10.138.6.221:28001">
       </tr>
       <tr>
-        <input id="ws_msg" type="text" value="1">
+        <input id="ws_msg" type="text" value="57">
       </tr>
     </tbody>
 
@@ -25,7 +25,8 @@
     <button onclick="connectWS()" id="conn_btn">连接</button>
     <button onclick="startPlay()" id="play_btn">播放</button>
     <button onclick="stopPlay()" id="stop_btn">停止</button>
-    <!-- <button onclick="startPlay2()" id="play_btn">播放2</button> -->
+    <button onclick="startPlay2()" id="play_btn">播放2</button>
+	<button onclick="startPlay()">播放3</button>
     <!-- <button id="btn">获取数据</button>
     <button id="playAudio">播放</button> -->
     <div class="pcmGraph_wrapper">
@@ -72,7 +73,7 @@
     var player = new PCMPlayer({
       // inputCodec: 'Int16',
       inputCodec: 'Float32',
-      channels: 1,
+      channels: 2,
       sampleRate: samples,
       flushTime: 3000
     });
@@ -81,16 +82,16 @@
       waveColor: '#FF55C5',
       progressColor: '#00BFBF',
       split: false,
-      minPxPerSec: 8,
+      minPxPerSec: 18,
       // audioContext: player.audioCtx,
       drawingContextAttributes: {
         desynchronized: false
       },
       height: 128,
       // barWidth: 0.8,
-      barHeight: 0.7,
+      barHeight: 30.7,
       splitChannels: false,
-      audioRate: '1',
+      audioRate: '10',
       plugins: [
         WaveSurfer.spectrogram.create({
           container: '#stftGraph',
@@ -225,20 +226,20 @@
           // 数据全部左移,使得小数点前有足够的整数部分, 然后取整
           let buf = new Int32Array(input.length);
           for (var i = 0; i < input.length; i++) {
-            //buf[i] = input[i] * 10000000000;//100000000000
+            // buf[i] = input[i] * 10000000000;//100000000000
 			buf[i] = input[i] * 5000000000;
             buf[i] = parseInt(buf[i]);
           }
           let uintBuf = new Uint32Array(buf);
           const audioDate = new Blob([addWavHeader(uintBuf, samples, 32, 1)]);
           wavesurfer.loadBlob(audioDate);
-          // drawFFTGraph(uintBuf);
+          drawFFTGraph(uintBuf);
           
         }
-        setTimeout('objSocket.send(play_cmd)', 500);
+        setTimeout('objSocket.send(play_cmd)', 10000);
       }
       else {
-        setTimeout('objSocket.send(play_cmd)', 1000);
+        setTimeout('objSocket.send(play_cmd)', 10000);
       }
 
     }
@@ -246,12 +247,19 @@
 
     //发送消息
     function startPlay() {
+		play_cmd = document.getElementById("ws_msg").value;
+		var ar=[53,54,55,57];
+		let i=Math.floor(Math.random()*4);
+		play_cmd=ar[i]
       objSocket.send(play_cmd);
       playBtn.setAttribute('disabled', 'disabled');
     }
 
     //发送消息
     function startPlay2() {
+		wavesurfer.setPlaybackRate(20)
+		wavesurfer.setVolume(1)
+		wavesurfer.zoom(5)
       wavesurfer.play();
     }