Skip to content

Commit

Permalink
调整音量获取灵敏度
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyuecn committed Jan 7, 2019
1 parent 259f2d5 commit 7d8decb
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 40 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,15 @@ rec.open(function(){
``` javascript
set={
elem:"css selector" //自动显示到dom,并以此dom大小为显示大小
//或者配置显示大小,手动把this.canvas显示到别的地方
//或者配置显示大小,手动把waveviewObj.elem显示到别的地方
,width:0 //显示宽度
,height:0 //显示高度

//以上配置二选一

,lineWidth:2 //线条粗细
scale:2 //缩放系数,因为正整数,使用2(3? no!)倍宽高进行绘制,避免移动端绘制模糊

,lineWidth:2 //线条基础粗细

//渐变色配置:[位置,css颜色,...] 位置: 取值0.0-1.0之间
,linear1:[0,"rgba(150,97,236,1)",1,"rgba(54,197,252,1)"] //线条渐变色1,从左到右
Expand Down
2 changes: 1 addition & 1 deletion dist/extensions/waveview.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/recorder-core.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@
<input type="text" class="bits" value="8 to 96 step 8">kbps(wav固定8、16),测试音质用的,除比特率外其他参数可调整
</div>
<div class="pd">
<div style="height:100px;width:300px;" class="recwave"></div>
<div style="height:100px;width:300px;border:1px solid #ccc;box-sizing: border-box;" class="recwave"></div>
</div>

<hr>
<audio class="recPlay"></audio>
<audio class="recPlay" style="width:100%"></audio>
<div class="reclog"></div>
<div class="recinfo"></div>
</div>
Expand Down Expand Up @@ -187,17 +187,20 @@
};
};
var recblob={};
function recstop(call){
function recstop(batCall){
if(rec){
if(!batCall){
reclog("正在编码"+rec.set.type+"...");
};
var t1=Date.now();
rec.stop(function(blob,time){
var id=RandomKey(16);
recblob[id]={blob:blob,set:$.extend({},rec.set),time:time};
reclog("已录制:"+intp(rec.set.bitRate,3)+"kbps "+intp(rec.set.sampleRate,5)+"hz 花"+intp(Date.now()-t1,4)+"ms编码"+intp(blob.size,6)+"b ["+rec.set.type+"]"+intp(time,6)+'ms <button onclick="recdown(\''+id+'\')">下载</button> <button onclick="recplay(\''+id+'\')">播放</button> <span class="p'+id+'"></span> <span class="d'+id+'"></span>');
call&&call();
batCall&&batCall();
},function(s){
reclog("失败:"+s);
call&&call();
batCall&&batCall();
});
};
};
Expand All @@ -219,6 +222,7 @@
reclog("码率列表有误,需要? to ? step ?结构");
return;
};
reclog("开始批量编码,请勿进行其他操作~");

rec.set.type=type;
rec.set.sampleRate=sample;
Expand Down
2 changes: 1 addition & 1 deletion recorder.mp3.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 7d8decb

Please sign in to comment.