|
@@ -31,7 +31,7 @@
|
|
|
<button id="playAudio">播放</button> -->
|
|
|
<div class="pcmGraph_wrapper">
|
|
|
<span class="wrapper_span">时域波纹图</span>
|
|
|
- <div id="pcmGraph"></div>
|
|
|
+ <div id="pcmGraph" style="background: #0e2855;"></div>
|
|
|
</div>
|
|
|
<div class="wrapper">
|
|
|
<span class="wrapper_span">时频域声纹图</span>
|
|
@@ -73,9 +73,9 @@
|
|
|
var player = new PCMPlayer({
|
|
|
// inputCodec: 'Int16',
|
|
|
inputCodec: 'Float32',
|
|
|
- channels: 2,
|
|
|
+ channels: 1,
|
|
|
sampleRate: samples,
|
|
|
- flushTime: 3000
|
|
|
+ flushTime: 1000
|
|
|
});
|
|
|
let wavesurfer = WaveSurfer.create({
|
|
|
container: '#pcmGraph',//容器
|
|
@@ -83,15 +83,15 @@
|
|
|
progressColor: '#00BFBF',
|
|
|
split: false,
|
|
|
minPxPerSec: 18,
|
|
|
- // audioContext: player.audioCtx,
|
|
|
+ audioContext: player.audioCtx,
|
|
|
drawingContextAttributes: {
|
|
|
desynchronized: false
|
|
|
},
|
|
|
height: 128,
|
|
|
// barWidth: 0.8,
|
|
|
- barHeight: 30.7,
|
|
|
+ barHeight: 13,
|
|
|
splitChannels: false,
|
|
|
- audioRate: '10',
|
|
|
+ audioRate: '1',
|
|
|
plugins: [
|
|
|
WaveSurfer.spectrogram.create({
|
|
|
container: '#stftGraph',
|
|
@@ -221,7 +221,7 @@
|
|
|
//读取完毕
|
|
|
// Now feed PCM data into player getting from websocket or ajax whatever the transport you are using.Accept ArrayBuffer or TypedArray
|
|
|
// 接收PCM格式的原始数据,ArrayBuffer 类型或者 TypedArray 类型
|
|
|
- player.feed(this.result);
|
|
|
+ // player.feed(this.result);
|
|
|
let input = new Float32Array(this.result);
|
|
|
// 数据全部左移,使得小数点前有足够的整数部分, 然后取整
|
|
|
let buf = new Int32Array(input.length);
|
|
@@ -231,7 +231,7 @@
|
|
|
buf[i] = parseInt(buf[i]);
|
|
|
}
|
|
|
let uintBuf = new Uint32Array(buf);
|
|
|
- const audioDate = new Blob([addWavHeader(uintBuf, samples, 32, 1)]);
|
|
|
+ const audioDate = new Blob([addWavHeader(uintBuf, samples, 32, 2)]);
|
|
|
wavesurfer.loadBlob(audioDate);
|
|
|
drawFFTGraph(uintBuf);
|
|
|
|
|
@@ -254,12 +254,23 @@
|
|
|
objSocket.send(play_cmd);
|
|
|
playBtn.setAttribute('disabled', 'disabled');
|
|
|
}
|
|
|
+// //李兆基2 10.30.1.88
|
|
|
+// const baseUrl="http://10.30.1.88"
|
|
|
+// const baseUrls="ws://10.30.1.88"
|
|
|
+// const baseApi = baseUrl+":11086";
|
|
|
+// const baseResources = baseUrl+":9000";
|
|
|
+// const baseWs = baseUrls+":11086/ws";
|
|
|
+// const baseVideo = "10.30.1.88:10087"
|
|
|
+// const baseVioce = baseUrl+":11086/video"
|
|
|
+// const blueThemeMap = baseUrl+":9000/map/blue/foshan/"; // 蓝色地图
|
|
|
+// const greenThemeMap = baseUrl+":9000/map/green/foshan/"// //绿色地图
|
|
|
+// const mapCenter = [113.2576, 22.8383]; //[113.111836,23.066335]
|
|
|
|
|
|
+[57,53,54,55]
|
|
|
//发送消息
|
|
|
function startPlay2() {
|
|
|
- wavesurfer.setPlaybackRate(20)
|
|
|
- wavesurfer.setVolume(1)
|
|
|
- wavesurfer.zoom(5)
|
|
|
+ wavesurfer.setPlaybackRate(8)
|
|
|
+ wavesurfer.setVolume(100)
|
|
|
wavesurfer.play();
|
|
|
}
|
|
|
|