小程序录音实时波形图实现
发布于 1 年前 作者 taoren 5107 次浏览 来自 分享

实现思路:主要使用canvas绘制柱状图,音量大小由微信recorderManager.onFrameRecorded回调的数据通过快速傅里叶转换算法实现转换
<view style="display: flex; position: relative; justify-content: center; width: 100%; background-color: black;">
  <canvas id="myCanvas" type="2d" catch:touchstart="onTouchStart" catch:touchmove="onTouchMove" catch:touchend="onTouchEnd" style="width: 100%;height: 220px;"></canvas>
  <view style="position: absolute; width: 0.5px; height: 220px; background-color: blue;" />
</view>
回到顶部